You are not logged in.
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
PrintBut 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"
XF86AudioMuteLast edited by FaeFeyFa (2020-05-02 20:13:48)
Offline
(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
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
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
As a sanity check, what window manager/desktop environment are you using?
I'm using Awesome WM.
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"
XF86AudioMuteIn 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"
PrintSo I don't think it's an issue with xwd, but rather with xbindkeys...
Offline
To specify a key, you can use 'xbindkeys --key' or
# 'xbindkeys --multikey'
edit your ~/.xbindkeyrc to suit
#screenshot
"~/scripts/kap"
m:0x0 + c:107 # PrintLast edited by cirrus (2020-05-02 18:12:37)
Ancestoral Clan https://cirrus.freevar.com/mclean.html
Offline
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
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)
Ancestoral Clan https://cirrus.freevar.com/mclean.html
Offline
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
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.
Ancestoral Clan https://cirrus.freevar.com/mclean.html
Offline