[Wine] Re: Bash Script Shorcuts for Steam Games
wineforum-user at winehq.org
Sat Sep 24 01:03:48 CDT 2011
Are you in Linux? If so, then you can make launchers, which have pretty icons. Why use a script if you can have a launcher?
Either way, the contents of a launcher and the contents of a bash script are exactly the same.
The following runs Portal:
> env WINEPREFIX="/home/shjake/steam" wine C:\\windows\\command\\start.exe steam://rungameid/400
How on Earth did I know that? I didn't. I just copied and pasted it out of an automatically generated launcher that got put on my desktop.
If you are in Linux, you should be getting automatically generated launchers on your desktop, or maybe that's only if the program normally puts a shortcut on the desktop.
But you can keep going just fine without automatically generated launchers, you just have to manually make them.
Since your question was about how to make a bash script, I will answer that first.
Make a new blank file. Most GUIs let you right-click the desktop or in any folder, go to "New", and then "text document" or "empty file" or something like that. The Mac OS X GUI does not have that feature by default, but there is a way to make it have it. Gnome has it under "Create Document" by default.
Open the file up in a plain text editor (gEdit, Mac's plain TextEdit or whatever it's called, etc. As opposed to LibreOffice Writter or MS Word.) Just paste the "code" right in the file and save it.
Then, if in Linux, right-click the file, go to properties, go to the permissions tab, and check to allow the file to run as a program. If your GUI doesn't have that option, there is a way to do that in terminal that I don't know off the top of my head.
Now double-click the file and choose "run", and it should run.
The "env" says that you're about to define an environmental variable, WINEPREFIX in this case. WINEPREFIX specifies the WINE prefix I have the program installed in (duh). A WINEPREFIX is a folder that WINE can use as a C: drive. Yes you can have more than one, and yes, each one is like it's own little "WINE world".
The "wine" isn't just a universal command to run wine. It's actually a file name at the assumed location of /usr/bin. If the file was named bob, you would actually write "bob" instead of WINE. if the WINE executable was somewhere other than /usr/bin, you would likely have to write out the full path to it in place of merely writing "WINE".
The next part has WINE run start.exe to run Portal in some extraterrestrial syntax.
Now making a launcher (in Ubuntu-like distros of Linux):
Right-click the desktop or wherever, click "Create Launcher". There will be a wizard. It is of type "Application". Give it a name, and paste in the command discussed earlier. Click the picture of a spring-board (the default launcher icon) and pick a relevant icon if you have one. If you missed the wizard, right-click the new launcher and go to properties. Give it a name, perhaps a description, and paste in the command as discussed earlier.
To acquire a relevant icon, you can download IconsExtract and extract the icon from the exe as an ico. You can then use GIMP select one layer of the ico, and save that layer as a png. You can then use that png as the picture for the launcher.
How the automatic launcher generator gets the relevant icon for the launcher, I don't know. I just opened a launcher with gedit, and for the icon it says "546C_c7cb09b9f0fbb9589b4bd5a8217c8333c4d8204e.0". I think I'll stick with IconsExtract + GIMP. It's fairly simple. The multiple layers part might throw you off for a while, but once you find a method, like making a copy of the ico and deleting the other layers, or making the other layers invisible or something, you'll be fine.
More information about the wine-users