How to run .desktop icon from sudo

Solution 1:

NEVER EVER use your password, stored in a .desktop file. It is terribly unsafe.

Furthermore, you cannot run complicated commands in a .desktop file just like that, but that is another subject.

What to do

You have a few options:

  1. Add gddccontrol to the sudoers file, as explained e.g. here. This can be done if you are sure the application cannot be used to do maliceous things.

    Then use

    Exec=sudo gddccontrol
    

    in the Exec=-line

  2. Another option is to replace the Exec= line by:

    Exec=gksu gddccontrol
    

    In this case, once you click the icon, you will be prompted to enter your password via gui.
    You possibly need to install gksu:

    sudo apt-get install gksu
    

Solution 2:

Using sudo will by definition prompt a password request. What you need to do is to grant execute permissions to your user. I'm not sure where that program is located, but for the sake of this answer, let's assume it is /usr/bin/.

In a terminal run this:

sudo chmod o+x /usr/bin/gddccontrol

That command is granting other users (like you) the right to execute the program without need for permission.

Then, in the .desktop file, just use:

Exec=gddccontrol