Disable Ubuntu shortcuts

Started by
7 comments, last by mind in a box 7 years, 8 months ago

On Ubuntu when capturing keyboard input with GLFW some keys like LEFT ALT are not passed to my window. Instead some desktop functionality is triggered like the dashboard search in case of the alt key.

How do I run a windowed game on Ubuntu, using all keys available on the keyboard, without telling the user how to turn off Ubuntu keyboard shortcuts all together at game start?

Advertisement

You probably can't without messing up the desktop. Window manager shortcuts are global, so if you change them, it changes for the entire desktop.

Another thing to consider is that there are other keyboard layouts too (not everybody uses a USA keyboard), and not all keyboards provide the same set of keys. Maybe a keyboard doesn't even have LEFT ALT.

I believe in a system that is inherently multi-tasking, it is extremely bad behavior to assume you are the only program in the world, or to assume you can decide for the user how he should use the computer. I am very allergic to programs that take away my controls. If a program does not work cooperatively with other programs (cannot run in windowed mode, locks the mouse cursor in the application, or changes things I am used to have (like global key shortcuts etc)), that program dies a very ugly death really fast.

Some of that allergy is born out of experience, programs locking me in and then crashing, leaving the keyboard in an unusable state, with a system where I have a dozen other applications running that I want to close down nicely. I haved used multiple desktops for the last 20 years, I never run one application exclusively.

If you're running the Unity 7 shell (sounds like you are), the alt and super keys are grabbed by the gnome-settings-daemon and forearded as necessary when it turns out they're not needed. If you want to customize your session, you can always modify the upstart files to not start your session daemon. You will lose a lot of desktop functionality that way, though, so be prepared.

Once the keys are sent on by GSD, they get mapped by Compiz. You can change the default mappings in Compiz using compizconfig-settings-manager (aka CCSM). You'd want to go through each of the plugins and remap the keys used for each.

You could also try grabbing the keys yourself through the X11 protocol. Other programs do it (for example, Factorio works fine on my desktop and uses the left-alt key successfully). You're build to end up in a shady place if you handle grabs incorrectly -- eg. on VT switching or program crash.

Stephen M. Webb
Professional Free Software Developer

I believe in a system that is inherently multi-tasking, it is extremely bad behavior to assume you are the only program in the world, or to assume you can decide for the user how he should use the computer. I am very allergic to programs that take away my controls. If a program does not work cooperatively with other programs (cannot run in windowed mode, locks the mouse cursor in the application, or changes things I am used to have (like global key shortcuts etc)), that program dies a very ugly death really fast.

Still, the concept of keyboard focus is not a new one, right? It seems strange to prevent an application from responding to arbitrary parts of an input device.

It seems strange to prevent an application from responding to arbitrary parts of an input device.
By setting a global shortcut, I explicitly define that I want to dedicate that key-combination for that particular function. What makes an application believe it can ignore my choice? How do I reach that particular function if it overrides the one connection I have?

I use "ctrl+arrow_left/right" exclusively to switch back and forth between desktops. It's a function I use a lot, so it must be something simple. Now if an editor decided that it knows better, and those keys must be used for word left/right no matter what I decided, that application breaks my ability to switch between desktops.

It's like an application deciding that the key "e" will now produce an "a". Good luck in typing an "e" now.

It seems strange to prevent an application from responding to arbitrary parts of an input device.

By setting a global shortcut, I explicitly define that I want to dedicate that key-combination for that particular function. What makes an application believe it can ignore my choice? How do I reach that particular function if it overrides the one connection I have?


From what I understand one of the key issues here is not that this is not about me setting but an obnoxious preconfiguration. If this was something you had to explicitly opt in for this whole discussion would be moot, but it is instead something the average user will encounter, not even understanding why the game does not work as intended.

Setting that aside, it is very much not uncommon for games to knowingly circumvent some platform behaviors. That is always a thin line to walk but considering games are typically used very differently from normal desktop applications this can be justified.

By setting a global shortcut, I explicitly define that I want to dedicate that key-combination for that particular function.

That's a fair point. However the original poster seemed to be saying that the OS had set these shortcuts automatically, which does sound a bit unfriendly.

From what I understand one of the key issues here is not that this is not about me setting but an obnoxious preconfiguration.
Obnoxious relative to what?

If you look from Ubuntu desktop perspective, it's not obnoxious, it's desired. When your OS doesn't happen to use the key, that does not imply nobody is allowed to use it.

Setting that aside, it is very much not uncommon for games to knowingly circumvent some platform behaviors.
I think we deeply disagree here. To me, if you run in a desktop environment, you play by the rules of that desktop environment.

That's a fair point. However the original poster seemed to be saying that the OS had set these shortcuts automatically, which does sound a bit unfriendly.
Not really, I see it as an initial setup of the desktop environment when you use it for the first time. It's like Windows setting up the alt-tab, the three finger salute, and the various win-keys for you. In Linux, it's normal that you can change all keyboard shortcuts if you like. The initial setup just saves some time.

The latter of course means you cannot assume anything on functionality attached to keys, in the general sense.

Thanks for the input, guys!

We figured it would probably be the best solution to leave everything as it is right now. Most Linux-users will know how to change the bindings if they don't use them or just change the ingame binding of the action on the alt-key.

This topic is closed to new replies.

Advertisement