WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

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

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: Creating a "windowshot" instead of a screenshot
« Reply #15 on: March 19, 2013, 09:29:53 PM »
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: 1217
Re: Creating a "windowshot" instead of a screenshot
« Reply #16 on: March 20, 2013, 04: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, 04: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: 11178
Re: Creating a "windowshot" instead of a screenshot
« Reply #18 on: March 20, 2013, 07: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, 08: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: 11178
Re: Creating a "windowshot" instead of a screenshot
« Reply #20 on: March 20, 2013, 08: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: 10957
Re: Creating a "windowshot" instead of a screenshot
« Reply #21 on: March 20, 2013, 09:15:18 AM »
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, 12:06:37 PM »
imlib2_grab not in /usr/bin/ , added local/


Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: Creating a "windowshot" instead of a screenshot
« Reply #23 on: July 06, 2013, 01: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, 01: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, 01: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 11, 2014, 09:47:34 PM »
re: TCP 5.1, windowshot.sh

hi,

This script cannot find imlib2_grab.

Please patch xorg.

eltone

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14516
Re: Creating a "windowshot" instead of a screenshot
« Reply #27 on: January 11, 2014, 10:07:05 PM »
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, 12: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: 11178
Re: Creating a "windowshot" instead of a screenshot
« Reply #29 on: January 12, 2014, 08: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.