To restart Ubuntu 12.04 you now have to open a terminal (ctrl+alt+t), type "sudo shutdown -r 0" , followed by your password. I have been trying to write a script in Autokey to do this automatically, but can't manage to bring up the terminal window: keyboard.send_keys("++t") doesn't seem to work, so presumably an instruction to open gnome-terminal is needed. If anyone has a quick answer to this I would be very grateful - otherwise I'll try to learn some Debian coding..... Thanks in advance, Kaspin"
If you're open to an easier suggestion not using AutoKey, you can go to System -> Preferences -> Keyboard Shortcuts.
From there click "Add".
Now name it "Shutdown" or something, and use "gksu shutdown -r 0" as the command.
Now click the "Shortcut" cell for its row, and press you're desired key combination.
NOTE: I am running Ubuntu 11.04 but this should be applicable.
To shutdown your system using an AutoKey script here's what you need to do.
Select a folder in AutoKey ("New Script" will only be available when a folder is selected)
Go to File -> Create -> New Script
Enter the following for the script:
system.exec_command("gksu shutdown -r 0", False)
NOTE: Looking at the AutoKey sample scripts it looks like you use
system.exec_command()to execute shell commands which would be the equilivlent to calling the standard python function
subprocess.call("Some shell command", shell=True)(if you're familiar with python).
Click the "Set" button to the right of "Hotkey". Click "Press to Set", press your desired shortcut key, and then click any desired modifiers for that key ("Control", "Alt", "Shift", "Super"), and then "OK".
NOTE: Alt+Control+T is the shortcut combo for opening
Click "Save" and you're done.