How to disable the key shortcut in a program if the program inside not support to do it?


use evremap to map alt - a to another key combine like alt - home
so when you press alt - a actually it press alt - home . wechat will not be triggered.
Then in the neovim for example remap alt - home to replace alt -a

My config file pretty simple.

input = ["KEY_LEFTALT", "KEY_A"]
# When our `input` is matched, our list of `output` is prevented from
# matching as the `input` of subsequent rules.
output = ["KEY_LEFTALT", "KEY_HOME"]

I use a program wechat.
Which has a global shortcut (alt-a) cant be disable inside the program.
It is a gray button. image

This shortcut I use a lot in the vscode and neovim.
I have to these things:

  1. Try download the source code. But the source code is not release.
  2. use xmodmap it wont work on combine key
  3. use xbindkeys which is conflict with other program cant suppress other programs shortcut.

So is there a way to make this?
Disable a shortcut of specific program?

Basic info

OS: Manjaro Linux x86_64
Kernel: Linux 6.6.34-1-MANJARO
Uptime: 9 hours, 27 mins
Packages: 1756 (pacman)[stable]
Shell: fish 3.7.1
Display (U32R59x): 3840x2160 @ 60Hz *
Display (U32R59x): 3840x2160 @ 60Hz
DE: KDE Plasma 6.0.5
WM: i3 (X11)

If it is an application-specific keyboard shortcut, then wechat would (and should) not be processing the shortcut when the program is not in focus. So this means that your other applications — e.g. neovim — should be able to interpret the shortcut themselves.

If this is not the case, then the shortcut is being interpreted by the desktop environment or window manager. With the disclaimer that I’m not familiar with i3, you could try reassigning the shortcut via Plasma’s System Settings or via whatever way that one configures key bindings in i3. The downside of this is that neovim et al would not be seeing the shortcut anymore either.


If a shortcut is already defined there, you could try deleting it, in which case it may, or may not, be recreated by wechat.

If that doesn’t work you may be able to remap the combo to something else, for instance so that Alt + A gives you Alt + End. Then you can rebind the shortcut in vscode and neovim to Alt + End.

Obviously the Alt + A shortcut in wechat wouldn’t work any more, but you could potentially make it work using the same trick with another combo.

You might be able to do this using an input remapper…you can definitely do it by editing the config yourself (at least with the gb layout). I can provide an example of the latter if you wish, but it would help to know what layout you’re using.

I’m not sure if wechat could grab the input at a lower level or not, but if it does then it’s shortcut may still be triggered.

Having said that, it might be better if you just changed the shortcut in vscode and neovim. I know it’s a pain to get used to a new shortcut, but it means you don’t have to remember that you remapped the combo, everything works as expected.


Thanks evremap will do the job

1 Like

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.