#!/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