baskerville / sxhkd

Simple X hotkey daemon
BSD 2-Clause "Simplified" License
2.78k stars 139 forks source link

possibility to ungrab active keybind? #149

Open SeerLite opened 5 years ago

SeerLite commented 5 years ago

TLDR at bottom. This is just some context: So i have this in my config:

Super_L + any
    xdo raise -N "Bar"
~@Super_L + any
    xdo lower -N "Bar"

This makes me able to raise and lower lemonbar when holding down Super_L. It works flawlessly, and other keybinds that use super work how they should (although I'm not sure if the ~ is necessary on the release binding). My problem arises when I use this:

# rofi is a configurable dmenu-like launcher. this is an example
super + i
    rofi -show drun

I have rofi configured to use Super_L + j and Super_L + k to cycle between entries, so I could do something like super + i, super + j to open the menu and cycle through entries smoothly, without releasing the super key. This no longer works when using my first keybind, since Super_L is still grabbed by sxhkd and won't be ungrabbed until released.

So, is there a way to force sxhkd to ungrab the key even when it's pressed? By sending a kill signal or something alike? (I've already tried pkill -USR2 -x sxhkd and, although other keybinds are deactivated, super is still grabbed until it's released)

TLDR: Is there a way to force sxhkd to ungrab a keybind (Super_L) that's currently in action/activated, allowing other programs to grab it?

int-72h commented 4 years ago

USR2 should ungrab it, according to this code:

{
    if (sig == SIGHUP || sig == SIGINT || sig == SIGTERM)
        running = false;
    else if (sig == SIGUSR1)
        reload = true;
    else if (sig == SIGUSR2)
        toggle_grab = true;  /* toggles grab */
    else if (sig == SIGALRM)
        bell = true;
}

This appears to be a bug, try using a different key than Super and see if it works.

SeerLite commented 4 years ago

Hey, thanks for the idea! I changed super with Alt, both in sxhkd config and in rofi config, and it seems to work correctly without having to use USR2: as soon as rofi appears on screen, sxhkd has already ungrabbed Alt. So it looks like the grabbing of super is broken, specifically?