Gaming on Linux (Wayland/Sway) has worked relatively well for years now (aside from anti-cheat issues). I run all my games under gamescope to avoid X11 glitches and ensure rendering at native resolution. But I did have two issues that I kept running into:
- Accidentally pressing system keybindings. I’d often press MOD+D by accident, which is my keybinding for my task launcher.
- Unable to set push to mute in Discord1. When you push to talk in game, you want Discord to mute your input so you don’t double send.
I’ve solved both of these problems with gamescope-mode-manager. This program listens for i32 IPC events and watches for specific app IDs to become focused. A Sway IPC call is then made to activate my custom gamescope mode which:
- Limits the number of bound symbols to avoid accidental presses.
- Configures SHIFT+F12 to toggle mangohud visibility via
mangohudctl toggle no_display
. - Mutes Chromium input when
t
or mouse side button (button8
) is pressed. I run Discord in Chromium.
In order to accomplish the last step, I needed to add a --passthrough
argument to the bindsym
directive of Sway. This small patch allows you to both run a command AND send the input to the application.