You are not logged in.

#1 2020-05-01 22:18:55

FaeFeyFa
Member
Registered: 2019-08-08
Posts: 20

[SOLVED] Xbindkeys not detecting PrintScreen

Hi!
I want to set xbindkeys to take a screenshot whenever I hit Print Screen.
However, xbindkeys doesn't seem to play well with the Print Screen Key.

xbindkeys -k does detect the key:

$ xbindkeys -k
Press combination of keys or/and click under the window.
You can use one of the two lines after "NoCommand"
in $HOME/.xbindkeysrc to bind a key.
"(Scheme function)"
    m:0x0 + c:218
    Print

But whenever I run xbindkeys with xbindkeys -v nothing happens when I hit the actual key.

I have my .xbindkeysrc working with a bunch of other keys at the moment, one of which is muting the sound, but if I do the same with the Print Screen key nothing happens.
Relevant section of .xbindkeysrc:

"amixer set Master toggle"
        Print

(Here's one of the working keys.)

"amixer set Master toggle"
        XF86AudioMute

Last edited by FaeFeyFa (2020-05-02 20:13:48)

Offline

#2 2020-05-01 22:31:21

FaeFeyFa
Member
Registered: 2019-08-08
Posts: 20

Re: [SOLVED] Xbindkeys not detecting PrintScreen

(I'm trying to use Print to take a screenshot with xwd, so this could be an XY problem, but I don't think it is...)

Offline

#3 2020-05-02 06:07:30

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,821

Re: [SOLVED] Xbindkeys not detecting PrintScreen

How do you determine that the key isn't grabbed?
Try binding "sleep 0.3; xwd -root > /tmp/whatever.xwd" to release key (and the active keygrab) before running xwd - this is a common issue.

Offline

#4 2020-05-02 15:00:08

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,701

Re: [SOLVED] Xbindkeys not detecting PrintScreen

As a sanity check, what window manager/desktop environment are you using?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#5 2020-05-02 16:15:50

FaeFeyFa
Member
Registered: 2019-08-08
Posts: 20

Re: [SOLVED] Xbindkeys not detecting PrintScreen

ewaller wrote:

As a sanity check, what window manager/desktop environment are you using?

I'm using Awesome WM.

seth wrote:

How do you determine that the key isn't grabbed?
Try binding "sleep 0.3; xwd -root > /tmp/whatever.xwd" to release key (and the active keygrab) before running xwd - this is a common issue.

I tested it by mapping Print Screen to a command that works, as well as a different key to xwd.

Binding my xwd command to a different key does take a screeshot when I hit the relevant button(mute):

"xwd -root -out /tmp/screenshot.xwd -display :0"
         XF86AudioMute

In addition, binding a different command(muting with alsamixer) to the Print key does not work when I hit the print key.

"amixer set Master toggle"
        Print

So I don't think it's an issue with xwd, but rather with xbindkeys...

Offline

#6 2020-05-02 18:11:55

cirrus
Member
From: Glasgow Scotland
Registered: 2012-08-24
Posts: 341
Website

Re: [SOLVED] Xbindkeys not detecting PrintScreen

To specify a key, you can use 'xbindkeys --key' or
# 'xbindkeys --multikey'

edit your ~/.xbindkeyrc to suit

#screenshot
"~/scripts/kap"
m:0x0 + c:107   # Print

Last edited by cirrus (2020-05-02 18:12:37)

Offline

#7 2020-05-02 20:12:19

FaeFeyFa
Member
Registered: 2019-08-08
Posts: 20

Re: [SOLVED] Xbindkeys not detecting PrintScreen

Thanks! Replacing the word "Print" with the actual key (code? value?) worked.

But why would putting the key name(i.e. XF86AudioMute) not work for Print Screen but work for everything else?

Offline

#8 2020-05-02 21:37:32

cirrus
Member
From: Glasgow Scotland
Registered: 2012-08-24
Posts: 341
Website

Re: [SOLVED] Xbindkeys not detecting PrintScreen

FaeFeyFa wrote:

But why would putting the key name(i.e. XF86AudioMute) not work for Print Screen but work for everything else?

The xf86 media keys are suported by many applications
from our fine wiki :  udev contains a large database of mappings specific to individual keyboards, so common keyboards usually work out of the box. If you have very recent or uncommon piece of hardware, you may need to adjust the mapping manually.

Last edited by cirrus (2020-05-02 21:38:44)

Offline

#9 2020-05-03 06:38:53

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,821

Re: [SOLVED] Xbindkeys not detecting PrintScreen

According to the OP, "xbindkeys -k" however detected the symbol and the Print key is rather unexotic and 218 is the inet code.

Is xbindkeys maybe started before some setxkbmap/xmodmap calls?

Offline

#10 2020-05-03 14:15:09

cirrus
Member
From: Glasgow Scotland
Registered: 2012-08-24
Posts: 341
Website

Re: [SOLVED] Xbindkeys not detecting PrintScreen

seth
      i presume OP only used 'Print' in the rc w/o the key codes
or maybe he forgot to toggle the xbindkeys process after edit, in any account looks like he got it sussed.

Offline

Board footer

Powered by FluxBB