Tiny Core Linux

Tiny Core Base => TCB Q&A Forum => Topic started by: newtotinycore on March 26, 2012, 10:39:21 PM

Title: Screenshot- Possible to set 'saved to' File-name?
Post by: newtotinycore on March 26, 2012, 10:39:21 PM
Excuse a simple-minded question.
When taking a screenshot, is there a way to set the file-name the image is saved to at the time the image is made?
I know I can rename the file later; just wondering if I can avoid having to copy and type (correctly) the 10 digit number the  screenshot utility uses.

Thanks in advance.
Title: Re: Screenshot- Possible to set 'saved to' File-name?
Post by: maro on March 27, 2012, 12:35:29 AM
Well, the menu item 'ScreenShot' calls in the end '/usr/local/bin/screenshot.sh', which is just a wrapper script around a call of 'imlib2_grab FILENAME.EXT' (with EXT something like 'png', 'jpg', 'ppm' or 'bmp'). 
Title: Re: Screenshot- Possible to set 'saved to' File-name?
Post by: Rich on March 27, 2012, 12:52:45 AM
Hi newtotinycore
You could try modifying the  /usr/bin/screenshot.sh  script to look like:
Code: [Select]
#!/bin/sh
[ -z ${DISPLAY} ] && echo "Requires X" &&  exit 1
editor /tmp/savename.txt
filename=`cat /tmp/savename.txt`.png
/bin/sh -c "sleep 1 && /usr/bin/imlib2_grab $filename"                         
exec popup "Screenshot saved to $HOME/$filename"
When you take a screenshot, the editor will open. Type the filename you want, NO extension and NO carriage return.
Click the editors close button, click Save.  You will find  filename.png in your home directory. If you want the change
to survive a reboot, add the line   usr/bin/screenshot.sh   to your   /opt/.filetool.lst   file.
Title: Re: Screenshot- Possible to set 'saved to' File-name?
Post by: newtotinycore on March 27, 2012, 02:23:58 AM
Thanks Maro for telling me the complete path : /usr/local/bin/screenshot.sh. It doesn't take much to throw me off course.

And thanks for the complete explanation, Rich; works great!
Looking at the code was very helpful.

In case any other newbies are interested in this change, on my system what works is:
filename=`cat /tmp/savename.txt  "+%d"`.png
Title: Re: Screenshot- Possible to set 'saved to' File-name?
Post by: newtotinycore on March 27, 2012, 06:10:16 PM
                 Trying same modification to screenshot.sh in tinycore 4.3 that worked in 4.1.
                 When I try to save changes to screenshot.sh, get message "Error writing to file 'screenshot':
                 Read-only file system."
                 Tried opening file with sudo and using chmod on screenshot.sh and link under /tmp/tcloop..., also tried sudo su and then chown.
                 No luck, still read only file system.
                 Maybe it's not worth trying to change screenshot behavior- but I am curious if I messed up when installing 4.3 to USB.
                 I used ext 2.

                Thanks for any pointers.
Title: Re: Screenshot- Possible to set 'saved to' File-name?
Post by: gerald_clark on March 27, 2012, 06:41:42 PM
You have to break the symbolic link.
mv screenshot.sh screenshot.org
cp screenshot.org screenshot.sh
Title: Re: Screenshot- Possible to set 'saved to' File-name?
Post by: newtotinycore on March 27, 2012, 07:20:26 PM
Thanks Gerald (and Rich and Maro), works great.