-
Perhaps you want to run a certain command often, or have a program installed that for some reason wasn't added to the app drawer. Well, if you know the command to start it, that can be fixed easily.
You'll want to go to /home/phablet/.local/share/applications (image 1). Can't find it? Make sure you have show hidden files enabled. Here you'll see a lot of .desktop files - create a new one of the form name.desktop. Note that this is not the name you'll see in the app drawer, we'll specify that later.
Open the file with a text editor. I can recommend Seabass2 if you don't have one yet. The first line should be:
[Desktop Entry]
Then we need to define three values: Name, Exec and Icon. For example:
Name=Discord_Libertine Exec=libertine-launch -i focal-3 "armcord" Icon=/home/phablet/Downloads/Discord.png
Replace the values with what suits your usecase, of course. There are some more things you can specify if you want:
Terminal=false Type=Application Comment=Launch Armcord inside Libertine
And so on. These have, as far as I can tell, no effect.
And that's it! Save, refresh the app drawer by pulling down, and it should show up just fine.
The folder where you have to make the .desktop file:
An example file:
Discord_Libertine in the app drawer:
-
-
I actually had to add the line with "Type=Application" before the script launcher would show up in the launcher. But it seems not to work for commands needing
sudo
. -
@danfro try
pkexec
instead ofsudo
. -
-
@arubislander Thanks for that suggestion. But it does not seem to help.
i have
Exex= pkexec systemctl restart ofono.service
but get this error:[08.11.24 08:21] Error creating textual authentication agent: Error opening current controlling terminal for the process (`/dev/tty'): No such device or address
I can use this line of code fine in terminal
sudo -S <<< "mypassword" systemctl restart ofono.service
. But running it from that desktop file brings this error:[08.11.24 08:30] [sudo] password for phablet: [08.11.24 08:30] sudo: no password was provided [08.11.24 08:30] pam_extrausers(sudo:auth): conversation failed [08.11.24 08:30] pam_extrausers(sudo:auth): auth could not identify password for [phablet]
It doesn't matter if terminal is set to true or false in the desktop file.
-
@danfro said in Add a launcher to the app drawer to run a command:
i have
Exex= pkexec systemctl restart ofono.service
but get this error:When you perform that command in the terminal, you don't get a window pop up with a password prompt?
-
@arubislander not a popup, but some terminal output asking for the password. But even in terminal I get a authentication failed (
Error executing command as another user: not authorized
) error. With sudo at least it works in terminal, just not when using the desktop icon to exec the command. -
@danfro I have enclosed an example of what I get.
Maybe it is because I have snaps enabled on my device.
-
@arubislander For me it's the same authentication failure like @danfro The GUI which comes up in your example isn't there for me. You have to enter the password in the same terminal-window where you have entered the command. (Vollaphone, UT 20.04 devel)