Awesome WM adding a keybinding to the Super_L key blocks other key commands from working properly

266 views Asked by At

I'm trying to implement some Super-Tab functionality into awesome-wm so that it acts in a similar way to alt tab, going through tags in order of last used rather than just a set order.

However I've run into an issue, which is that binding something to only Super_L will cause other keybinds to not work as before.

For testing right now I just have it set to this

awful.key({}, "Super_L",  function () naughty.notify{text = "aaa"} end,  function () naughty.notify{text = "bbb"} end)

The issue is that if I have this set, then a key binding like Super-Shift-C (to close the current window) doesn't work, at least not if you press it in that order. It will work if you press it Shift-Super-C.

Is there a reason for this/a way to fix it?

Extra question: Why doesn't the key release function work, when I press Super_L with this awful.key setting you would expect it to show "aaa" when I press, and "bbb" when I release, but only "aaa" shows up.

I'm not super sure what to try, I've been messing around with the key configs and can't figure out what's going on.

Some of the Super key bindings still work, like Super-H to change the size of a window in tiling mode.

1

There are 1 answers

7
Emmanuel Lepage Vallee On

There's some way to make your code work, but more generally, this is not the best way to implement Super-Tab. The easier way is to use awful.keygrabber.

awful.keygrabber {
    keybindings = {
        awful.key {
            modifiers = {"Mod4"},
            key       = "Tab",
            on_press  = function () naughty.notify{text = "aaa"} end
        },
        awful.key {
            modifiers = {"Mod4", "Shift"},
            key       = "Tab",
            on_press  = function () naughty.notify{text = "ccc"} end
        },
    },
    stop_key           = "Super_L",
    stop_event         = "release",
    start_callback     = function () naughty.notify{text = "ddd"} end,
    stop_callback      = function () naughty.notify{text = "bbb"} end,
    export_keybindings = true,
}

This code (cop pasted from the doc link above) will create 2 keybindings (Super_L+Tab and Super_L+Shift+Tab). However, once one is executed, instead of just calling the callback, it will start to grab all keys. When Super_L is released, it will stop the keygrabber.