Stop Chrome from Stealing Sway's Hotkeys

I read the manual, and I’m putting it here so I don’t forget. As mentioned in some previous posts, I like to run web-apps in chrome with the --app= flag, rather than use the electron version. For stuff like Discord this largely makes it act like the electron version- the website gets its own dedicated window, clicking links opens stuff in a different window, there’s no browser UI taking up space. The main differences are I don’t have to bother keeping an app updated, and I can apply custom CSS. Anyway, recently I’ve been trying out Wayland with Sway, and it seems that when you launch chrome with --app=, it inhibits your compositor’s keyboard shortcuts so it can have them all to itself.

I’m sure this behavior makes sense in certain usecases, but it doesn’t make sense here. Now I can’t switch workspaces, windows, or do anything else with sway. Thankfully, sway has a way to disable this. If you want to disable this for every application, you can throw this line into your config:

seat * shortcuts_inhibitor disable

That’s what I’m doing for now, since I want this to be the default behavior for all apps anyway. You may not want this though. It actually makes a lot of sense for a VNC viewer or a full screen video game or something like that to capture all your inputs, so you can use this config line instead if you only want this behavior in chrome:

for_window [app_id="^chrome-.*"] shortcuts_inhibitor disable

Or, you can do what I plan to do: leave this disabled globally but manually enable it for any apps you want to be able to inhibit shortcuts:

seat * shortcuts_inhibitor disable
for_window [app_id="whatever-app-patern"] shortcuts_inhibitor enable

Note that this won’t force the application to inhibit shortcuts, it just allows the application to request shortcut inhibition if it wants to.