45 lines
943 B
Bash
45 lines
943 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
## Author : Aditya Shakya (adi1090x)
|
||
|
## Mail : adi1090x@gmail.com
|
||
|
## Github : @adi1090x
|
||
|
## Reddit : @adi1090x
|
||
|
|
||
|
rofi_command="rofi -theme themes/menu/powermenu.rasi"
|
||
|
uptime=$(uptime -p | sed -e 's/up //g')
|
||
|
#mem=$( free -h | grep -i mem | awk -F ' ' '{print $3}')
|
||
|
cpu=$(sh ~/.config/rofi/bin/usedcpu)
|
||
|
memory=$(sh ~/.config/rofi/bin/usedram)
|
||
|
|
||
|
# Options
|
||
|
shutdown="襤"
|
||
|
reboot="ﰇ"
|
||
|
lock=""
|
||
|
suspend="鈴"
|
||
|
logout=""
|
||
|
|
||
|
# Variable passed to rofi
|
||
|
options="$shutdown\n$reboot\n$lock\n$suspend\n$logout"
|
||
|
|
||
|
chosen="$(echo -e "$options" | $rofi_command -p "祥 $uptime $cpu $memory " -dmenu -selected-row 2)"
|
||
|
case $chosen in
|
||
|
$shutdown)
|
||
|
systemctl poweroff
|
||
|
;;
|
||
|
$reboot)
|
||
|
systemctl reboot
|
||
|
;;
|
||
|
$lock)
|
||
|
i3lock
|
||
|
;;
|
||
|
$suspend)
|
||
|
mpc -q pause
|
||
|
amixer set Master mute
|
||
|
systemctl suspend
|
||
|
;;
|
||
|
$logout)
|
||
|
openbox --exit
|
||
|
;;
|
||
|
esac
|
||
|
|