associate files with steam app (linux)
Thu 29 December 2016 linux steam , 0 comments

Steam powered Fig. 01. steam powered!

This is for linux users (tested with Ubuntu) as the title implies.

Alright, so some days ago I discovered that Blender can also be installed through steam, yeah… I know, I’m late to the party but oh well.

Anyway, let’s cut to the chase. When installing the app I selected the option to create a shortcut in the start menu (dash in my case since I’m using Ubuntu).

Now what this does under the hood is to create a .desktop file under $HOME/.local/share/applications, in my case it was $HOME/.local/share/applications/Blender 2.78.desktop since I’m using Blender v2.78. Blender is a pretty well known software by now and I thought, hey, why not have it open up files when double-clicking on them?… hm, but how to do it exactly? I mean Blender opens through steam.

Let’s see how the default steam .desktop file looks like:

[Desktop Entry]
Name=Blender 2.78
Comment=Play this game on Steam
Exec=steam steam://rungameid/365670
Icon=steam_icon_365670
Terminal=false
Type=Application
Categories=Game;

If you know anything about .desktop files then you’ll realize that there’s no way you can use this default steam creation to associate .blend files with. First of all it’s missing the %f (path to file) var in the Exec entry. So I thought to myself, right, I just need to add this var to Exec, but no! Nothing happens, with that, there’s more. First we need to associate this .desktop file with the proper MIME type which is application/x-blender in this case, second the URL-like entry with steam:// disregards any other arguments passed to steam anyway so that doesn’t work.

I had a look at the steam wiki page and discovered some useful command line option. To cut it short, this is how I modified the Blender 2.78.desktop file so that whenever I double-click on a .blend file it will open with blender through steam:

[Desktop Entry]
Name=Blender 2.78
Comment=Play this game on Steam
Exec=steam -applaunch 365670 %f
Icon=steam_icon_365670
Terminal=false
Type=Application
Categories=Graphics;
MimeType=application/x-blender;

Notice how Exec line changed, also the new MimeType line and finally then change in Categories so it shows in the proper place in Ubuntu‘s dash.

That’s it, enjoy opening .blend files through steam with a double-click. It might be necessary to right-click a .blend file first, go to Properties > Open With and select Blender 2.78 (in my case) from the list. Of course this can also be applied to any other steam application as long as you set the proper MIME type etc.