lubuntu how to execute 2 commands in .desktop file?
I have created a .desktop file in /etc/xdg/autostart
which runs the command
Exec= disper -d LVDS,VGA-0 -r auto -e -t right
Now I want to add a second command to run after the first command. How do I do this ?
Apart from calling an external bash script there is this option:
Exec=sh -c "disper -d LVDS,VGA-0 -r auto -e -t right; echo Running other command; echo ...and an other one"
According to this source:
The
Exec
key must contain a command line. A command line consists of an executable program optionally followed by one or more arguments.
My understanding of the above being that the Exec
key supports a single command and that command can only contain 1 executable followed by arguments for the executable.
My tests to combine commands:
firefox && gedit
firefox & gedit
firefox ; gedit
resulted in the second executable being read as an argument which seems to confirm the text.
The easiest way is to wrap it all up in a script. For example:
#!/bin/bash
disper -d LVDS,VGA-0 -r auto -e -t right
second_command_here
Save it somewhere, such as ~/bin/my_wrapper_script.sh
, and make it executable. Then change the Exec
line of your .desktop
file to point to it:
Exec=/home/my_username/my_wrapper_script.sh