You are not logged in.
Hey,
Im trying to bind a keyboard shortcut to scrot with the -s command (for selecting window). Normal scrot command works fine straight away, but with the -s command a terminal window needs to be open that waits for the selection. i have created a file called lscrot with the following code:
1 #!/bin/bash
/usr/bin/terminal --working-directory=$HOME/dump/ --geometry 0x0-0-0 -e "/usr/bin/scrot -s"
i have put the file in /usr/bin folder with 755 permissions.
if i right click the file and choose "execute", the new terminal window will stay open and i can select an area to take a screenshot of, but when i bind it to a shortcut key (using xfce) the new terminal window will close immediately rendering the shortcut useless.
how does one fix this?
thanks
Last edited by iOfWhy (2012-06-10 13:41:55)
Offline
Why not fix the main/underlying problem: scrot -s should not require a terminal window to be open, it doesn't when I use it and it allows me to select a window just fine.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
excellent... how do you do it?
Offline
??
"scrot -s" from dmenu.
Nothing special. Without more information I'm not sure why it *doesn't* work for you, but it should.
Last edited by Trilby (2012-06-10 12:22:24)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
hmmm, ok. binding keys to /usr/bin/scrot works fine, but /usr/bin/scrot -s does not. dont really know where to begin searching for a fix...
EDIT: im assuming there is something elementary i am missing. after further testing, launching for example scrot ~/dump/test.png from console works fine, but not when i bind it to a keyboard shortcut. however, scrot test.png works to bind. does anyone know anything more about XFCe and binding keyboard shortcuts?
EDIT2: ok so im honing in a little bit, i realised that the first times i use the keyboard shortcut it works. forcing the terminal window to stay open after command has been executed i see following error:
giblib error: couldn't grab keyboard:Resource temporarily unavailable
Searching the net i found old bug that was closed without (seemingly) being solved.
https://groups.google.com/group/linux.d … 2056017d9a
Any ideas?
EDIT3: ok so found a solution, "sleep". Adding sleep 0.1 to the top of the screenshot script seemed to help. seems you need to give sometime to release the keyboard for scrot to use. would still be great if anyone knew how to get it to work by using a direct command in the keyboard shortcut bindings. ie binding in straight to "scrot -s". using Alt+F2 then typing in scrot -s works fine, so i really dont see why i cant bind a keyboard command straight to that.
NOTE: how do i see xsession errors? I find no .xsession-errors file in my home directory. been searching for months.
Last edited by iOfWhy (2012-06-10 13:33:56)
Offline
Check logs in /var/log/*
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I know you're using xfce, but here's another data point. This menu option works in openbox menu.xml:
<separator label="scrot"/>
<item label="Selected Area... (click & drag mouse)">
<action name="Execute">
<execute>
scrot -s '%Y-%m-%d--%s_$wx$h_scrot.png' -e 'mv $f ~/images/ & viewnior ~/images/$f'
</execute>
</action>
</item>
and another data point, I just added this keybinding to ratpoison (the WM I'm currently using):
definekey top s-p exec scrot -s
and it let me select a rectange and produced a nice shot.
Last edited by 2ManyDogs (2012-06-10 19:22:10)
Offline
Perhaps you could temporarily try a binding like
scrot -s 2>~/scrot_error
Maybe that will give you some useful info (in ~/scrot_error).
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
NOTE: how do i see xsession errors? I find no .xsession-errors file in my home directory. been searching for months.
Here they appear in tty1 (ctrl-alt-f1).
Offline