How to pass extra cmdline parameter to a Gnome Apps

I always add frequently used Apps to Gnome’s Favarite bar.

In General, how can I modify the App with extra cmdline parameters?

Even better, can I have two icons in Favarite, one with default and one with those extras with some kind of identifications?

2 Likes

You can create custom launchers by adding .desktop files to the folder ~/.local/share/applications. (Since .local starts with a ., it is hidden from the ls command unless you use ls -a. You can also get to it in the Files application by hitting Ctrl-L to jump to the title bar and typing ~/.local/ and hitting enter.)

The specification for .desktop files is on freedesktop.org, including a sample. (But many of the fields aren’t strictly required.)

[Desktop Entry]
Version=1.0
Type=Application
Exec=gnome-terminal --geometry=80x25 -- /home/mattdm/.local/bin/connect-to-server
Icon=network-workgroup
StartupNotify=true
Terminal=false
Categories=Utility;
Name=Connect to Server
Comment=Connect to Server

which I use to connect to a server which needs to go through some hoops rather than just a simple ssh connection (the command /home/mattdm/.local/bin/connect-to-server jumps those hoops and is executed when the gnome-terminal shell starts — just like you are looking for, it’s an app with extra command-line parameters added.) I also changed the icon so I can easily tell this apart from the normal terminal icon.

You’ll find that this is where Steam and other programs also drop their own desktop entries; for example, I have:

[Desktop Entry]
Name=Stellaris
Comment=Play this game on Steam
Exec=steam steam://rungameid/281990
Icon=steam_icon_281990
Terminal=false
Type=Application
Categories=Game;

as well.

Once you have a .desktop file in place, you will be able to find it in the applications list in the overview. From there, drag it to the dock (or right-click and Add to Favorites).

5 Likes

Thank you very much!

I looked at ~/.local/share/applications, there is one .desktop file created by Telegram which I can handily copy and modify. And it works!

It is something I wanted to do for years!

discussion.fedoraproject.org is really the place to get help on using Fedora!

5 Likes

5 posts were split to a new topic: How can I locate the “.desktop” of an existing Gnome App, so that I can copy and modify it?

I’ve tweaked the topic slightly.

“Adding new command line parameters” is different to “passing extra parameters”. To add new command line options, one has to edit the sources of the software so that it can parse the new options. What we’re discussing here is simply how to pass more of the already existing options to a tool by default.

1 Like

Thanks.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.