topic title: Screenshot 2
Posts: 1,081
OU812
Joined: 29 Sep 2007
#1
Hello. I've been trying to figure out what to do about a new screenshot app. I'm not entirely happy with the last one I wrote or the one I found in the Ubunutu forums called"Printscreen." I can't seem to install xfce screenshot and I can't get gsnapshot to compile. I found one alternative called xsnap, which is fairly nice, but also very limited. I also found a couple at softpedia, but they required imagemagick (as did the previously mentioned Printscreen). So I started thinking about how I use screenshot apps and decided to go from there. I ended up editing my last screenshot app by blending it with some ideas from the previously mentioned apps. Here's the changelog:

1. Created two tabs: basic and advanced. The basic tab has options for region to capture, delay, and filename. The advanced tab has options for file type and generating thumbnails (useful for uploading to webpages).
2. Included the -b flag so that when you want to take a screenshot of a window, the window decorations are included. (Choose custom from the region menu and left-click on a window.)
3. A preview of the image is automatically loaded into feh. If a fullscreen image is taken, then feh displays the shot in a small window instead of fullscreen.
4. As the image is being previewed in feh, a dialog pops up asking you if you want to keep the image. If you do, the image is"saved" in your home directory (scrot automatically saves the image, but the way the app works makes it seem as though it waits for your input). Otherwise, it is deleted. Feh is also automatically closed after a choice is made.
5. Removed the choose directory option since I couldn't figure out how to get it to work. Screenshots are saved to /home/$USER by default. (I could add a dialog box that would launch after you choose whether or not to keep the screenshot, but that makes the screenshot app too hands-on for my taste.)
6. The program runs again so you can take additional shots.
7. Removed the"file has been saved" confirmation since I didn't want the app to be too hands-on.

Here's a zip file. Unpack it as root to /usr/local/bin. Enter antixscreenshot.sh in terminal or run dialog to launch the app.

(updated 11-25-09)

Please provide feedback. Thanks.

john
Last edited by OU812 on 25 Nov 2009, 15:32, edited 5 times in total.
Posts: 1,081
OU812
Joined: 29 Sep 2007
#2
Changelog:

1. Removed delay flag from custom screenshot. I don't see it as necessary since the shot should be taken as soon as you choose your region.
2. Added"window" to the choose region drop-down menu. I never knew about this option so I felt that having it as an option make this feature more obvious.
3. Titled zenity dialog windows with"antiXscreenshot."

john
Posts: 1,081
OU812
Joined: 29 Sep 2007
#3
Changelog:

added the"saved as" confirmation dialog. not as hands-on as I had thought and does add a nice touch.

I'll upload an updated version later today. Or perhaps if feedback starts rolling in with other suggestions.

Thanks.

john
Posts: 1,520
eriefisher
Joined: 07 Oct 2007
#4
If you follow the unpack instructions as is you will end up with 2 scripts, one ending with 3 and the original. the new script will call the original when it restarts.

Just a heads up.

The script looks great John. A .deb with versions would correct the install issue???????

Let me know.
Posts: 1,228
secipolla
Joined: 15 Jun 2008
#5
John, this is really good. Thumbnail is an excellent feature.

I have two suggestions:
- a little tick box to"Close after the shot".
- grey out the"Delay in seconds" field when"Custom area" or"Window" are chosen.
Posts: 1,081
OU812
Joined: 29 Sep 2007
#6
@erie
I have it saved on my box as antixscreenshot3.sh. When I zipped it, I eliminated the 3. I thought it would unpack with the correct filename. Let's wait until the app is polished up a bit before we build a package for it.

@secipolla
I got the idea to loop the app from a review of antix I saw online. I could add the checkbox to turn off the feature and see what happens. I like the idea of graying-out the delay option. Should be just one additional line of code.

Thanks for the feedback. It may a little more time to update since I'm ever behind in grading papers, creating tests, calling parents, etc. Boy, I thought being a student and working full-time was hard!

john
anticapitalista
Posts: 5,955
anticapitalista
Site Admin
Joined: 11 Sep 2007
#7
Had a look as well OU812 and prefer this version to the previous ones (including the testing ones).
This version also saves a few MB as imagemagik is not needed.
Posts: 4,164
rokytnji
Joined: 20 Feb 2009
#8
All I can say is I am now using it and like it. Changed all my Menus to use it. Left old screenshot.sh in /usr/local/bin and just edited/added the 3 to the end of screenshot.sh on toolbar and menu entries for Icewm and Fluxbox. Works like a charm for me on my Asus EEE 900. I will be downloading and using it also on my Shop Desktop and IBM T23 Laptop AntiX Installs also later. Thanks OU812.
Posts: 1,081
OU812
Joined: 29 Sep 2007
#9
Changelog:

1. Bugfix - When you choose full screen, but cancel the shot, the save dialog runs anyway. Now fixed.

2. Added a checkbox for taking multiple screenshots. Off by default.

3. Added a checkbox in advanced tab for choosing a save to directory. On by default.
So, after choosing to save the screenshot, the save to dialog pops up unless you turn it off. Or would it be better to turn it off by default?

EDIT - Looks like I forgot to put in a save dialog for the event that the save to directory option was turned off.

Please Download the version in the first post.


john

P.S. I'll post the orginal version with the bugfix later.
Last edited by OU812 on 03 Nov 2009, 13:45, edited 1 time in total.
Posts: 1,081
OU812
Joined: 29 Sep 2007
#10
Also, there may be a small problem with the design of the app.

Let's say I have"screenshot.png" saved in my home dir. Then I take another shot with the same name and choose not to save it. Then the original screenshot in my home dir is deleted since it had the same name.

To fix this, I'll think I'll have to set up a tmp dir for the screenshots. If user chooses not to save the screenshot, the dir is deleted. Otherwise, the file is moved to the appropriate dir (home or the dir chosen with the dialog box). Of course, I'd need to use the confirm overwrite flag to make sure files don't get accidentally deleted.

john
Posts: 1,081
OU812
Joined: 29 Sep 2007
#11
I fixed the bug with the"screenshot saved" dialog - it now appears every time a screenshot is saved regardless of options.

I'm not going to upload a newer version until I have time to fix the real problem: screenshots getting deleted due to poor naming on the user end. When I have time - perhaps next weekend - I'll edit the app so that a temp directory is established for the screenshot. If the user chooses to save it, then it is saved - with overwrite confirmation - in the appropriate directory. In either case, the temp folder and contents is deleted. I hope it's as simple as it sounds.

Once this is done, I'll move on the to the icewmconfig app. Hopefully I can learn some tricks from a script I found.

john
Posts: 1,081
OU812
Joined: 29 Sep 2007
#12
Changelog:

1. Eliminated the tabbed interface an am using two horizontal frames to present all of the options. It's similar to Puppy Linux's control center layout.

2. Screenshots are now saved in a temporary directory. The screenshots are then moved to the appropriate directory and the directory is removed.

I still need to find a way to ensure that existing screenshots won't be overwritten.

john
anticapitalista
Posts: 5,955
Site Admin
Joined: 11 Sep 2007
#13
How about having some sort of count or date/time stamp in the name of the file?
Posts: 1,081
OU812
Joined: 29 Sep 2007
#14
Hmm. That might work. I'd have to think about how to present that option. Would there be a stamp with the chosen filename or instead of? Also, I've seen docs on using a date stamp, but I can't find a time stamp.

Thanks.

john
Posts: 1,081
OU812
Joined: 29 Sep 2007
#15
Changelog:

1. Added some error checking. If you change the extension while using the save dialog, an error message appears and asks you to try saving it again. And the save dialog opens again. (I don't know how to convert the image type without having imagemagick installed. I thought this was a good compromise.)

2. Added more error checking. Added a function - based on Printscreen - that checks to see if the file exists in the chosen directory (whether you're using the save dialog option or not). If it does, then the file is saved as filename_#.ext. Where filename is the name chosen by the user, # is an incremental number (so filename, filename_1, filename_2, filename_3, etc.), and ext is the extension chosen in the screenshot dialog.

To do:
Need to add the thumbnail option (if chosen) to the error checking function.

Don't know if I can get to it today. I'm getting close. Perhaps a week more depending on my schedule.

john