2

I use Emacs on Linux systems.

Nowadays most programs don't use modifiers, except for a few Ctrl-something (e.g., Ctrl-B toggles bold characters practically everywhere), so developers of modern desktop environments thought possible to use every imaginable key-chord, especially those starting with Mod1 (usually the Alt key on PC keyboards and Meta in Emacs'parlance) to implement keyboard shortcuts to pratically everything.

How do you deal in general with desktop environments that keep stealing Emacs keybindings?


Addendum

I wonder if it is possible to tell Emacs to use, e.g., the Hyp key

   remove Lock = Caps_Lock
   remove Control = Control_L
   keysym Control_L = Hyper
   keysym Caps_Lock = Control_L
   add Mod5 = Hyper
   add Control = Control_L

in place of the traditional Alt.

PS Should you tell me mine is more a rant than a question, who am I to contradict you?

6
  • 4
    I doubt there's a general solution given the large number of different desktop environments and window managers between Microsoft, Apple, the Nixes, and whatever else. If the DE claims keybindings, they'll never reach Emacs, so your solution has to be outside Emacs. It'll probably just mean deselecting whatever keybindings the DE steals in whatever way the DE allows you to set keybindings. One simple way to do it is to select a lighter-weight DE (if you can) that doesn't take such a proprietorial stance on keybindings.
    – Dan
    Sep 22, 2021 at 15:24
  • 2
    What @Dan said: "your solution has to be outside Emacs". Just check your particular window manager / desktop environment for how to customize keys it steals, so it no longer steals them.
    – Drew
    Sep 22, 2021 at 15:28
  • Hi @Dan and @Drew, another interesting approach would be to make Emacs more customizable. For an example, replace common bindings like C-c and M-x, ... with pseudo events and then bind those pseudo events to the key events you want. If those pseudo events are bound to C-c and M-x by default a smooth transition would be possible. Old packages using C-c and M-x and new packages using the pseudo events would work like in previous versions of Emacs. Among other things, this would make adaptions to Windows key bindings easier.
    – Tobias
    Sep 22, 2021 at 18:00
  • Some Windows and Mac ports have a way to translate modifiers from the OS name to the Emacs name, e.g. ns-command-modifier on Mac. Unix builds don't have this because Emacs uses the Unix modifiers natively. Are you looking for something equivalent on Linux? The typical solution for an Emacs user would be not to use a desktop environment that is as inflexible as what you describe. Sep 22, 2021 at 19:44
  • 1
    @Tobias Remember that even without specific for extra modifiers you can access the modifiers via C-x @ sequences, so C-x @ h for hyper etc. This calls event-apply-hyper-modifier etc. (there are version for control, meta...) so the mechanism is already there. Sep 24, 2021 at 10:54

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.