3

I'm trying to run Minecraft on my GeForce card (with Optimus, bumblebee is installed), but without having to type the command in the console every time I want to open it.

How can I configure bumblebee to always run a program with optirun by default? Will the same method work with a .jar set to launch as an executable as it would with a standard executable?

1
  • Ah, didn't notice that before. Thanks for correcting me, fixed.
    – Alex
    Jul 20, 2012 at 21:12

3 Answers 3

1

If there is an icon for the program available in the launcher and/or dash you can simply adapt the .desktop file to always use optirun. A simple way to change the respective command line is to use the alacarte tool.

1

There might be more elegant ways to do it, but this is what I did:

-Open GEdit or other text editor

-Type in "optirun [or primusrun] java -jar '[directory of launcher jar, IE "/home/[user]/downloads/minecraft.jar"]"

-save the file as "Minecraft.sh", to make it an executable script

-right-click the file, go to properties > permissions > check the "allow executing this file as a program"

Now you should be able to right-click the file and click run. I know there's an option in the file manager properties to make the file execute on double-click, but I'm on Kubuntu, and it's a bit different. I don't remember how to change that option it on regular Ubuntu, sorry.

Also, protip, if you're not already using it, use Primusrun instead of Optirun with bumblebee. if primusrun isn't installed, it's just "sudo apt-get install primus". I've noticed some pretty definite speed boosts with it.

0

I know this question is old, but I'd like to give my own contribution as well. This is valid for any distribution, not only Ubuntu.

1. Create a command alias

So then you will be able to run the application from terminal or everywhere else that references it. This is the most generalized possible solution for the problem. For my example, I'll be editing the command obs to always run with primusrun.

Run this commands:

echo 'alias obs="primusrun obs"' >> ~/.bashrc
source ~/.bashrc

Now when you run obs in the terminal, it will call primusrun obs instead.

If then you want to run the application without primusrun for whatever reason, you'll need to make an absolute call to its executable. That's easy:

$ /usr/bin/obs

This will work as well for the desktop launcher if it calls for the relative command obs too, but if the launcher calls for the absolute path, like /usr/bin/obs, then you'll need to go to step 2 as well.

2. Edit the launcher

Find where the .desktop file is located. If it is a userspace application (like Wine applications), it should be under ~/.local/share/applications, otherwise it should be under /usr/share/applications. Find the .desktop file for your application (this can be somewhat tricky, as some file managers will display the application title instead of the actual file name) and edit it with you favorite text editor:

sudo nano /usr/share/applications/obs.desktop

Find the line Exec= and add primusrun or optirun before the command.

[Desktop Entry]
Version=1.0
Name=OBS
GenericName=Streaming/Recording Software
Comment=Free and Open Source Streaming/Recording Software
Comment[ru]=Бесплатная программа с открытым кодом для записи/трансляции видео
Exec=primusrun /usr/bin/obs
Icon=obs
Terminal=false
Type=Application
Categories=AudioVideo;Recorder;
StartupNotify=true

Save and quit.

Bear in mind that if the launcher calls for the relative command (just obs instead of /usr/bin/obs) this will effectivelly cause the desktop launcher to run the command with two primusrun like primusrun primusrun obs, but this won't cause any issue.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .