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

Post History

66%
+2 −0
Q&A How do I add a shortcut to run a program to my DE?

On Linux, the basic way to run every program is to invoke it through a terminal. The shortcuts in DEs come from ".desktop" files. On a Linux system, there are a couple of directories (system wide,...

posted 6mo ago by matthewsnyder‭

Answer
#1: Initial revision by user avatar matthewsnyder‭ · 2024-06-03T08:04:53Z (6 months ago)
On Linux, the basic way to run every program is to invoke it through a terminal.

The shortcuts in DEs come from ".desktop" files. On a Linux system, there are a couple of directories (system wide, per user, ...) for these files. If you put a file in these directories, with the extension `.desktop`, and the correct syntax inside, a new shortcut will show up.

Briefly, `.desktop` files will have an `Exec` field which is the terminal-style command that will be executed when you click the shortcut. This is the most important part. The rest is explained in https://wiki.archlinux.org/title/Desktop_entries and other places. However, I think the easier thing is to find another shortcut, copy it, and edit the parts you want rather than starting from scratch.

IMO the best place to put your own .desktop files is `~/.local/share/applications/`. This way you won't need sudo and when you backup your home dir, the shortcuts will also be backed up.

Another option is to create a shell script (normally with `.sh` extension) by putting something like `#!/bin/bash` on the first line (so that the OS knows it's a script) and the command below. You then have to make the script executable (`chmod +x my_script.sh` or right click/properties). After this, if you double click on the script in your file manager, it should launch just like any other program. This way you don't have to create a desktop file.