Score:0

Creating Keyboard Shortcuts for specific applications

bg flag

I am using Kubuntu 20.04 LTS.

I am also using Notepad++ installed through Wine.

Keys F3, F4, and F5 are custom global shortcuts on my system.

Is it possible for me to be able to create shortcuts just for Notepad++ application and use these keys for different commands on Kubuntu?

It means if F3 is assigned globally to zoom in, when Notepad++ Window is active, it will be assigned to undo, for example.

Thanks.

P.S.: If necessary, keyboard is Logitech Craft.

And no, I was not able to install Logitech Options through Wine.

Score:0
cn flag

As such, this is not possible. Global shortcuts are defined at the level of the desktop environment, and work independent of the currently focused application window, i.e., they work anytime. Other shortcuts are defined at the level of the application, and perform according to how the application defines them.

That said, as long as you are on the xorg display server, some automation tools are available that could more or less implement what you are after. That would, however, require some scripting. The script can then be assigned to a shortcut key:

  • Using wmctrl, the script could check the currently active window
  • Depending on the currently active window, the script would simulate different key presses, using xdotool to do something specific.

You would, however, need to redirect default assignments to other shortcut keys in your application, because you cannot anymore call the redefined key to perform its original function.

It is hackish, though. It is recommended to adapt, and consistently separate global keys from keys that you can define in an application.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.