Created
October 1, 2016 05:45
-
-
Save harish2704/25857caf89076d5a78e996df3fa6ac56 to your computer and use it in GitHub Desktop.
A simple commandline tool to show system Shutdown/suspend/hibernate/restart dialog. in a Linux desktop environment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# A simple commandline tool to show system Shutdown/suspend/hibernate/restart dialog. | |
# this tool can be used in any modern linux desktop environemtnt provided the following packages are instaleld | |
# * systemd - The new system service manager | |
# * yad - A powerfull alternative to zenity or 'dialog' command | |
yad \ | |
--on-top \ | |
--center \ | |
--text-align center \ | |
--title="Ok Bro, Lets take rest" \ | |
--text="What to do??" \ | |
--button="_Shutdown!system-shutdown:10" \ | |
--button="S_leep!gnome-session-suspend:11" \ | |
--button="_Restart!system-restart:12" \ | |
--button="_Hibernate!gnome-session-hibernate:13" | |
case "$?" in | |
10) | |
echo 'Shutdown' | |
systemctl poweroff | |
;; | |
11) | |
echo 'Sleep' | |
systemctl suspend | |
;; | |
12) | |
echo 'Restart' | |
systemctl reboot | |
;; | |
13) | |
echo 'Hibernate' | |
systemctl hibernate | |
;; | |
*) | |
echo 'Nothing...' | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Screenshot