Programmatically remove global keyboard shortcuts - linux

Is it possible to programmatically (gtk specific [or event xcb methods]) to list the global keyboard shortcuts collection?
I want to test if any of them are using the "Print Screen" key and if it is, I want to unset it.
On Ubuntu we see these shortcuts here:
Other flavors also have global keyboard shortcuts, for instance opensuse:

Related

Linux keyboard shortcut

Why on my Linux VS Code installation "Close window" shortcut is different: I want to use ctrl+w as I do on mac and as I do on any browser, but now I must do ctrl-f4
Customize a keyboard shortcut
On the menu bar, choose Tools > Options.
Expand Environment, and then choose Keyboard.
In the list, choose the command to which you want to assign a keyboard shortcut.
In the Use new shortcut in list, choose the feature area in which you want to use the shortcut.

Assign Keyboard shortcut per application in Linux Desktop Environment

I would like to inquire if there is a program in Linux that we can use to assign new keyboard shortcut per application. For example, if I'm in FeatherPad I would like to assign Super+S to save. If I'm in terminal, I would like to use Super+V to paste.
Or a program that cab map/assign new shortcut and translate that to an existing shortcut. If in terminal I can paste with Shift+Insert then I would like to map Super+V to Shift+Insert
The closest analogy would be a program like Autohotkey in Microsoft Windows. How do I do this in Linux Desktop environment regardless it is Gnome2/Unity/XFCE etc. ?
There used to be a way to do this called "custom accelerators" or "editable accelerators". It used to be supported in GNOME 2 and XFCE (maybe in others). But since the move to gtk3, this functionality seems to have been removed in GTK-based desktop environments.
In KDE/Plasma, you can use System Settings -> Shortcuts -> Global Shortcuts and then the plus symbol to add specific shortcuts that only apply to certain applications, but unfortunately, not all applications support it.
In FeatherPad itself, there should be Options -> Preferences -> Shortcuts, but I've had no luck getting it to register any shortcut consisting of just Super and a key.
I'm unfamiliar with Autohotkey but it seems that AutoKey is sometimes mentioned as an alternative on Linux?

Global hotkey in PyKDE4 or PyQT4

How do set a global (system wide) keyboard shortcut, i.e. a shortcut that can be activated when any windows are in focus?
I'm implementing a window switcher and need to bind a keystroke to some some function.
I can see that KGlobalAccel might be useful, but a concrete example would be great. I'm not worried about blatting any current systemwide global hotkeys.

Can I assign custom keyboard shortcuts for menu items in applications on Ubuntu?

OSX allows user to add custom keyboard shortcuts for menu items. For instance you can define a custom keyboard shortcut for "Copy" and it will work for every application that has a menu item called Copy.
Is there a way to do this for GTK and/or KDE applications?
For KDE applications, it is possible for common keyboard shortcuts. To do this, open systemsettings and navigate to Standard Keyboard Shortcuts.
For example, here I change the shortcut for "activate next tab" to Ctrl-Tab (for consistency with Firefox):
This changes the shortcut in most tabbed KDE applications as well as tabbed dialog boxes. You can specify up to 2 alternative shortcuts for each action.
However, this only works for common shortcuts; you can't globally specify shortcuts for arbitrary menu-item captions.
I don't think GNOME applications have any such feature. You have to change the shortcuts individually (for each application). (Generally KDE is more customizable.)
Is there a way to set an absolute keyboard shortcut for an arbitrary menu item name that will be honored by any GTK+ application?
No.
Can you set a different global shortcut for Cut/Copy/Paste?
I suspect so. I didn't do the reading, but here's two promising links: making keyboard shortcuts in linux as uniform as the mac and change default/preference keyboard shortcuts like copy & paste
You can of course modify GTK+ applications to tweak their shortcuts. In the case of a GTK+ application whose GUI was designed with Glade, e.g. virt-manager, this could be ridiculously trivial.
I suggest you to take a look at xbindkeys and xdotool. Those are the automation tools which can help you to simulate certain keystrokes with customized shortcut.
By this means, though you don't really modify the original shortcuts, but you can still make your desired key combinations functional.

Hooking softkeys on Windows?

My laptop has a mysterious "AV Now" button on it, which would usually launch Samsung's "AVStation Now" application. I don't have this application installed, so I'd like to get this button to do something else.
So (and this question can be generalised to any keyboard with softbuttons on it), how would I go about writing a Windows program (C++ or C#) to:
Figure out what pressing this button does. Is it a custom USB HID device, or is it just an obscure key combination?
Install a global hook for this button, so that I could get it to do something useful.
I'd like to get this button to do something else.
If you don't insist on writing the program yourself, you can remap keys: These extra buttons are mostly just obscure key combinations, and in WinXP and above it is possible to remap just about any button on the keyboard to any other by modifying a registry setting at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout
There exists a frontend utility to do this for you: check out SharpKeys. You select the key to remap from, key to remap to, write to registry and reboot. (Writing the keymap into the registry requires administrative privileges, as the keyboard mapping is global for all users.)

Resources