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

How do I add a shortcut to run a program to my DE?

+2
−0

My DE has a bunch of programs in the start/applications menu. How can I add my own in there? For example, say I found a terminal command foo --bar --baz that does something I want. But I don't want to run it from the terminal every time, I want to make a shortcut that I can click on.

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?

0 comment threads

1 answer

+2
−0

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.

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

1 comment thread

"Couple of directories" (1 comment)

Sign up to answer this question »