summaryrefslogtreecommitdiff
path: root/power_menu.sh
blob: 6194e29868415577c9809146bc4b1f019f9cd6b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh
tmpf=$(mktemp)
printf "monitor-suspend.sh\n" >> $tmpf
case $XDG_SESSION_TYPE in
  "wayland")
    printf "swaymsg reload\n" >> $tmpf
    #printf "kill -s USR1 %s\n" >> $tmpf
    printf "swaylock -e -F -c 000000 --indicator-idle-visible\n" >> $tmpf
    printf "swaymsg exit # Quit sway\n" >> $tmpf
    ;;
  "x11")
    printf "bspc wm -r\n" >> $tmpf
    printf "slock /usr/bin/xset dpms force suspend\n" >> $tmpf
    printf "slock\n" >> $tmpf
    printf "slock /usr/bin/systemctl suspend -i # lock, suspend\n" >> $tmpf
    printf "i3-msg exit # Quit i3\n" >> $tmpf
    ;;
esac
printf "doas /usr/bin/reboot\n" >> $tmpf
printf "systemctl suspend\n" >> $tmpf
#printf "systemctl poweroff -i\n" >> $tmpf
printf "doas /usr/bin/poweroff\n" >> $tmpf
choice="$(cat $tmpf|$PICKER -I0 -p 'Power ops:')"
echo "$choice"
rm $tmpf
notify-send "$(sh -c "$choice 2>&1")"