How can I create a launcher that opens a terminal and runs another command?

0
8
Asked By VelvetCedar42 On

I'm trying to make a single launcher for several tasks on Linux Mint XFCE, such as starting games and running an update script. My .desktop launcher works for some commands, but Steam and the update command—which should open another shell script that updates everything and reports what changed—do nothing. I've tried using xterm and other terminal commands without success. What is the correct way to configure the launcher?

2 Answers

Answered By CopperLynx18 On

You can also set the launcher type to Application in Terminal using XFCE’s launcher editor. That is usually simpler than manually invoking a terminal emulator. Since system updates require administrator privileges, the script can call `sudo` normally; avoid configuring passwordless sudo unless you fully understand the security implications. Also check that the script runs correctly from a terminal first, because .desktop files may use a different working directory and environment than your interactive shell.

VelvetCedar42 -

I already have a pause at the end so the terminal stays open. I’ll check the launcher’s terminal setting and use absolute paths for the script.

Answered By QuietMarble7 On

For a .desktop launcher, try using the standard desktop-entry option `Terminal=true`. This tells XFCE to open the system’s configured terminal instead of requiring you to hard-code `xterm` or another terminal emulator. Make sure the `Exec=` line contains the full path to the script or executable, and that the script is executable with `chmod +x /path/to/script.sh`. A basic launcher could look like this: `[Desktop Entry]nType=ApplicationnName=System UpdatenExec=/home/yourname/bin/update.shnTerminal=true`. If the script needs to pause so you can read its output, add a prompt such as `read -p "Press Enter to close..."` at the end.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.