You are not logged in.

#1 2008-11-05 01:43:27

Aprz
Member
From: Newark
Registered: 2008-05-28
Posts: 277

Lil' Screenshot Timer

I'm bored.

$ scrot -cd 5 pic.png
0..1..2..3..4..5..Done!

Anyhow, this is sort of the same:

#!/bin/bash

NUM=0

while [ $NUM -lt $1 ]
do
    sleep 1s
    echo -n "$NUM.."
    NUM=$(( $NUM + 1 ))
done

import -window root $2

echo Done!

It uses import to take a screenshot instead and then it just displays it like scrot would. Um, probably more fun to just do:

$ sleep 5s; import -window root pic.png

But that doesn't display anything pretty and it takes too long to type out and it doesn't a timer, which is why I used to use scrot.

$ NUM=0; while [ $NUM -lt 5 ]; do sleep 1s; echo -n "$NUM.."; NUM=$(( $NUM + 1 )); done; import -window root pic.png; echo Done!

But that's even more time consuming than the other guy and just to get pretty text.

It's only 157 bytes and scrot is 0.04 MB, but I don't know what scrot relies on and why it is so big. This obviously needs bash and import, but what distro doesn't come with import and bash (other than LFS and other build your own distro distros, haha). So I think this is more resourceful.

The only thing that bugs me right now is that there is a delay when it does import (so it's more like 6 seconds rather than 5 seconds when $1 is 5). I think I am going to make it start import earlier and just estimate how long it takes for import to do it's job so the timing is more accurate, but I am worried that the timing will vary on different computers, which it probably does, so not sure at the moment.

I'm bored. :C

Last edited by Aprz (2008-11-05 02:09:45)

Offline

#2 2008-11-08 22:08:18

Cene
Member
From: Laukaa, Finland
Registered: 2008-11-06
Posts: 16
Website

Re: Lil' Screenshot Timer

for i in `seq 0 5`; do echo -n "$i.."; sleep 1; done; echo hi
0..1..2..3..4..5..hi

Offline

Board footer

Powered by FluxBB