Created
July 5, 2015 21:44
-
-
Save blueyed/84a578b575ef07e9635c to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
# close stdin | |
exec <&- | |
# ACTION=$(zenity --title "Select logout action" --text "How to quit?" --height=250 --list \ | |
# --hide-header --hide-column=1 --column=action --column=desc \ | |
# suspend "Suspend" \ | |
# hybrid-sleep "Hybrid sleep" \ | |
# hibernate "Hibernate" \ | |
# reboot "Reboot" \ | |
# shutdown "Shutdown" \ | |
# switch-user "Switch user" \ | |
# logout "Logout" \ | |
# lock "Lock screen") | |
# ACTION=$(printf 'suspend\nhybrid-sleep\nhibernate\nreboot\nshutdown\nswitch-user\nlogout\nlock' \ | |
# | dmenu -p "How do you want to quit?") | |
ACTION=$(printf 'suspend|hybrid-sleep|hibernate|reboot|shutdown|switch-user|logout|lock|abort|' \ | |
| rofi -dmenu -sep '|' -p "How do you want to quit? " -only-match) | |
if [ -n "${ACTION}" ];then | |
case $ACTION in | |
switch-user) | |
# Lightdm: detect via XDG_SEAT_PATH | |
dm-tool switch-to-greeter | |
# for gdm: gdmflexiserver --startnew | |
;; | |
hybrid-sleep) systemctl hybrid-sleep ;; | |
suspend) | |
systemctl suspend | |
/usr/bin/slock | |
;; | |
hibernate) systemctl hibernate ;; | |
reboot) | |
zenity --question --text "Are you sure?" \ | |
&& systemctl reboot ;; | |
shutdown) | |
zenity --question --text "Are you sure?" \ | |
&& systemctl poweroff ;; | |
logout) | |
zenity --question --text "Are you sure?" \ | |
&& gnome-session-quit --logout --no-prompt ;; | |
lock) slock ;; | |
abort) ;; | |
esac | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment