Tiny Core Linux

Tiny Core Extensions => TCE Talk => Topic started by: Rich on May 14, 2015, 01:13:47 AM

Title: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on May 14, 2015, 01:13:47 AM
I wrote a front end for the imlib2_grab utility that lets you use your mouse to select the section of your screen you want
to save. Here is a shot that shows part of my screen outlined:
(http://i60.tinypic.com/20gblt5.png)
And this is the output:
(http://i61.tinypic.com/25g4gt1.png)
The program is relatively compact at 4541 bytes. Packaged with an icon it fits in an 8K tcz.
It's only dependencies are:
Code: [Select]
tc@box:~/guilib/grabber$ ldd grabber
        linux-gate.so.1 =>  (0xb770e000)
        libX11.so.6 => /usr/lib/libX11.so.6 (0xb75ff000)
        libc.so.6 => /lib/libc.so.6 (0xb74f4000)
        libXau.so.6 => /usr/lib/libXau.so.6 (0xb74f1000)
        libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb74eb000)
        libdl.so.2 => /lib/libdl.so.2 (0xb74e7000)
        /lib/ld-linux.so.2 (0xb770f000)
which imlib2_grab requires anyway.
Operation is straightforward. Start it from the command line or click the icon. Outline a section of the screen by holding
the left mouse button and dragging. Hit 's' to save. Repeat as required. Hit 'q' to quit. Files are saved with the following
naming format:
Code: [Select]
/home/tc/screengrab-2015May14-03:12:28.png
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: coreplayer2 on May 14, 2015, 07:02:34 AM
Awesome Thx 


Sent from my iPhone using Tapatalk
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on June 03, 2015, 11:25:35 PM
I decided to do a little more work on the program. I removed the imlib2_grab dependency in favor of linking to libImlib2
directly. Also added a coordinates window that displays the origin, width, and height of the selected area:
(http://i62.tinypic.com/11ht1lv.png)
Sorry the above picture is a little blurry, the picture hosting site rescaled it.. This shows the selected area:
(http://i57.tinypic.com/5ugspd.png)
I've also added a keyboard interface to allow fine tuning of the selected areas size and location and added a configuration
file. Details in the attached files below. The extension has been submitted for TC3 and TC4, though I do believe it will
also run under TC5 and TC6 which I indicated when I submitted it. The only difference being TC5 and TC6 have an  imlib2.tcz
dependency since it was removed from base, though its version number is unchanged.

Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Stone.Giant on June 04, 2015, 09:17:53 PM
will i still use some image viewer like xzgv, gimp v2, etc. ?
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on June 04, 2015, 09:44:48 PM
Hi Stone.Giant
Quote
will i still use some image viewer like xzgv, gimp v2, etc. ?
If you wish to view the file(s) you saved, yes. The program only saves the section of the screen you selected as a .png file.
It does not open files for viewing.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Stone.Giant on June 05, 2015, 10:24:42 AM
I already have imlib2_grab but not working. What else do I need?
Code: [Select]
seed@avocado:/$ imlib2_grab
Usage: imlib2_grab [-v] [-id <drawable id>] [-width <width>] [-height <height>] [-noshape] <output file>
seed@avocado:/$ sudo find -name /guilib
seed@avocado:/$ sudo find -name /grabber
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on June 05, 2015, 12:32:49 PM
Hi Stone.Giant
You have to wait until the grabber extension I sent in gets added to the repository. Then you can install it.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Stone.Giant on June 06, 2015, 10:40:29 PM
Hi Stone.Giant
You have to wait until the grabber extension I sent in gets added to the repository. Then you can install it.

Why u didn't say so :-)
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on June 07, 2015, 02:18:16 PM
The grabber extension has been added to the TC3 and TC4 repositories.

If someone running TC5 or TC6 would be willing to test to verify it runs under those versions it would be appreciated. For TC5
and TC6 you will also need  imlib2.tcz
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: beroje on June 13, 2015, 09:15:23 PM
(http://i62.tinypic.com/2z8u74l.png)
Utilidad excelente. Funciona para mi en Core5

Excellent utility. It works for me in Core5
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on June 13, 2015, 10:07:22 PM
Hi beroje
Glad you like it. Thank you for confirming it runs under TC5.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on June 30, 2015, 01:21:14 PM
Continued from here:
http://forum.tinycorelinux.net/index.php/topic,15906.msg113496.html#msg113496

Hi nitram
Under TC4 running flwm_topside the program runs perfectly, so I installed fluxbox and saw the behavior you described where the
screen appears to shift up and the user panel at the top of the screen shows up twice. I also noticed each time the  n  key was
pressed to invoke another instance of grabber, the screen would shift down.  It seems the window manager is a bit grabby with
my window and ignored my polite request for size, position, and placement on the display stack. So I made some changes and
ask the window manager in a firmer tone of voice to keep it's mitts off my window. The above problems both seem to be resolved.
I will PM you a link to download the new version of grabber.tcz to try out.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: nitram on June 30, 2015, 03:08:41 PM
Hi Rich. Just tested, works well in TC6 using Fluxbox. The screen stepping behaviour totally eliminated. I performed several next invocations and still no wierd screen shift.

Something else. When i tested your original grabber.tcz a .png file was saved to home directory and double-clicking the file in Fluff properly opened the image in Firefox. With this version, the image gets sent to a new Firefox tab but the image does not load with the following error:
Quote
Firefox doesn't know how to open this address, because one of the following protocols (grabber-2015jun30-15) isn't associated with any program or is not allowed in this context.
The default .png save is something like:
grabber-2015Jun30-15:47:54.png
When i eliminate colons and underscores then Firefox opens the image without complaint:
grabber2015Jun30154754.png
I did, however, forget to delete my old grabber.conf file. I will purge the old config file and retest upon rebooting later today. Did something get changed with the naming nomenclature? Note: Opening the .png image through Firefox (Firefox > file > openfile), just not via double-click Fluff. Strange. Will update again later.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: nitram on June 30, 2015, 04:07:22 PM
Sorry i was hurried earlier. Removed old grabber.conf and rebooted, reloaded new grabber, new config, works well. Same Firefox issue as above. Really a Firefox issue but would be nice to open the .png file across any application without hassle. Try to keep my installs simple so Firefox is used as a rarely needed image viewer.

The .png images open perfectly in Firefox via Fluff double-click when the colons are replaced in the default filename:
grabber-2015Jun30-16:35:30.png     ---> not work
grabber-2015Jun30-16C35C30.png     ---> works

In addition to saveprefix=grabber in grabber.conf, would you consider changing the default or providing an option to save the time format as something like grabber-2015Jun30-163530.png?
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on June 30, 2015, 06:31:32 PM
Hi nitram
Quote
Quote
Firefox doesn't know how to open this address, because one of the following protocols (grabber-2015jun30-15) isn't associated with any program or is not allowed in this context.
The default .png save is something like:
grabber-2015Jun30-15:47:54.png
When i eliminate colons and underscores then Firefox opens the image without complaint:
grabber2015Jun30154754.png
I did, however, forget to delete my old grabber.conf file. I will purge the old config file and retest upon rebooting later today. Did something get changed with the naming nomenclature?
No, the format did not change.


Come to think of it, when using tab completion on one of those file names, the colons wind up being escaped with a backslash.
OK, colons will be removed as will be the leading dash. The default filename will look like:
Code: [Select]
YYYYmonthDD-HHMMSS.pngFour digit year, three character month, two digit day, dash, six digit time stamp in 24 hour format.

If you still have IceWm loaded, I'd appreciate if you could test grabber with that.
I'll PM you a link with the revised version.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: nitram on June 30, 2015, 08:46:52 PM
Hi Rich. Just re-tested latest grabber using IceWM. Absolutely perfect! One slick bit of software you made. The new .png filename format is nice, little more compact and cooperates with Firefox. Thanks for all your hard work.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on June 30, 2015, 09:45:27 PM
Hi nitram
Quote
Just re-tested latest grabber using IceWM. Absolutely perfect!
Thanks for confirming the fix worked.
Quote
One slick bit of software you made.
Thanks, I'm pretty pleased with the way it turned out.
Quote
Thanks for all your hard work.
You're welcome. And thanks again for taking the time to test, it was very helpful.

The revised version has been submitted to the TC3, TC4, TC5, and TC6 repositories.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: beroje on July 02, 2015, 06:28:50 AM
Exelente... Muy buena
Excellent ... Very good
TC4 TC5 TC6

(http://i59.tinypic.com/315o49e.jpg)

(http://i60.tinypic.com/hwbee0.png)

(http://i60.tinypic.com/2r47n5w.png)
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on July 02, 2015, 06:51:26 AM
Looks like beroje beat me to it, but grabber.tcz is now also available in the TC5 and TC6 repos. The version in the TC4 repo
has also been updated to fix an interaction problem with certain window managers and the format of the saved file name has
been changed (see Reply #14). Also the comments in the config file received a few clarifications.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on July 02, 2015, 06:55:45 AM
Hi beroje
Thanks again. I see you are running IceWM and FLWM. Which window manager is that in the TC5 screen shot?
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on July 02, 2015, 07:01:36 AM
Hi nitram
You might want to ditch the version I sent you and reinstall from the repo so you have a proper md5 file and a config file whose
comments match the programs operation, delete the old config file first.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Misalf on July 02, 2015, 07:35:21 AM
Hey Rich
beroje's TC5 screenshot shows Fluxbox. Hackedbox doesn't have a panel.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Misalf on July 02, 2015, 07:45:09 AM
Tried it with Hackedbox. Didn't see a problem.

I think it would make sense to use the Enter key to take the screenshot.
That's not a request; just thinking.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on July 02, 2015, 08:28:29 AM
Hi Misalf
Thanks for testing.
Quote
I think it would make sense to use the Enter key to take the screenshot.
I'll keep that in mind if I need to release a new version and other people also think it makes sense.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: nitram on July 02, 2015, 01:08:10 PM
Hi nitram
You might want to ditch the version I sent you and reinstall from the repo so you have a proper md5 file and a config file whose
comments match the programs operation, delete the old config file first.
Done - thanks. Enter key would work too but i'm used to 's' for save in most other apps and it's close to 'q'.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: beroje on July 03, 2015, 06:02:13 AM
Hi Rich
In TC5 I used fluxbox.
Thanks again.

Hi Rich
En TC5 he usado fluxbox.
Gracias nuevamente.

(http://i58.tinypic.com/hs5cw5.png)
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: coreplayer2 on October 11, 2015, 09:01:20 PM
(https://db.tt/zNR8vEgn)

I made this perfect window-shot using grabber on a multi colored background, it's really nice for fine clipping the excess off the window borders.

Thanks Rich

I have a suggestion please
I think it would be much more useful to include or replace the coordinates in the coordinates panel with an abbreviated keyboard function list to help remember how to fine tune the window-shots ??
since it's not every day we take a screenshot..
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on October 12, 2015, 11:32:21 PM
Hi coreplayer2
Rather than mess with the coordinates window, how about a popup help window like this:
(http://i57.tinypic.com/91ktmx.jpg)

(http://i57.tinypic.com/67hydt.jpg)

Press  h  or any other key not defined for a keyboard function and it pops up. Press any key to hide the help window.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on October 12, 2015, 11:52:09 PM
Hi coreplayer2
Sent you a PM with a link to the modified tcz for you to test before I submit it.

Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: coreplayer2 on October 13, 2015, 10:08:52 AM
Hi Rich

the help menu is perfect thanks

What led to that suggestion was the trouble I got myself into when multiple instances were loaded.  Actually without the ability to read a help menu I was forced on several occasions to use REISUB to escape back to a usable system.

With that experience in mind I wonder if it's also possible modify the "q"  keyboard shortcut? perhaps even expand on it a little..?  for example:

(either q or Esc ??)

q = quit all instances
Q= quit topmost instance


Awesome application, thanks Rich
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: curaga on October 13, 2015, 12:48:21 PM
If it doesn't prevent a VT switch, you can switch there and do a "killall grabber". If there are no extra VTs, it's fully ok to suspend X with ctrl-Z.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on October 13, 2015, 07:14:17 PM
Hi coreplayer2
Adding  ESC  is not a problem. Quitting all instances might be tricky.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on October 14, 2015, 11:47:05 AM
Hi coreplayer2
Both changes have been implemented.
(http://i59.tinypic.com/2q9x9y0.jpg)
I'll PM you a download link.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: coreplayer2 on October 14, 2015, 12:12:17 PM
Awesome, thanks Rich   

After using the previous version with the help menu all morning (which is cool thanks) I have one quick question?  Can the "Shift" key be inhibited from bringing up the help screen as "Shift is required when using X or Y etc. etc..   You can see the dilemma?  While it has no effect on the outcome, every time we try to select Shift+x or Shift+y we are presented with the onscreen help menu. 

great job

Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on October 14, 2015, 12:17:10 PM
Hi coreplayer2
Oops, I missed that. Shouldn't be too hard to fix.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on October 14, 2015, 12:26:58 PM
Hi coreplayer2
Link for fixed version sent to you.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: coreplayer2 on October 14, 2015, 01:17:30 PM
Works great thanks Rich

Onscreen help, "Shift" and kill-all keys work as expected thanks

Now that I'm experienced with the program I use the mouse to set starting x & y position, then drag a box a little larger than the window to capture.  Then I use the arrow keys to position the top & left selection bars exactly over the desired border and then use x & y keys to reduce the width and height selection bars exactly over the desired borders.  Selecting "s" saves to my user directory.

(https://db.tt/Yrik4gkq)



Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on October 14, 2015, 02:19:01 PM
Hi coreplayer2
You're welcome, glad you like it. If you or anyone else think of anything else, let me know. I'll hold off submitting
this version a few days.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: coreplayer2 on October 14, 2015, 03:26:06 PM
I luv it thanks..

I have a couple observations which are really trivial and I don't really know if they are worth any attention because could be just semantics, but they are worth mentioning..

First,   regarding the selection box, which are Top/Left and Bottom/Right outlines.   you can move and position the x & y co-ordinates which define the Left outline and Top outline, so that the top/left selection outlines are positioned over a window border using the arrow keys or L/l R/r keys. 
then you can move and position the h & w co-ordinates (I assume Height and Width) which define the bottom outline and right outline, so that the bottom/right selection outlines are positioned over a window border using the arrow keys or X/x and Y/y keys.

Maybe there is some technical reason why we can't move the x and y co-ordinates with the arrow keys and X/x and Y/y keys.  Then move the W and H co-ordinates with W/w and H/h keys..   Sounds good right?? 


Secondly,   this is more difficult to explain..     When you position the selection box exactly over the desired window border lets say over the outermost one pixel width of the widow border, the top & left selection components capture the one pixel beneath the selection bars.  Whereas the right & bottom (W & H) selection bars do not capture the one pixel of the window border directly beneath them, ie the saved window shot is missing the one pixel off the bottom and right sides.  Conversely you could say that the top and left portion of the saved window shot have gained the extra one pixel of the window border.

Honestly I don't know which is right, but I think the x/y and w/h selection co-ordinates should capture the same.  That is either the pixel inside the border or the pixel underneath, for all sides of the selection box.   I'm thinking if you draw a box around a window you should capture every pixel inside that selection., seems logical..?

sorry if that's clear as mud...
 8)
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: nitram on October 14, 2015, 04:22:43 PM
I really like grabber and keep it in OnDemand so please don't misunderstand. When i read coreplayer2's latest comment, Scrot's window capture immediately came to mind. If a screenshot of only a specific window is desired, just click on the window and it's automagically captured for the screenshot, no fiddling with border edges and x/y nudges. Personally i'm not picky with screenshots, just outline a portion of the desktop/close enough and take the shot, but for users who desire pixel precision maybe a future feature? Take care :)
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: coreplayer2 on October 14, 2015, 05:43:14 PM
Well I hope Rich doesn't think I'm being picky.. 

grabber is super  ;D
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on October 14, 2015, 08:22:29 PM
Hi coreplayer2
No, Rich doesn't think you're being picky, he's just contemplating the contents of your last post.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on October 14, 2015, 08:24:55 PM
Hi nitram
Quote
Scrot's window capture immediately came to mind. If a screenshot of only a specific window is desired, just click on the window and it's automagically captured for the screenshot ...
I presented a script a couple of years ago that can do that too:
http://forum.tinycorelinux.net/index.php/topic,15086.msg86458.html#msg86458
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on October 14, 2015, 10:18:26 PM
Hi coreplayer2
So it sounds like you want to use upper/lower case x, y, w, and h to better match the notation used in the coordinates
window, that's doable.
With respect to the outline, yes, the area defined does not include the bottom/right lines. Fixing that might prove to
be messy. I'd need to examine the code very carefully to see what's involved.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: nitram on October 15, 2015, 08:07:57 AM
I presented a script a couple of years ago that can do that too:
http://forum.tinycorelinux.net/index.php/topic,15086.msg86458.html#msg86458
Hi Rich. Thanks for providing some TC screenshot history. Your windowshot script still works well in TC6 x86 with the modifications described in the link, if you were thinking about submitting an extension. Take care.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on October 15, 2015, 11:07:10 AM
Hi nitram
I hadn't planned on submitting it as an extension. If someone thinks it's worth putting into the repository, they're
welcome to do so with my blessing. Just read through the thread and apply the appropriate fixes first.
Windowshot was created to address a specific issue: What if I don't want the whole screen, but just one window?
Grabber was created to address a different issue: What if I want just a specific section of the screen?
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on October 15, 2015, 11:48:21 PM
Hi coreplayer2
I've added an option that lets you include the mouse cursor in the saved image by hitting  c  instead of  s.
I'll PM you a download link so you can try it out if you wish.
Quote
So it sounds like you want to use upper/lower case x, y, w, and h to better match the notation used in the coordinates
window, that's doable.
I have not implemented this yet. If you confirm this is what you had in mind, I'll make the change.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on October 16, 2015, 08:30:52 AM
Hi coreplayer2
Forgot to mention, if you're running this under TC5 or TC6 you'll need  libXfixes.tcz, it's small, only 20K. If you're
running under TC4 it depends on  Xorg-7.6-lib.tcz  which is most likely installed since so many extensions depend
on it anyway. These dependencies should only effect capturing the cursor.
Title: Selecting an area of the screen for a screenshot using your mouse
Post by: coreplayer2 on October 16, 2015, 10:00:16 AM
Rich, that's cool and yes the keyboard quick keys in keeping with coordinates notation was exactly my concern.

Since you reminded us of the history and grabber's intended use, the lower and right window border anomaly is I think a moot point.. 

Thanks


Sent from my iPhone using Tapatalk
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on October 16, 2015, 10:47:59 AM
Hi coreplayer2
Getting ready to head out to go sailing now. I'll make the keyboard mods later tonight.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: nitram on October 16, 2015, 06:09:09 PM
If someone thinks it's worth putting into the repository, they're welcome to do so with my blessing....
Hi Rich.
In the process of preparing to submit as windowshot.tcz.
- Still need to test if it will work in Xvesa with xwininfo (xorg-7.7-bin.tcz) dependency, otherwise info file will indicate Xorg only
- Stll need a desktop icon, if you have preference send a link otherwise i'll find something online
- The script was modified to reflect changes required in the link you posted above
- It was also changed to output 'windowshot' and the windowshot .png file name will be same name/date format as grabber

Take a look at modified script, OK with you? Will clean up before submit.
Code: [Select]
#!/bin/sh
#
# Based heavily on Tinycores screenshot.sh, this script captures a
# single window rather than the entire screen. When run, the cursor
# changes to a crosshair. Click on a window to save a .png of it in
# your home directory. Richard Rost 3-19-2013

[ -z ${DISPLAY} ] && echo "Requires X" &&  exit 1
which xwininfo > /dev/null
[ "$?" -ne 0 ] && exec popup "Requires xwininfo, see Xorg-7.(5 or 6)-bin.tcz" &&  exit 1
WINDOW_ID=`xwininfo -frame | grep " Window id:" | cut -d " " -f 4`
#filename=screenshot_`date "+%m%d%H%M%S"`.png
filename=windowshot-`date "+%Y%b%d-%H%M%S"`.png
#sleep 1
#/bin/sh -c "/usr/bin/imlib2_grab -id $WINDOW_ID $HOME/$filename"
/bin/sh -c "imlib2_grab -id $WINDOW_ID $HOME/$filename"
#exec popup "Screenshot saved to $HOME/$filename"
exec popup "Windowshot saved to $HOME/$filename"

Noticed your grabber is a binary - i don't know how to create that and was just going to place the .sh script into /usr/local/bin - OK?

grabber.tcz includes custom grabber-license text, do you want to provide something similar for windowshot.tcz or just GPL?

You will obviously be documented as author in the info file, i'm just the maintainer.

Plan to submit for TC6 x86. Anything else let me know - thanks.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on October 16, 2015, 07:11:51 PM
Hi nitram
Quote
- Still need to test if it will work in Xvesa with xwininfo (xorg-7.7-bin.tcz) dependency, otherwise info file will indicate Xorg only
Since the 7.5 and 7.6 versions of xwininfo work under Xvesa, I would expect the 7.7 version to work too, but
confirmation would be prudent.
Quote
- Stll need a desktop icon, if you have preference send a link otherwise i'll find something online
I'll leave the icon selection to you.
Quote
Take a look at modified script, OK with you? Will clean up before submit.
Minor change:
Code: [Select]
#[ "$?" -ne 0 ] && exec popup "Requires xwininfo, see Xorg-7.(5 or 6)-bin.tcz" &&  exit 1
[ "$?" -ne 0 ] && exec popup "Requires xwininfo, see Xorg-7.(5, 6, or 7)-bin.tcz" &&  exit 1
Quote
Noticed your grabber is a binary - i don't know how to create that and was just going to place the .sh script into /usr/local/bin - OK?
That's because grabber was written in C and is compiled. /usr/local/bin/windowshot.sh  is correct.
Quote
grabber.tcz includes custom grabber-license text, do you want to provide something similar for windowshot.tcz or just GPL?
Good question. The original script was part of the TC4 base installation and not signed by the author. I think just GPL
should be fine.
Quote
Plan to submit for TC6 x86. Anything else let me know - thanks.
You will need a  .dep  file containing:
Code: [Select]
imlib2-bin.tcz
Xorg-7.7-bin.tcz
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on October 16, 2015, 08:09:30 PM
Hi coreplayer2
I just updated the keyboard functions and update the help window to match. You'll have a link to the updated tcz
PM'd to you in a few minutes.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on October 19, 2015, 10:24:33 PM
Hi coreplayer2
Have you had a chance to try the last version I sent you to make sure I got it right?
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: coreplayer2 on October 20, 2015, 06:05:10 AM
yes thanks, the extension works great, is easy to use and intuitive.  good job thanks  :)

help menu is perfect also thanks

Thinking out loud here and I keep thinking..   Perhaps there is a simpler way to move the selection boundaries...  the arrow keys seem intuitive right?  there are four boundaries, all are independent and there are four arrow keys.    the shift key could can be used to determine an alternate direction of movement..  Anyhow that's most likely a lot of work and the app is great as is, just thinking....

Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on October 20, 2015, 09:18:50 PM
Hi coreplayer2
Interesting idea, but a shifted arrow key returns the same keycode as an unshifted arrow.
Also found a subtle bug with the escape key. Running under TC4, xorg7.5, and flwm. Start grabber from the command
line, use escape to exit, then click the mouse. All mouse clicks will now be ignored. Hit Alt-Tab a couple of times, then
click the mouse, and proper operation of the mouse is restored. This does not occur under Xvesa. It also does not
appear to be a bug with grabber itself. I can reproduce the same behavior by hitting escape in a terminal that has
focus and then clicking the mouse. I'll have to remove the escape key function if I can't resolve this.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: curaga on October 21, 2015, 02:17:16 AM
Shift can be checked in the mask field (the ShiftMask bit is 0x1).
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on October 21, 2015, 06:23:19 AM
Hi curaga
True, but this also affects the keypad arrows. Under Xorg, shifted arrows revert back to numbers when NumLock is
off and do the opposite when NumLock is on. I'd prefer not to add special levels of decoding for these corner cases.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on May 09, 2016, 01:42:41 PM
Hi coreplayer2
Secondly,   this is more difficult to explain..     When you position the selection box exactly over the desired window border lets say over the outermost one pixel width of the widow border, the top & left selection components capture the one pixel beneath the selection bars.  Whereas the right & bottom (W & H) selection bars do not capture the one pixel of the window border directly beneath them, ie the saved window shot is missing the one pixel off the bottom and right sides.  Conversely you could say that the top and left portion of the saved window shot have gained the extra one pixel of the window border.

Honestly I don't know which is right, but I think the x/y and w/h selection co-ordinates should capture the same.  That is either the pixel inside the border or the pixel underneath, for all sides of the selection box.   I'm thinking if you draw a box around a window you should capture every pixel inside that selection., seems logical..?

sorry if that's clear as mud...
 8)

Having just dealt with that issue in another program I'm working on, I fixed grabber so the width and height readouts now
reflect the inside dimensions of the selection rectangle. Modified the info file to read:
Quote
      Move the mouse with the left button depressed to draw an outline around the
      section of the screen to save. Everything inside the outline will saved as
      a  .png  file. The outline will not be included in the saved file.

I also removed the Esc key to quit function since I wasn't able to resolve the problem in post #55.

grabber version 1.2 has been submitted and will probably be available in about a week.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on May 23, 2016, 07:53:04 AM
The updated grabber.tcz version 1.2 is now available in the repository. Thank you to all that tried it and provided
feedback, especially nitram and coreplayer2 who assisted in bug fixes, testing, and improving the user interface.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on August 05, 2018, 09:11:24 PM
Hi aus9
Everything looks good.

Code: [Select]
grabber.c: In function ‘main’:
grabber.c:588:14: warning: unused parameter ‘argc’ [-Wunused-parameter]
 int main(int argc, char *argv[])
              ^~~~
The first warning is because my program doesn't take any command line parameters, so I don't use  argc.

Code: [Select]
grabber.c:817:12: warning: this statement may fall through [-Wimplicit-fallthrough=]
      status|=KILLALL;
            ^
grabber.c:818:6: note: here
      case XK_q: // ****** Quit current instance program
      ^~~~
grabber.c:854:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
      AddCursor();
      ^~~~~~~~~~~
grabber.c:855:6: note: here
      case XK_s: // ****** Save an image
As far as these 2 warnings are concerned, those statements will most definitely fall through, because I want them to. ;D
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: aus9 on August 05, 2018, 09:27:26 PM
sorry I  deleted my post as I wanted to clear some things up. Thanks for the heads up

am in the process of trying out a few things because I should have done it earlier.

edit Rich replied and the main parts of his reply refer to this
Code: [Select]
gcc  $CFLAGS -Wall -Wextra -fwhole-program -c $P.c -g
grabber.c: In function ‘main’:
grabber.c:588:14: warning: unused parameter ‘argc’ [-Wunused-parameter]
 int main(int argc, char *argv[])
              ^~~~
grabber.c:817:12: warning: this statement may fall through [-Wimplicit-fallthrough=]
      status|=KILLALL;
            ^
grabber.c:818:6: note: here
      case XK_q: // ****** Quit current instance program
      ^~~~
grabber.c:854:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
      AddCursor();
      ^~~~~~~~~~~
grabber.c:855:6: note: here
      case XK_s: // ****** Save an image

gcc $CXX -I. -L. $P.o -o exe -lImlib2 -lX11 -lXfixes
# no output

but I saw I had not used $CXX in my first post which I deleted so was hoping he had not seen it, so I could try out some stuff.
more later
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: aus9 on August 06, 2018, 01:03:01 AM
ok clean build and rebooted into xbase.lst, my dep has only libXfixes as imlib2 stuff is there.
but I deleted my post when I realized that I had not correctly put my CXX flags into the build bit

so here is that aspect.

Code: [Select]
CFLAGS="-mtune=generic -Os -pipe"
CXX="-flto -fuse-linker-plugin -mtune=generic -Os -pipe -fno-exceptions -fno-rtti"
P=grabber
snip
gcc  $CFLAGS -Wall -Wextra -fwhole-program -c $P.c -g
gcc $CXX -I. -L. $P.o -o exe -lImlib2 -lX11 -lXfixes

second last line as discussed....works the same as above and you have already allayed my concerns on that issue.

bottom line builds the exe and my build script creates TCZ etc

Test with xbase.lst is a pass for a full screenshot. Pass for a selection too.
I am inviting another member to have a look at something unrelated to above so hope you don't mind me attaching the build script.

the download gsource was only created because I did not want to try to work out how to use your attachment in my script as I lacked the skills.

will let you know if I have had any feedback from that other member later

thanks
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on August 06, 2018, 08:53:27 PM
Hi aus9
I removed the source package from the other thread and am reposting it here. I also renamed the file to reflect its
current version number, the contents are unchanged.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: aus9 on August 06, 2018, 10:34:14 PM
Rich

right, no change still v 1.2

thanks
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: aus9 on August 17, 2018, 06:18:38 PM
Rich

your creation has landed in 64 bit Repo
Your c, h and png files are in a compressed package called grabber-src-files.tcz
http://repo.tinycorelinux.net/9.x/x86_64/tcz/src/grabber/

thanks
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on August 17, 2018, 06:43:01 PM
Hi aus9
Is  imlib2  part of a base install in x86_64? If not, then  imlib2.tcz  needs to be added to  grabber.tcz.dep.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: aus9 on August 17, 2018, 08:07:46 PM
Rich

imlib2-bin and imlib2 are already in xbase.lst
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Rich on August 17, 2018, 08:12:05 PM
Hi aus9
OK, just checking because as of TC5  imlib2  was removed from base in x86.
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Pats on August 17, 2018, 08:46:29 PM
Generally "import" coomand can be used to capture part of the screen.
It would be desirable, if grabber can be used to capture irregular area on the screen displaying an image with a facility to reverse the pixel  colors from black to white and vice-versa etc within selected irregular area with click of a mouse button, if posible !  :)
By the way, nice efforts for grabber !
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Juanito on August 18, 2018, 04:43:11 AM
dep file adjusted
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: aus9 on August 18, 2018, 03:38:12 PM
now I am confused. I thought if a dep was already in xbase.lst I did not need it for the TCZ dep?
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: Juanito on August 19, 2018, 12:27:19 AM
I don't recall that being said?
Title: Re: Selecting an area of the screen for a screenshot using your mouse
Post by: aus9 on August 19, 2018, 01:56:04 AM
ahh well I get easiy confused ;)