-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrofi_power_menu.sh
More file actions
executable file
·39 lines (34 loc) · 906 Bytes
/
rofi_power_menu.sh
File metadata and controls
executable file
·39 lines (34 loc) · 906 Bytes
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
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
# bdelphin's rofi-power fork
# Use rofi to call systemctl for shutdown, reboot, etc
# This script was forked from Oliver Kraitschy's rofi-power - http://okraits.de
OPTIONS="Reboot system\nPower-off system\nSuspend system\nHibernate system\nLock system\nExit window manager"
LAUNCHER="rofi -theme custom -dmenu -i -p rofi-power:"
USE_LOCKER="true"
LOCKER="$HOME/scripts/lockscript/lock -n"
option=`echo -e $OPTIONS | $LAUNCHER | awk '{print $1}' | tr -d '\r\n'`
if [ ${#option} -gt 0 ]
then
case $option in
Exit)
i3-msg exit
;;
Reboot)
systemctl reboot
;;
Power-off)
systemctl poweroff
;;
Suspend)
$($USE_LOCKER) && "$LOCKER"; systemctl suspend
;;
Hibernate)
$($USE_LOCKER) && "$LOCKER"; systemctl hibernate
;;
Lock)
$LOCKER
;;
*)
;;
esac
fi