Consider this script (saved as /home/muru/test.sh
):
#! /bin/bash
DRI_PRIME=1 glxgears -info
A basic launcher for this would look like (say, save it as /home/muru/test.desktop
):
[Desktop Entry]
Type=Application
Terminal=true
Name=glx-gears-info
Exec=/home/muru/test.sh
Make them both executable:
chmod +x test.sh test.desktop
Now you should have these two entries in your home folder:
Notice how the name is glx-gears-info
even though the launcher's filename is test.desktop
. You can double click on it to start the script:
For a script like (say, located at /home/muru/start-aria.sh
):
#!/bin/bash
touch /home/cip/Downloads/aria2/session.txt && \
aria2c --enable-rpc --rpc-listen-all \
--save-session=/home/cip/Downloads/aria2/session.txt \
--input-file=/home/cip/Downloads/aria2/session.txt -x16 -s16 -k1M \
--dir=/home/cip/Downloads/aria2
(I split the command into multiple lines for readability) the launcher file would look like (say /home/muru/start-aria.desktop
):
[Desktop Entry]
Type=Application
Terminal=false
Name=Start Aria2
Exec=/home/muru/start-aria.sh
You can set Terminal=false
here as this command probably doesn't need a terminal.
To get the terminal window when using Xfce launchers, tick 'Run in Terminal'.
A second command, that would close aria2, can be added in the same Xfce launcher: pkill aria2c
Also:
(namely 'show last used item' and 'inside button'),
- and adding two specific icons,
the launcher will always display the current status of aria2: running or closed.
Best Answer
I just call sudo if the program needs root permissions, but doesn't have:
"$0"
contains the name of the script,"$@"
optional arguments. It may be omitted if your program does not accept arguments.Note: this shellscript is expected to be run in a shell, if this script should run as GUI, use something like
gksu
orkdesudo
instead ofsudo
.