aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/powerdialog
blob: 52e3330ab93d1de172c80d101acfcace0d6997cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh -eu

ACTION=$(yad --width=90 \
  --height=210 --list --radiolist --text="Select Action" \
  --title="Logout" --column "Choice" --column "Action" \
  FALSE Shutdown FALSE Reboot TRUE Suspend FALSE Lock FALSE Blank)

if [ -n "${ACTION}" ]; then
  case $ACTION in
    'TRUE|Shutdown|') yad --question --text "Are you sure you want to halt?"   && sudo -A 'systemctl poweroff' ;;
    'TRUE|Reboot|')   yad --question --text "Are you sure you want to reboot?" && sudo -A 'systemctl reboot'   ;;
    'TRUE|Suspend|')  systemctl suspend ;;
    'TRUE|Lock|')     i3lock-fancy ;;
    'TRUE|Blank|')    sleep 1; xset dpms force off ;;
  esac
fi