Quick tip: An OCPD screenshot command

This is the best tip I have for you today.

scrot -q 100 -d 5 `date +%F`-$HOSTNAME-$RANDOM.jpg &

I am one of those unnecessarily persnickety people who likes their screenshots arranged by date, and then by the identity of the machine that took it, and then with some sort of identifier to … identify it. 🙄

You might have noticed that in the file names of screenshots I post here, or you might not. Don’t feel bad if you didn’t. You would be equally persnickety if you did. 🙄

Point is, you can do that rather quickly with scrot and the date command, suffixed by the omnipresent host name variable, plus a random number to separate it from others.

Afterward, I usually change the random number to give me more information. A while back I was using the actual time, down to the second, to arrange them in sequence, but it seemed like overkill.

Jam this into your Openbox right-click menu and you have a point-and-click five-second delay screenshot tool. This is one of those times when ObMenu comes in handy. (Would someone please update that? 😯 )

For IceWM users … well, I’ve never been able to get environment variables working from within the menu or toolbar configuration files, so dump it into a script and trigger the script from your menu.

Unless someone can set me straight on why those don’t seem to work. Cheers if you can. … 😐


6 thoughts on “Quick tip: An OCPD screenshot command

  1. Kaleb Elwert

    I threw together a few bug fixes on ObMenu a while ago but it was really glitchy. The problem is that the program itself is quite glitchy and inconsistent…


    If I remember right, it at least works…

    I think on my new linux install, I might get back into Openbox at which point I’d move this over to my bitbucket account. We’ll see. I just need to get this unfortunate XP install working right now.

  2. llewton

    I won’t be using this in this format as my hostname is “potato” and I’m slightly embarrassed by it.

    But let me say this can be added to the Fluxbox root menu, or bound to key(s). In .fluxbox/menu,

    [exec] (whatever) {scrot -q 100 -d 5 `date +%F`-$HOSTNAME-$RANDOM.jpg &}

    To bind only to the print key this is added to the keys file in .fluxbox

    None Print :ExecCommand scrot -q 100 -d 5 `date +%F`-$HOSTNAME-$RANDOM.jpg &

    The point is it can be bound to a key or keys in Openbox too, and/or added to the xml file that configures OB menu.

    So I could be missing something, but what’s the relevance of Obmenu to this story?

  3. Jeff Bauer

    I’m a devout ratpoison WM user and have had a similar scrot command in ~/.ratpoisonrc for some time now. No menu to call up and select from, either.

    Tap left Win key, tap z key, done.

  4. HilltopYodeler

    Nice little scrot command; thanks for sharing. Instead of using a random number, I like to use the UNIX epoch timestamp (date +%s), which keeps my screenshot images listed in order… like this:

    scrot -q 100 -d 5 `date +%F`-$HOSTNAME-`date +%s`.jpg &

  5. Pingback: Adding the modification time to the beginning of a file name « Motho ke motho ka botho

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s