Add logout window on power menu click

This commit is contained in:
2021-09-23 19:57:03 +03:00
parent 2551f11e29
commit b142c0fad8
2 changed files with 37 additions and 26 deletions

View File

@@ -1,15 +1,17 @@
[colors]
; This is colors for ayu theme (https://github.com/ayu-theme/ayu-colors)
primary = #ffa759
background = #202734
background-alt = #
background-alt = #191e2a
foreground = #cbccc6
[bar/main]
width = 100%
height = 40
height = 35
fixed-center = true
offset-y = 13
offset-x = 14
padding-right = 2
background = ${colors.background}
foreground = ${colors.foreground}
@@ -17,7 +19,6 @@ foreground = ${colors.foreground}
font-0 = FiraCode:size=11
font-1 = FontAwesome5Brands:size=11
font-2 = FontAwesome5FreeSolid:size=11
font-3 = FiraCode:size=12
modules-left = workspaces
modules-center = date
@@ -25,9 +26,6 @@ modules-right = keyboard-layout volume-control network power-menu
module-margin = 1
padding = 1
separator = |
;
; LEFT MODULES
@@ -37,10 +35,10 @@ separator = |
type = internal/i3
; Current active workspace
; %{T4} forces this label to use font-3
label-focused = "%{T4}%index%"
label-focused = "%index%"
label-focused-foreground = ${colors.primary}
label-focused-padding = 1
label-focused-background = ${colors.background-alt}
label-focused-padding = 2
; All the other workspaces but the active
label-unfocused = ${self.label-focused}
@@ -62,6 +60,7 @@ label-maxlen = 40
; CENTER MODULES
;
[module/date]
type = internal/date
@@ -80,6 +79,10 @@ type = internal/xkeyboard
format = <label-layout>
label-layout = %layout%
layout-icon-default = some icon
layout-icon-0 = us;🇺🇸
layout-icon-1 = ru;🇷🇺
[module/volume-control]
type = internal/pulseaudio
@@ -102,23 +105,9 @@ label-connected = 
label-disconnected = No Network
[module/power-menu]
type = custom/menu
type = custom/text
expand-right = false
label-open =
label-close =
label-separator = " "
menu-0-0 = Log Out
menu-0-0-exec = i3-msg exit
menu-0-0-foreground = ${colors.primary}
menu-0-1 = Reboot
menu-0-1-exec = systemctl reboot
menu-0-2 = Power Off
menu-0-2-exec = systemctl poweroff
menu-0-2-foreground = ${colors.primary}
content = %{A:~/dotfiles/polybar/logout-window.sh:}%{A}
[settings]
screenchange-reload = true

22
polybar/logout-window.sh Executable file
View File

@@ -0,0 +1,22 @@
#! /bin/bash
action=$(yad --width 300 --entry --title "System Logout" \
--button="Ok" --button="Cancel" \
--text "What to do?" \
--entry-text \
"Power Off" "Reboot" "Logout" \
)
return=$?
if [[ $return -eq 1 ]] ; then
exit 0
fi
case $action in
Power*) cmd="systemctl poweroff" ;;
Reboot*) cmd="systemctl reboot" ;;
Logout*) cmd="i3-msg exit"
esac
eval exec $cmd