You are not logged in.
Pages: 1
Hello.
I'm trying to bind my custom script to key via xbindkeys.
My script is located in /usr/local/bin/screen.sh
#!/bin/bash
name="$HOME/SS/SS"
if [[ -e $name.png ]] ; then
i=0
while [[ -e $name$i.png ]] ; do
let i++
done
name=$name$i
fi
scrot -s $name.png
xclip -selection clipboard -t image/png -i $name.pngand is working fine when i'm starting it from terminal ($ screen.sh ).
But when i try to bind it to key, noone of this works:
"/usr/local/bin/screen.sh"
m:0x0 + c:115
"screen.sh"
m:0x0 + c:116When I press binded keys nothing happens. Ofcourse I reloaded xbindkeys, other binds to "standard" applications are working for me.
What am I doing wrong?
Last edited by JUSHJUSH (2017-11-25 14:56:51)
Offline
Have you tried binding other commands to the same keys (e.g., have you verified that that key is detected)?
Also, I assume the space before the shebang in your script is just on the forums, right (otherwise it wouldn't work at all unless you source it rather than run it)?
On a different note, you could simplify that script a fair bit:
name="$HOME/SS/SS"
unset i
while [[ -e "${name}${i}.png" ]]; do
let i++
done
scrot -s "${name}${i}.png"
xclip ...Last edited by Trilby (2017-11-25 14:07:33)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Yeah, key is detected.
I added space accidently while pasting it here.
Last edited by JUSHJUSH (2017-11-25 14:42:24)
Offline
prepend a "sleep 0.25" or so to allow a key release, also redirect the scripts outputs somewhere you can inspect it like " >> /tmp/wtf.log 2>&1" or so.
Offline
Thank you, sleep do the job ![]()
Offline
Pages: 1