How to block only certain global hotkeys?

Aleksey Midenkov midenok at gmail.com
Wed May 13 12:41:55 BST 2015


On Tue, May 12, 2015 at 5:22 PM, Duncan <1i5t5.duncan at cox.net> wrote:
> Aleksey Midenkov posted on Tue, 12 May 2015 13:33:50 +0300 as excerpted:
>
>> I know that there is an option in Special Application Options: Ignore
>> global shortcuts. But it blocks all of them. I want several hotkeys
>> retain their global meaning and several of them passed to certain
>> applications. Is it possible maybe via config files?
>
> I don't believe there's a per-app option to ignore specific global
> hotkeys, without ignoring others, no.
>
> What you /can/ do, however, is reassign different global hotkeys, so they
> don't interfere with individual app hotkeys.  In general, the winkey
> (super or hyper, try it with one reassignment and see) modified actions
> are not taken by apps, so remain free for use as global hotkeys.

Thanks for the alternative, though I was aware of it. The reason why I
was not satisfied with it is that Alt + F4 is too basic combination. I
don't want it to reassign to something else (like Win + F4). Though I
want this combination to work differently under Konsole (select window
4 inside GNU Screen). Of course it is possible to reassign Screen
combination to something like Ctrl + F4 or Win + F4, but I want to
hold them for something else. Fortunately, I found the solution that
perfectly fits to my needs: xbindkeys + xdotool. If to add this to
~/.xbindkeysrc:

"xdotool getactivewindow key alt+F4"
    XF86Launch7

it sends Alt + F4 combination to active Konsole window when I press G4
on G710+ keyboard, though original Alt + F4 combination still works as
global KWin combination.

It is possible to overwrite even original Alt + F4 with xbindkeys as a
proxy. For this it is required to set KWin hotkey to something else
(f.ex. Alt + Win + F4). And then make the logic based on active window
class:

if xprop -id $(xdotool getactivewindow) -notype WM_CLASS | grep -q '"Konsole"'
then
    xdotool getactivewindow key alt+F4
else
    xdotool key --window 0 alt+super+F4
fi
___________________________________________________
This message is from the kde mailing list.
Account management:  https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.


More information about the kde mailing list