You are not logged in.

#1 2012-06-10 12:09:36

iOfWhy
Member
Registered: 2012-05-16
Posts: 26

[SOLVED] keeping terminal window open for scrot keyboard shortcut

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

#2 2012-06-10 12:17:47

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: [SOLVED] keeping terminal window open for scrot keyboard shortcut

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

#3 2012-06-10 12:20:15

iOfWhy
Member
Registered: 2012-05-16
Posts: 26

Re: [SOLVED] keeping terminal window open for scrot keyboard shortcut

excellent... how do you do it?

Offline

#4 2012-06-10 12:21:35

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: [SOLVED] keeping terminal window open for scrot keyboard shortcut

??

"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

#5 2012-06-10 12:25:02

iOfWhy
Member
Registered: 2012-05-16
Posts: 26

Re: [SOLVED] keeping terminal window open for scrot keyboard shortcut

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

#6 2012-06-10 19:01:47

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: [SOLVED] keeping terminal window open for scrot keyboard shortcut

Check logs in /var/log/*


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#7 2012-06-10 19:16:04

2ManyDogs
Forum Moderator
Registered: 2012-01-15
Posts: 4,645

Re: [SOLVED] keeping terminal window open for scrot keyboard shortcut

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 &amp; drag mouse)">
	<action name="Execute">
		<execute>
			scrot -s '%Y-%m-%d--%s_$wx$h_scrot.png' -e 'mv $f ~/images/ &amp; 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)


How to post. A sincere effort to use modest and proper language and grammar is a sign of respect toward the community.

Offline

#8 2012-06-10 19:35:07

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: [SOLVED] keeping terminal window open for scrot keyboard shortcut

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

#9 2012-06-10 19:49:56

stqn
Member
Registered: 2010-03-19
Posts: 1,191
Website

Re: [SOLVED] keeping terminal window open for scrot keyboard shortcut

iOfWhy wrote:

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

Board footer

Powered by FluxBB