Bastien Dejean | 19 Aug 20:22 2011
Picon

[dwm] scrot -s fails

Hi,

The following command don't work (i.e. I can't select the region of the
screen I'm willing to capture) when it's spawn from dwm:

static const char *partialshotcmd[]  = { "scrot", "-s", NULL };

Any idea why?

--

-- 
Bastien

Bjartur Thorlacius | 19 Aug 21:30 2011
Picon

Re: [dwm] scrot -s fails

Þann fös 19.ágú 2011 18:22, skrifaði Bastien Dejean:
> static const char *partialshotcmd[]  = { "scrot", "-s", NULL };
>
I'd guess that the argument is never passed, as the string is terminated 
by the NUL after scrot.

If I read your code correctly, the array contains:
s, c, r, o, t, NUL, -, s, NUL, NULL.

Where the trailing NULL is probably equal to NUL as well. That's three 
NUL instead of the intended one - as C's string notation appends NULs 
after the character array.

Bjartur Thorlacius | 19 Aug 21:33 2011
Picon

Re: [dwm] scrot -s fails

Þann fös 19.ágú 2011 19:30, skrifaði Bjartur Thorlacius:
Pure batshit to be ignored, it seems.

anonymous | 19 Aug 23:53 2011

Re: [dwm] scrot -s fails

On Fri, Aug 19, 2011 at 07:30:08PM +0000, Bjartur Thorlacius wrote:
> Þann fös 19.ágú 2011 18:22, skrifaði Bastien Dejean:
> >static const char *partialshotcmd[]  = { "scrot", "-s", NULL };
> >
> I'd guess that the argument is never passed, as the string is
> terminated by the NUL after scrot.
> 
> If I read your code correctly, the array contains:
> s, c, r, o, t, NUL, -, s, NUL, NULL.
> 
> Where the trailing NULL is probably equal to NUL as well. That's
> three NUL instead of the intended one - as C's string notation
> appends NULs after the character array.
> 

The array contains tree pointers: pointer to NUL-terminated "scrot"
string, pointer to NUL-terminated "-s" string and NULL pointer.

anonymous | 19 Aug 23:51 2011

Re: [dwm] scrot -s fails

On Fri, Aug 19, 2011 at 08:22:12PM +0200, Bastien Dejean wrote:
> Hi,
> 
> The following command don't work (i.e. I can't select the region of the
> screen I'm willing to capture) when it's spawn from dwm:
> 
> static const char *partialshotcmd[]  = { "scrot", "-s", NULL };
> 
> Any idea why?
> 
> -- 
> Bastien
> 

I have tried to do the same thing.  Bound scrot to MODKEY+g, pressed
it and switched to first TTY.  It says "giblib error: couldn't grab
keyboard: Resource temporarily unavailable".  Don't know how to fix it,
but i think it is a problem in dwm.

Bjartur Thorlacius | 20 Aug 00:34 2011
Picon

Re: [dwm] scrot -s fails

Þann fös 19.ágú 2011 21:51, skrifaði anonymous:
> I have tried to do the same thing.  Bound scrot to MODKEY+g, pressed
> it and switched to first TTY.  It says "giblib error: couldn't grab
> keyboard: Resource temporarily unavailable".  Don't know how to fix it,
> but i think it is a problem in dwm.
>
I wonder whether if dwm and scrot are trying to grab the same keys on 
the root window. What keys does scrot bind?

anonymous | 20 Aug 02:17 2011

Re: [dwm] scrot -s fails

On Fri, Aug 19, 2011 at 10:34:28PM +0000, Bjartur Thorlacius wrote:
> Þann fös 19.ágú 2011 21:51, skrifaði anonymous:
> >I have tried to do the same thing.  Bound scrot to MODKEY+g, pressed
> >it and switched to first TTY.  It says "giblib error: couldn't grab
> >keyboard: Resource temporarily unavailable".  Don't know how to fix it,
> >but i think it is a problem in dwm.
> >
> I wonder whether if dwm and scrot are trying to grab the same keys
> on the root window. What keys does scrot bind?
> 
If it was the problem, scrot would not work from dmenu/terminal
emulator. It don't work only when you try to use it from dwm binding.

Connor Lane Smith | 20 Aug 01:19 2011

Re: [dwm] scrot -s fails

Hey,

On 19 August 2011 22:51, anonymous <p37sitdu <at> lavabit.com> wrote:
> I have tried to do the same thing.  Bound scrot to MODKEY+g, pressed
> it and switched to first TTY.  It says "giblib error: couldn't grab
> keyboard: Resource temporarily unavailable".  Don't know how to fix it,
> but i think it is a problem in dwm.

I think this is a bug in scrot. Every X utility worth its salt runs a
loop attempting to bind the keyboard a number of times (see dmenu, but
there are many others), since the resource *can* be temporarily
unavailable. Scrot does not.

This may be a bug in dwm, if you try looping and it fails, but I doubt it.

Thanks,
cls

Steven Blatchford | 20 Aug 00:12 2011
Picon

Re: [dwm] scrot -s fails

On 20:22 Fri 19 Aug, Bastien Dejean wrote:
>Hi,
>
>The following command don't work (i.e. I can't select the region of the
>screen I'm willing to capture) when it's spawn from dwm:
>
>static const char *partialshotcmd[]  = { "scrot", "-s", NULL };
>
>Any idea why?

An IRC discussion on Jul 03, 2011 suggested to use 'import'.

-steve

Bastien Dejean | 20 Aug 10:50 2011
Picon

Re: [dwm] scrot -s fails

Steven Blatchford a écrit :

> An IRC discussion on Jul 03, 2011 suggested to use 'import'.

What is the equivalent in import to the -s argument in scrot?
--

-- 
Bastien

Pascal Wittmann | 20 Aug 11:10 2011
Picon
Picon

Re: [dwm] scrot -s fails

On 08/20/2011 10:50 AM, Bastien Dejean wrote:
> Steven Blatchford a écrit :
> 
>> An IRC discussion on Jul 03, 2011 suggested to use 'import'.
> 
> What is the equivalent in import to the -s argument in scrot?

Just call 'import filename' and drag your mouse over the area. Only
clicking will make a shot of the underlying window.

Steven Blatchford | 20 Aug 00:15 2011
Picon

Re: [dwm] scrot -s fails

On 20:22 Fri 19 Aug, Bastien Dejean wrote:
>Hi,
>
>The following command don't work (i.e. I can't select the region of the
>screen I'm willing to capture) when it's spawn from dwm:
>
>static const char *partialshotcmd[]  = { "scrot", "-s", NULL };
>
>Any idea why?

...which is part of the imagemagick package.

Anselm R Garbe | 20 Aug 13:46 2011
Picon

Re: [dwm] scrot -s fails

The reason for this behavior is that spawn() is executed before the key release handling happens in dwm, thus scrot fails to grab the keyboard.

I consider adding a flag to execute a key binding on release.

Thanks for reporting this.

Cheers
Anselm

Am 19.08.2011 20:22 schrieb "Bastien Dejean" <eschyle <at> gmail.com>:
> Hi,
>
> The following command don't work (i.e. I can't select the region of the
> screen I'm willing to capture) when it's spawn from dwm:
>
> static const char *partialshotcmd[] = { "scrot", "-s", NULL };
>
> Any idea why?
>
> --
> Bastien
>

Gmane