(That's super convenient. I loooove it! )
This method was tested on Xubuntu 12.04 and 16.04, but should work on all GNU/Linux distros that offer a shell-command for suspend.
You need to configure your user to be allowed to execute the supend command "pm-suspend" with superuser-rights, but without prompting for a password.
Therefore you need to configure the "sudo" configuration.
IMPORTANT: Never edit /etc/sudoers directly, but use "visudo":
Code: Select all
$ sudo visudo
Code: Select all
me ALL= NOPASSWD: /usr/sbin/pm-suspend
Now assign a keyboard shortcut for your window manager.
In XFCE this is done in "Settings > Keyboard > Application Shortcuts".
Add the following command:
Code: Select all
sudo pm-suspend
That's it!
You can now send your PC to sleep using a keyboard shortcut.