Plan 9 from Bell Labs’s /usr/web/sources/contrib/anothy/bin/rc/grabwin

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc

rfork e

# Grab a window (or the screen, with -s) and convert it to a
# png at a given location, optionally looping. Run with no
# arguments for a usage message.

src=/dev/window
name=$user.$pid

flagfmt='s,n name,d delay'
args='/targ/dir'

if(! ifs=() eval `{aux/getflags $*} || ~ $#* 0){
	aux/usage
	exit usage
}

dir=$1

if (~ $flags 1)
	src=/dev/screen

if (! ~ $#flagn 0)
	name=$flagn(1)

if (~ $#flagd 0)
	topng $src > $dir^/^$name.png
if not
	while () {
		topng $src > $dir^/^$name.png
		sleep $flagd(1)
	}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].