-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrofi-powermenu
executable file
Β·79 lines (67 loc) Β· 1.77 KB
/
rofi-powermenu
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env bash
. $HOME/.cache/wpgtk.color
config=$XDG_CONFIG_HOME/rofi/script-configs/rofi-powermenu.sh
title_font="Z003"
subtitle_font="Fantasque Sans Mono"
icon_font="Hack Nerd Font"
exit_sound=$XDG_DATA_HOME/sounds/ε ΄ι’θ»’ζγ΅γ¦γ³γγγ΄_002.m4a
if [ -f "$config" ]; then
. $config
fi
_rofi() {
rofi -sep '|' -columns 6 -lines 1 -disable-history true -cycle true \
-theme rofi-simplemenu.rasi -width 80 -height 200 \
-dmenu -font "${icon_font} 40" "$@"
}
play() {
ffplay -nodisp -loglevel quiet -vn -t 6.5 -autoexit $1
}
asTitle() {
echo -n "<span face='${title_font}' font='40'>$@</span>"
}
asSubtitle() {
echo -n "<span face='${subtitle_font}' font='16'>$@</span>"
}
mesg() {
echo -n "$(asTitle "Power controls")
$(asSubtitle "
<span background='$color3' foreground='$color0' weight='bold'> hostname </span> $(hostname)
<span background='$color3' foreground='$color0' weight='bold'> uptime </span> $curUptime")"
}
curUptime=$(uptime -p | sed 's/up //g')
choice=$(echo -n "ο£|ο|ο|ο|ο‘|ο" | _rofi -mesg "$(mesg)")
case "$choice" in
ο£)
slock
;;
ο)
slock &
~/.bin/displaysleep
;;
ο)
systemctl suspend
;;
ο)
choice=$(echo -n "No|Yes" | _rofi -mesg "$(asTitle 'Logging out. Are you sure?')")
if [ "$choice" = "Yes" ]; then
cleandesktop.sh
play $exit_sound
bspc quit
fi
;;
ο‘)
choice=$(echo -n "No|Yes" | _rofi -mesg "$(asTitle 'Rebooting. Are you sure?')")
if [ "$choice" = "Yes" ]; then
cleandesktop.sh
systemctl reboot
fi
;;
ο)
choice=$(echo -n "No|Yes" | _rofi -mesg "$(asTitle 'Powering off. Are you sure?')")
if [ "$choice" = "Yes" ]; then
cleandesktop.sh
play $exit_sound
systemctl poweroff
fi
;;
esac