dots-of-war/files/scripts/rofi-scripts/menu_powermenu.sh
2020-03-29 11:36:09 +02:00

43 lines
962 B
Bash

#!/bin/bash
## Author : Aditya Shakya (adi1090x)
## Mail : adi1090x@gmail.com
## Github : @adi1090x
## Reddit : @adi1090x
rofi_command="rofi -theme /home/leon/scripts/rofi-scripts/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