Send IPC modifier event on bar_modifier up/down

Detects when a bar modifier key is pressed/released and sends a modifier
IPC event to any listeners (usually swaybars).

This way a swaybar can listen on the modifier event and hide/show the
bar accordingly (not implemented yet)

The modifier event looks like this:

    {
      "change": "pressed", // or released
      "modifier": "Mod4"
    }
This commit is contained in:
Mikkel Oscar Lyderik 2016-01-05 02:20:20 +01:00
parent 7727c9efbc
commit c20c63b677
5 changed files with 57 additions and 8 deletions

View file

@ -1897,7 +1897,7 @@ static struct cmd_results *bar_cmd_modifier(int argc, char **argv) {
bool is_mod = false;
for (j = 0; j < (int)(sizeof(modifiers) / sizeof(struct modifier_key)); ++j) {
if (strcasecmp(modifiers[j].name, split->items[i]) == 0) {
mod |= modifiers[j].mod;
mod = modifiers[j].mod;
is_mod = true;
break;
}