mirror of
https://github.com/Fluffy-Bean/dots.git
synced 2025-01-16 11:15:18 +00:00
37 lines
708 B
Bash
Executable file
37 lines
708 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
## Author : Aditya Shakya
|
|
## Mail : adi1090x@gmail.com
|
|
## Github : @adi1090x
|
|
## Twitter : @adi1090x
|
|
|
|
uptime=$(uptime -p | sed -e 's/up //g')
|
|
rofi_command="rofi -theme ~/.config/rofi/power.rasi"
|
|
|
|
# Options
|
|
shutdown="Shutdown"
|
|
reboot="Restart"
|
|
suspend="Sleep"
|
|
settings="Settings"
|
|
|
|
# Variable passed to rofi
|
|
options="$reboot\n$shutdown\n$settings"
|
|
|
|
chosen="$(echo -e "$options" | $rofi_command -p "Uptime: $uptime" -dmenu -selected-row 0)"
|
|
case $chosen in
|
|
$shutdown)
|
|
systemctl poweroff
|
|
;;
|
|
$reboot)
|
|
systemctl reboot
|
|
;;
|
|
$suspend)
|
|
mpc -q pause
|
|
amixer set Master mute
|
|
systemctl suspend
|
|
;;
|
|
$settings)
|
|
gnome-control-center
|
|
;;
|
|
esac
|