Gamepad button as mod key for Sway?

I would like to use the Sway window manager in my uConsole but it relies heavily on the “mod” key, which is the “Super” key by default so Fn + AltL on the uConsole. That’s too cumbersome to use effectively.

I was wondering if there is a way to use one of the gamepad buttons (A for example) for this since I’m not using those for anything right now. But I’m stuck trying to configure that since they aren’t really keyboard keys.

Any ideas?

1 Like

User Funcron asked basically the same question 18 or so days ago.
I would probably use the game keys for something besides gaming myself.

1 Like

I’d like to be able to map two of the buttons on the gamepad to page up and page down.

2 Likes

relies heavily on the “mod” key, which is the “Super” key by default so Fn + AltL on the uConsole

I do not know how easy it is to remap things under Wayland, but on the uConsole, I use the volume button for the window manager’s meta key. (escape XF86AudioLowerVolume in ratpoison. I use ratpoison on the DevTerm, too, but I use the Cmd key, which is Super_R. I have the volume up/down buttons mapped to screen brightness, and Fn+< and Fn+> cycle through windows.) One thing you might try is remapping the right Ctrl/Alt keys, depending on whether you need both pairs.

I was wondering if there is a way to use one of the gamepad buttons

There are some dip switches on the back of the keyboard that can be used to send normal keypresses instead of gamepad keypresses, but they’re mapped to letter keys. (I seem to recall the dip switches are actually on the board, but it’s a bit more involved to disassemble than the DevTerm is.)

You could try getting the Arduino devkit to work (if anyone knows a way to rebuild the firmware for the keyboard without going through Arduino’s IDE, please let me know) and that’d enable you to just tweak the appropriate bits in the firmware and reflash. Remapping a single key is not difficult. Have a look at uConsole/Code/uconsole_keyboard at master · clockworkpi/uConsole · GitHub . The bit that handles the presses for the A button is here: uConsole/Code/uconsole_keyboard/keymaps.ino at master · clockworkpi/uConsole · GitHub . It looks like it’s mapped to “j” when the switch is toggled, so if you wanted it to send the same keycode as Cmd/Fn+Alt does, then, per line 670, it looks like you want to use _CMD_KEY.

3 Likes

Getting gamepad buttons to work as keyboard presses in Wayland is kind of a pain, so I just use Alt as the mod key.

I could probably swap Alt and Super to prevent conflicts but I haven’t had any issues so far.

I relied on this post to get sway working with the uConsole mod keys

The ‘sticky’ mode in particular is necessary to avoid other Fn keys.
Unfortunately, I’ve been unable to find any mapping for the gamepad buttons.
wev doesn’t even register them.

1 Like