How to block only certain global hotkeys?

Aleksey Midenkov midenok at gmail.com
Fri May 15 09:54:40 BST 2015


On Wed, May 13, 2015 at 10:43 PM, Duncan <1i5t5.duncan at cox.net> wrote:
> Aleksey Midenkov posted on Wed, 13 May 2015 14:41:55 +0300 as excerpted:
>
>> 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
>
> FWIW...
>
> I too use xdotool among other utilities, in various scripted solutions
> when the functionality doesn't come built-in.  There's a utility called
> evrouter that can be used to route otherwise unrecognized keys to
> something xorg (and qt/kde) will recognize, that I use for keys that
> otherwise don't work on my keyboard, and another called sxhkd (simple X
> hotkey deamon), that I use together with the xf86-input-mtrack xorg input
> driver, to support gestures like pinch, rotate, and 2/3/4-finger swiping
> on my touchpad.  Mtrack translates the gestures into mouse-button events
> up to mouse-button-20, and sxhkd can recognize those events and convert
> them into appropriate key presses, etc, either globally or per app,
> sometimes using xdotool or the like as part of the chain.

I see that sxhkd is more sophisticated than xbindkeys. Though, it have
no official packaging yet. What are advantages over xbindkeys? The
only issue with xbindkeys I encountered is that it doesn't send fake
KeyRelease events for its hotkeys, so you have to do it manually in
order to send another keypress:

"xset r off; xdotool keyup --window 0 F4 key --window 0 alt+super+F4; xset r on"
    alt+F4

>
> So for instance I have pinch setup to activate kde's global zoom effect,
> for pinch-zoom, and three-finger-swipe-left/right setup to activate
> firefox's back and forward buttons.
>
> But not everyone is ready to do the manual setup necessary to get that
> sort of solution to work... the reason I didn't mention it in my original
> reply.
>
> So glad to see someone else willing to do the manual scripting and config
> it takes to get the results they want. =:^)
>
> --
> Duncan - List replies preferred.   No HTML msgs.
> "Every nonfree program has a lord, a master --
> and if you use the program, he is your master."  Richard Stallman
>
> ___________________________________________________
> 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.
___________________________________________________
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