WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Creating a "windowshot" instead of a screenshot  (Read 14045 times)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11618
Re: Creating a "windowshot" instead of a screenshot
« Reply #15 on: March 20, 2013, 12:29:53 AM »
Hi hiro
Since I don't know why that one second sleep command was put in there, I didn't remove it. I though it might have
been to allow you time to move the mouse pointer somewhere out of the way, but from what I've seen, the mouse
pointer is not captured.

Offline hiro

  • Hero Member
  • *****
  • Posts: 1229
Re: Creating a "windowshot" instead of a screenshot
« Reply #16 on: March 20, 2013, 07:21:29 AM »
I guess in the original version it was meant for you to have some time to arrange things, like bringing the right window to the front or hiding what you invoked screenshot.sh from, but with this addition it shouldn't be needed I think.

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: Creating a "windowshot" instead of a screenshot
« Reply #17 on: March 20, 2013, 07:43:45 AM »
Once xwininfo is invoked pointer device can't be used to arrange anything, while there is unlimited time to use keyboard before selecting window.
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11618
Re: Creating a "windowshot" instead of a screenshot
« Reply #18 on: March 20, 2013, 10:27:08 AM »
Hi tinypoodle
That may be, but the sleep command is after xwininfo has finished executing, leaving you one second before
imlib2_grab runs.

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: Creating a "windowshot" instead of a screenshot
« Reply #19 on: March 20, 2013, 11:10:56 AM »
Ah yes, correct!
And it seems that if switching desktop within that 1 sec and the selected window does not exist in desktop chosen at time of execution imlib2_grab, then there is a popup but no screenshot saved...
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11618
Re: Creating a "windowshot" instead of a screenshot
« Reply #20 on: March 20, 2013, 11:48:32 AM »
Hi tinypoodle
Switching the desktop probably changes the root window. In order to capture the window you clicked on, imlib2.grab
needs to know its position, size, etc. I believe that involves making a series of calls to X starting with the root windows
ID to find all the child window IDs until a match is found. If the window you clicked on does not exist on that desktop,
it won't be found and nothing is captured. Even if it could be found, you would get a black (or gray) image since the
image imlib2.grab creates is of what is visible on the screen.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: Creating a "windowshot" instead of a screenshot
« Reply #21 on: March 20, 2013, 12:15:18 PM »
I've been using a similar script, though mine pipes xwd through a couple netpbm tools.
The only barriers that can stop you are the ones you create yourself.

Offline beroje

  • Full Member
  • ***
  • Posts: 130
Re: Creating a "windowshot" instead of a screenshot
« Reply #22 on: July 06, 2013, 03:06:37 PM »
imlib2_grab not in /usr/bin/ , added local/


Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11618
Re: Creating a "windowshot" instead of a screenshot
« Reply #23 on: July 06, 2013, 04:54:13 PM »
Hi beroje
Yes, that was copied verbatim from the original screenshot.sh. Maybe it would be better to omit the path altogether.

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: Creating a "windowshot" instead of a screenshot
« Reply #24 on: September 01, 2013, 04:09:13 PM »
Would make a great extension  for the repo  :P

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: Creating a "windowshot" instead of a screenshot
« Reply #25 on: September 01, 2013, 04:19:30 PM »
...or added to Xprogs  to compliment " screenshot " :thumbup:

Offline eltone

  • Full Member
  • ***
  • Posts: 137
Re: Creating a "windowshot" instead of a screenshot
« Reply #26 on: January 12, 2014, 12:47:34 AM »
re: TCP 5.1, windowshot.sh

hi,

This script cannot find imlib2_grab.

Please patch xorg.

eltone

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14812
Re: Creating a "windowshot" instead of a screenshot
« Reply #27 on: January 12, 2014, 01:07:05 AM »
is the imlib2-bin extension loaded?

Offline eltone

  • Full Member
  • ***
  • Posts: 137
Re: Creating a "windowshot" instead of a screenshot
« Reply #28 on: January 12, 2014, 03:11:39 AM »
is the imlib2-bin extension loaded?

Dear Juanito:
Both imlib2-bin.tcz & xorg-7.7-bin.tcz were loaded.

Everything appears ok until attempting to find the .png in the home directory.  The file never got written to disk!

Sincerely,
eltone

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11618
Re: Creating a "windowshot" instead of a screenshot
« Reply #29 on: January 12, 2014, 11:41:01 AM »
Hi eltone
Did you read replies #22 and 23? Try changing:
Code: [Select]
/bin/sh -c "/usr/bin/imlib2_grab -id $WINDOW_ID $HOME/$filename"to:
Code: [Select]
/bin/sh -c "imlib2_grab -id $WINDOW_ID $HOME/$filename"in the script.