When I make a custom shortcut with gnome (gnome-control-center keyboard
) I can't set it to a command. Why?
Example: I can't set a shortcut for sudo apt-get update
. Instead I must first invoke a graphical terminal, then bash, then execute the command (something like: gnome-terminal -e "bash -c \"sudo apt-get update ; exec bash\""
Also is there another (better) workaround?
You can. You've just shown you can! You can even simplify it a little:
It needs a terminal because it's interactive (because of
sudo
). If you just want to suppress the password request, you could edit your/etc/sudoers
file so it doesn't require a password forapt-get
. In my opinion, this isn't great because it might be abused.For this command there is another option: Aptdaemon. This is what the Software Centre and Update Manager now use for permissions (it uses PolicyKit and it's designed on PackageKit). To update apt, just run:
That shouldn't require a password and if it does, it should be able to pop up a PolicyKit box without needing a terminal to be spawned.