How do I set the launch arguments for applications in the unity launcher?

Asked by Rocko

For instance, if I want to run the pinned gnome-terminal application with the arguments --geometry=80x25, how do I go about this? I would have expected to be able to edit the arguments from the launcher itself much like in gnome 2 or dockbarx.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu unity Edit question
Assignee:
No assignee Edit question
Solved by:
actionparsnip
Solved:
Last query:
Last reply:
Revision history for this message
Best actionparsnip (andrew-woodhead666) said :
#1

If you run:

alacarte

it may give an editor. If all else fails you can run:

gksudo gedit /usr/share/applications/gnome-terminal.desktop

and add the option to the line beginning:

Exec=

Save the new file and close gedit, the options will then be added.

If you want a handy terminal then you could look into guake which will drop down from the top or hide when you press a hotkey:
http://www.youtube.com/watch?v=VvHbpQYlgmg

Revision history for this message
Max Waterman (davidmaxwaterman) said :
#2

This doesn't seem to work for me when trying to make google-chrome launch with '--allow-file-access-from-files'; I've made appropriate changes to the file /usr/share/applications/google-chrome.desktop :

$ grep Exec /usr/share/applications/google-chrome.desktop
Exec=/opt/google/chrome/google-chrome --allow-file-access-from-files %U
Exec=/opt/google/chrome/google-chrome --allow-file-access-from-files
Exec=/opt/google/chrome/google-chrome --allow-file-access-from-files --incognito

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04 LTS"

Can you explain what I might be doing wrong?

Revision history for this message
Rocko (rockorequin) said :
#3

Thanks actionparsnip, that solved my question.

Revision history for this message
Max Waterman (davidmaxwaterman) said :
#4

Rocko, can you give more information on your environment (eg, which version of Ubuntu)? I'm wondering why this doesn't work for me.

Also, which part of actionparsnip's answer solved your problem? He gives several answers; for me 'alacarte' doesn't work (it causes some kind of crash, though not the UI), the alternative terminal isn't a general solution (ie doesn't answer the question "How do I set the launch arguments for applications in the unity launcher?", and, as I mention, I can't get the desktop file to make any difference to google-chrome.

Which one did you get working?

Thanks,

Max.

Revision history for this message
Rocko (rockorequin) said :
#5

I'm running Ubuntu 12.04, and I just edited /usr/share/applications/gnome-terminal.desktop to adjust the Exec line, ie as gnome-terminal --geometry=80x50.

You're right in that the answer to this question is probably more accurately "you can't, because unity-launcher doesn't support it", but editing the launcher files is a workaround that it is better than nothing.

What you've done looks fine to me but I can't test it myself because I don't have google-chrome installed, only chrome-browser, and it looks like chrome-browser doesn't have --allow-file-access-from-files as an option.

I'm sure you've checked already, but is the unity launcher using the desktop file you edited in /usr/share/applications? It is possible to drag and drop local desktop files into it and then I imagine it would ignore the one you're editing.

Revision history for this message
Max Waterman (davidmaxwaterman) said :
#6

Rocko: thanks for the elaboration. It sounds like what I'm trying should work, so I will try to figure out why it doesn't - from your comment, it seems like I'm editing the wrong file.

Revision history for this message
Max Waterman (davidmaxwaterman) said :
#7

FYI, it indeed wasn't using /usr/share/applications/google-chrome.desktop; it was instead using ~/.local/share/applications/google-chrome.desktop and editing that had the desired effect. So, the lesson is to not only look in /usr/share/applications for the applications .desktop file, but also ~/local/share/applications.

Revision history for this message
Rocko (rockorequin) said :
#8

omgubuntu just reported on this app, which among other things lets you edit the exec line of application desktop files in your ~/.local/share/applications folder:

https://launchpad.net/~menulibre-dev/+archive/devel

It's called menulibre but comes up as Menu Editor when you search for it in the dash. There is a screenshot of it at http://www.omgubuntu.co.uk/2012/07/a-quick-look-at-more-awesome-ubuntu-appshowdown-apps-in-development.