Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Comments on How do I tweak the start parameters of GUI apps?

Parent

How do I tweak the start parameters of GUI apps?

+4
−0

There are many GUI apps on my computer that show up as eg. items in the start menu. When I launch these, what if I want to control how exactly they are launched, such as setting environment variables or adding additional parameters?

For example, I can of course type SOME_ENVAR=foo gedit --some-argument in the console. But I don't normally launch gedit from the console, I click on its menu item or it opens automatically when I double click on text files.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

Answer sketch (1 comment)
Post
+2
−0

tl;dr:

  1. Find the .desktop file that you are currently running
  2. It is probably in a system location, so copy it to a user location
  3. Modify the file contents

The normal way to create icons for GUI apps on Linux is to create .desktop files. These are files describing the shell-style command used to start the program, any additional parameters (such as command line arguments and environment variables specific to the program) as well as some metadata (such as a description, localized names, the actual icon of the program) that graphical desktop environments can use to display icons for the program in their GUI.

Generally speaking, if you create a correct .desktop file in the correct location, the program will show up in the various GUI menus, and when you click it it will run whatever you put under Exec. The easiest way to create a "correct" file is to copy an existing working one and modify it. There are many "locations" that these files can go in, but the important distinction is system vs. user files (aka "entries"):

  • System entries will affect all users on that computer. You will typically need sudo to edit them. They are usually put there by the package manager, so if you edit the system file and also later update the package and the upstream modifies the .desktop file, there will be a conflict between changes you made and the new version from upstream. Your package manager will have to resolve this conflict somehow, but it's always much easier to avoid the conflict to begin with and instead edit the user file.
  • User entries will be under you home directory (~) in locations such as ~/.local/share/applications/. If the same program has both a system and a user entry, the user entry will override the system one. Packages do not normally put stuff in ~/.local/share/applications (although the programs themselves might, when run) so this is a safer place to put modified files. You can start by copying the system file to the user location and modifying from there. User files will only apply to you, other users will not see entries you put there.

For details, see:

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

1 comment thread

Will `SOME_ENVAR=foo gedit` in Exec actually work? (1 comment)
Will `SOME_ENVAR=foo gedit` in Exec actually work?
Quasímodo‭ wrote about 1 year ago

Since you mentioned environment variables in the question, I ask: Will SOME_ENVAR=foo gedit in Exec actually work? Did you try that? I have suspicion that it needs to be written otherwise.