You are not logged in.

#1 2023-03-16 10:15:37

Satorin
Member
Registered: 2022-01-19
Posts: 11

Recreating i3 mode + polybar in bspwm + sxhkd + polybar

Here's an example of what I have in i3:

set $mode_system System (l) lock, (e) logout, (s) suspend, (r) reboot, (o) shutdown
mode "$mode_system" {
    bindsym l exec --no-startup-id dm-tool switch-to-greeter, mode "default"
    bindsym l exec --no-startup-id i3-msg exit, mode "default"   
    bindsym l exec --no-startup-id systemctl suspend; exec --no-startup-id dm-tool switch-to-greeter, mode "default"
    bindsym l exec --no-startup-id systemctl reboot, mode "default"
    bindsym l exec --no-startup-id systemctl poweroff -i, mode "default"
}
bindsym $mod+Escape mode "$mode_system"

Basically a nice little mode to change the state of my system. polybar adds a bit more flare with being able to show the $mode_system text.

Now I'm not sure if bspwm or sxhkd have this functionality, but I'd love to recreate this there.

In polybar I create a module:

[module/sxhkd]
type = custom/ipc
hook-0 = echo ""
hook-1 = echo "System (l) lock, (e) logout, (s) suspend, (r) reboot, (o) shutdown"

and in sxhkdrc I have the hotkey

~Escape
    polybar-msg action "#sxhkd.hook.0"
super + Escape : {l, e, s, r, o}
    polybar-msg action "#sxhkd.hook.1"

The problem arises that I want to run polybar-msg action "#sxhkd.hook.1" on the press of super + Escape and then the corresponding chord which will run the desired command. However as it stands right now, polybar-msg action "#sxhkd.hook.1" only runs after I press l, e, s, r or o. Which is not the desired outcome in this case. Is there a better way to go about this? I'd appreciate some help.

Offline

Board footer

Powered by FluxBB