0

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.

shafee
  • 15,566
  • 3
  • 19
  • 47

1 Answers1

0

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.

  • Thanks for the code, I tried adding it to my rc.lua but I am getting an error "/usr/share/awesome/lib/awfulkeygrabber.lua:821: attempt to concatenate a nil value I just added it inside my globalkeys = gears.table.join( section, not sure if that is the right place to add it – Harris The third Dec 29 '22 at 22:10
  • add it at the bottom of rc.lua, not in the key section – Emmanuel Lepage Vallee Dec 29 '22 at 23:30
  • I added it right at the end but I'm still getting the error. I can't copy it into text as when you click it disappears in awesome but here is a screenshot of it: https://imgur.com/a/UzdHTNa – Harris The third Dec 30 '22 at 16:40
  • I can confirm the code above works with the git-master version of AwesomeWM. I didn't try with v4.3. Also, you seem to have 2 different problems in your error log. – Emmanuel Lepage Vallee Dec 31 '22 at 04:33
  • I can't get the git version to work because of the issue described here: https://awesomewm.org/download/ under the "Building from source" section. Is the syntax required for the keygrabber different between versions? (The second error I think was just from something else) – Harris The third Dec 31 '22 at 11:56
  • The API is the same as far as I remember, but a few bugs were solved. Also, if you are on Arch, Gentoo or a few other, they provide packages for git-master. For Ubuntu/Debian, you can run `make packages` to generate them. – Emmanuel Lepage Vallee Jan 01 '23 at 05:06
  • I got it to stop giving me an error on the git version, using `make packages` worked thanks. The keygrabber bit appears to be working now (the "aaa" "bbb" popups are appearing), however it has stopped most other `super-X` keybindings working. For example Super-E to open file manager or Super-Ctrl-R to reload awesome no longer work. – Harris The third Jan 02 '23 at 00:31