2

I tried adding a desktop shortcut like described here

but those answers seem to be outdated since 19.10

I try to add this script as launcher on my desktop:

sudo /usr/local/sbin/turbo-boost.sh toggle

you find the script and my try to add it as desktop icon here: https://unix.stackexchange.com/a/547261/20661


UPDATE:

The .desktop file doesn't work if I click on it in the default file browser nautilus in Ubuntu 19.10, but it works fine in a thunar window.

I tried this now: I created another launcher with the command line

Exec=sudo /usr/bin/tempfile

which behaves strange:

  • If I call this in nautilus it creates a temp file which belongs to my user
  • If called in thunar, it asks for sudo password in another shell window and then creates a temp file that belongs to root
rubo77
  • 31,573
  • 49
  • 159
  • 281
  • Is that shortcut opening in text editor? Or isn't shortcut doing anything? – Kulfy Feb 20 '20 at 10:55
  • I get the error `gdbus.error: ...unknown xorg.xfce.panel was not provided by any .service files` and nothing happens – rubo77 Feb 20 '20 at 11:05
  • 1
    i need to know, is the script runs as expected when you executing it in terminal? – Jastria Rahmat Feb 23 '20 at 21:52
  • Sure, If I add sudo and I added my user correctly to the sudoers file – rubo77 Feb 24 '20 at 00:15
  • But I don't need to enter the password, I am allowed in sudoers – rubo77 Feb 24 '20 at 01:49
  • I have posted [an answer](https://askubuntu.com/a/1185418/816190) to a similar question. There I talked about 3 ways to create a desktop entry for an application that requires sudo privileges. That might be helpful just in case. – Kulfy Feb 26 '20 at 13:18

1 Answers1

1

This .desktop-file works if you have an entry in sudoers:

my_username_here ALL = NOPASSWD: /usr/local/sbin/turbo-boost.sh

Make sure, you add an entry Path and GenericName and put it in this location: /usr/share/applications/toggle-turbo-boost.desktop

[Desktop Entry]
Version=1.0
Type=Application
Terminal=true
Name=toggle turbo-boost
Icon=/usr/share/icons/Humanity/apps/64/gkdebconf-icon.svg
Exec=sudo /usr/local/sbin/turbo-boost.sh toggle
X-MultipleArgs=false
Categories=GNOME;GTK;
StartupNotify=true
GenericName=Toggle Turbo-Boost
Path=/tmp/

It is not possible to click on it in nautilus, but you can search for i in the dash:

  1. press SUPER and search for "Toggle Turbo Boost", you will see the icon.
  2. press ENTER to execute, or right click to "Add to Favorites" which will add a button in the quick-start bar.
rubo77
  • 31,573
  • 49
  • 159
  • 281