RetroFed Forum
Your home away from modern life.
How to create a shell shortcut?
Post Reply
AuthorMessage
Someonelol lemmy.dbzer0.com Someonelol@lemmy.dbzer0.com
Joined: 2023-06-16
Quote

How can I make a desktop shortcut of the two highlighted shell files (forge.sh and forge-adventure.sh)? Copying and pasting doesn't work since the filepath isn't brought over with them. I've tried using Menu Editor but can't find a decent guide on setting it up.

1   Original
Brainberry1337 feddit.org pandorum@feddit.org
Joined: 2025-03-05
#2 · (edited) Quote Reply

This thread is already over a month old, but here are my two cents anyway.

Via GUI

  1. Right-click on the desktop → Create new empty file with file extension .desktop

  2. Open the file in a text editor such as Kate and paste in the information for the desktop shortcut:

    [Desktop Entry]
    Type=Application
    Name=Shortcut Name
    Exec=/path/to/script.sh
    Icon=utilities-terminal
    Terminal=true
    

    Notes:

    • The Exec path to the script must of course be set accordingly.
    • If you set Terminal=false then the script will run invisibly in the background.
    • Remember to set permission to run the shortcut as a program (via right-click on the shortcut → Properties).

Via Console

This is a one-liner for the bash/fish console. It creates a desktop shortcut for the current user, fills in the example content from above and sets execution permission for the shortcut.

printf '[Desktop Entry]\nType=Application\nName=Shortcut Name\nExec=/path/to/script.sh\nIcon=utilities-terminal\nTerminal=true\n' > "$(xdg-user-dir DESKTOP)/MyShortcut.desktop" && chmod +x "$(xdg-user-dir DESKTOP)/MyShortcut.desktop"

You can change the file name of the shortcut and the contents of the file afterwards, or before you send the command to the console.

2
Post Reply
Back to top