diff --git a/home/config/bspwm/bspwmrc b/home/config/bspwm/bspwmrc new file mode 100644 index 0000000..e69de29 diff --git a/home/config/bspwm/scripts/confirm.sh b/home/config/bspwm/scripts/confirm.sh new file mode 100644 index 0000000..b68bc4f --- /dev/null +++ b/home/config/bspwm/scripts/confirm.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +yes='' +no='' + +echo -e "$yes\n$no" | rofi -dmenu -p 'Are you Sure?' -theme confirm \ No newline at end of file diff --git a/home/config/bspwm/scripts/powermenu.sh b/home/config/bspwm/scripts/powermenu.sh new file mode 100644 index 0000000..197078f --- /dev/null +++ b/home/config/bspwm/scripts/powermenu.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +prompt="Are you sure?" +mesg="Uptime : `uptime -p | sed -e 's/up //g'`" + +option_1="" +option_2="" +option_3="" +option_4="" +option_5="" + +yes='' +no='' + + +rofi_powermenu() { + echo -e "$option_1\n$option_2\n$option_3\n$option_4\n$option_5" | rofi -dmenu -p "$prompt" -mesg "$mesg" -markup-rows -theme powermenu +} + + +confirm_run () { + selected="$(~/.config/bspwm/scripts/confirm.sh)" + + if [[ "$selected" == "$yes" ]]; then + ${1} + else + echo $selected, $1 + exit + fi +} + + +chosen="$(rofi_powermenu)" + +case ${chosen} in + $option_1) + xflock4 --lock + ;; + $option_2) + confirm_run 'bspc quit' + ;; + $option_3) + confirm_run 'systemctl hibernate' + ;; + $option_4) + confirm_run 'systemctl reboot' + ;; + $option_5) + confirm_run 'ssytemctl poweroff' + ;; +esac \ No newline at end of file diff --git a/home/config/polybar/config.ini b/home/config/polybar/config.ini index a2d69c1..ae3b591 100644 --- a/home/config/polybar/config.ini +++ b/home/config/polybar/config.ini @@ -40,7 +40,7 @@ fixed-center = true modules-left = logo workspace pipe-db mpd modules-center = date -modules-right = netspeed volume pipe hibernate pipe logout +modules-right = netspeed volume pipe power tray-position = right diff --git a/home/config/polybar/modules/power.ini b/home/config/polybar/modules/power.ini index 2a1c595..65a2092 100644 --- a/home/config/polybar/modules/power.ini +++ b/home/config/polybar/modules/power.ini @@ -1,14 +1,9 @@ -[module/hibernate] + +[module/power] type = custom/text -;click-left = lxsession-logout -p "" -content = %{T9}%{T-} -content-foreground = ${color.yellow} - -[module/logout] -type = custom/text - -;click-left = lxsession-logout -p "" content = %{T9}襤%{T-} content-foreground = ${color.red} -content-padding = 2 \ No newline at end of file +content-padding = 2 + +click-left = ~/.config/bspwm/scripts/powermenu.sh \ No newline at end of file