Bug 125369 - [new port] x11/printscreen: simple screenshot program for X11
Summary: [new port] x11/printscreen: simple screenshot program for X11
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Felippe de Meirelles Motta
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-07 14:50 UTC by Alex Kozlov
Modified: 2008-07-26 18:10 UTC (History)
0 users

See Also:


Attachments
file.shar (1.80 KB, text/plain)
2008-07-07 14:50 UTC, Alex Kozlov
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Kozlov 2008-07-07 14:50:06 UTC
Add new port: simple screenshot program for X11

Fix: Patch attached with submission follows:
Comment 1 Dmitry Marakasov freebsd_committer freebsd_triage 2008-07-07 21:16:27 UTC
Responsible Changed
From-To: freebsd-ports-bugs->amdmi3

I'll take it.
Comment 2 Dmitry Marakasov freebsd_committer freebsd_triage 2008-07-07 21:43:46 UTC
State Changed
From-To: open->feedback

This port duplicates existing functionality.  How is this different from 
ImageMagick's import or graphics/scrot?
Comment 3 Alex Kozlov 2008-07-08 00:29:34 UTC
On Mon, Jul 07, 2008 at 08:47:44PM +0000, amdmi3@FreeBSD.org wrote:
> Synopsis: [new port] x11/printscreen: simple screenshot program for X11
> 
> State-Changed-From-To: open->feedback
> State-Changed-By: amdmi3
> State-Changed-When: Mon Jul 7 20:43:46 UTC 2008
> State-Changed-Why: 
> This port duplicates existing functionality.  How is this different from
> ImageMagick's import or graphics/scrot?
I guess this is just yet another way to get screenshot.

It's uses netpbm instead of bloated ImageMagick, supported way more
formats that scrot, very simple.

However, thanks for feedback. I just add some basic functionality like
delay and output formats:


# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	printscreen
#	printscreen/files
#	printscreen/files/printscreen.in
#	printscreen/Makefile
#	printscreen/pkg-descr
#
echo c - printscreen
mkdir -p printscreen > /dev/null 2>&1
echo c - printscreen/files
mkdir -p printscreen/files > /dev/null 2>&1
echo x - printscreen/files/printscreen.in
sed 's/^X//' >printscreen/files/printscreen.in << 'END-of-printscreen/files/printscreen.in'
X#!/bin/sh 
X
XPATH=/bin:%%PREFIX%%/bin
X
XINFMT=pnm
XOUTFMT=png
XSTOREDIR="${HOME}/.screenshots"
XSHOTDATE="$(date +%Y.%m.%d-%H.%M.%S)"
X
Xparse_options()
X{
X	local OPT OPTARG OPTIND fmt
X
X	while getopts d:f:h OPT; do
X		# escape meta
X		OPTARG=${OPTARG%%[;\\\$]*}
X		case ${OPT} in
X		d)	delay="${OPTARG}" ;;
X		f)
X			OUTFMT="${OPTARG}"
X			unset INFMT
X
X			for fmt in pnm pbm pgm ppm; do
X				if [ -x %%PREFIX%%/bin/${fmt}to${OUTFMT} ]; then
X					INFMT=${fmt}
X					break
X				fi
X			done
X
X			if [ -z "${INFMT}" ]; then
X				usage
X			fi
X			;;
X		h)	usage ;;
X		esac
X	done
X
X	OPTC=$((${OPTIND} - 1))
X}
X
Xusage()
X{
X	echo "usage: ${0##*/} [-d sec] [-f outfmt] [shotname]"
X	echo
X	exit 1
X}
X
Xparse_options ${1+"$@"}
Xshift ${OPTC}
X
Xif [ -z ${@+1} ]; then
X	SHOTNAME="${STOREDIR}/screenshot-${SHOTDATE}.${OUTFMT}"
Xelse
X	SHOTNAME=$1
X	shift
X
X	if [ ! -z ${@+1} ]; then
X		usage
X	fi
Xfi
X
Xif [ ! -d "${STOREDIR}" ]; then
X	mkdir "${STOREDIR}"
Xfi 
X
Xif [ -n "${delay}" ]; then
X	sleep ${delay}
Xfi
X
Xxwd -root | xwdtopnm 2>/dev/null | "${INFMT}to${OUTFMT}" 2>/dev/null > "${SHOTNAME}"
END-of-printscreen/files/printscreen.in
echo x - printscreen/Makefile
sed 's/^X//' >printscreen/Makefile << 'END-of-printscreen/Makefile'
X# New ports collection makefile for:	printscreen
X# Date created:	25 Jan 2006
X# Whom:	Alex Kozlov <spam@rm-rf.kiev.ua>
X#
X# $FreeBSD$
X#
X
XPORTNAME=	printscreen
XPORTVERSION=	1.1
XCATEGORIES=	x11
XDISTFILES=
X
XMAINTAINER=	spam@rm-rf.kiev.ua
XCOMMENT=	Simple screenshot program for X11
X
XRUN_DEPENDS=	xwd:${PORTSDIR}/x11/xwd \
X		xwdtopnm:${PORTSDIR}/graphics/netpbm
X
XNO_BUILD=	yes
X
XSUB_FILES=	printscreen
X
XPLIST_FILES=	bin/printscreen
X
Xdo-install:
X	@${INSTALL_SCRIPT} ${WRKDIR}/printscreen ${PREFIX}/bin/printscreen
X
X.include <bsd.port.mk>
END-of-printscreen/Makefile
echo x - printscreen/pkg-descr
sed 's/^X//' >printscreen/pkg-descr << 'END-of-printscreen/pkg-descr'
XIs a Simple screenshot program for X11
END-of-printscreen/pkg-descr
exit
Comment 4 Alex Kozlov 2008-07-08 03:03:41 UTC
Hi, amdmi3

Sorry, sent wrong version.


# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	printscreen
#	printscreen/files
#	printscreen/files/printscreen.in
#	printscreen/Makefile
#	printscreen/pkg-descr
#
echo c - printscreen
mkdir -p printscreen > /dev/null 2>&1
echo c - printscreen/files
mkdir -p printscreen/files > /dev/null 2>&1
echo x - printscreen/files/printscreen.in
sed 's/^X//' >printscreen/files/printscreen.in << 'END-of-printscreen/files/printscreen.in'
X#!/bin/sh 
X
XPATH=/bin:/usr/bin:%%PREFIX%%/bin
X
Xxwdcommon='-nobdrs'
Xxwdroot='-root'
X
XINFMT=pnm
XOUTFMT=png
XSTOREDIR="${HOME}/.screenshots"
XSHOTDATE="$(date +%Y.%m.%d-%H.%M.%S)"
X
Xparse_options()
X{
X	local OPT OPTARG OPTIND fmt fmtlist i
X
X	while getopts d:f:bhlqs OPT; do
X		# escape meta
X		OPTARG=${OPTARG%%[;\\\$]*}
X
X		case ${OPT} in
X		b)	xwdcommon="${xwdcommon} -frame" ;;
X		d)	delay="${OPTARG}" ;;
X		f)
X			OUTFMT="${OPTARG}"
X			unset INFMT
X
X			for fmt in pnm pbm pgm ppm; do
X				if [ -x %%PREFIX%%/bin/${fmt}to${OUTFMT} ]; then
X					INFMT=${fmt}
X					break
X				fi
X			done
X
X			[ -z "${INFMT}" ] && usage
X			;;
X		l)
X			for i in %%PREFIX%%/bin/p[nbgp]mto*; do
X				fmtlist="${fmtlist} $(echo ${i} | \
X				sed -Ee's:%%PREFIX%%/bin/(pnm|pbm|pgm|ppm)to::')"
X			done
X			echo Supported output formats:
X			echo ${fmtlist}
X			exit 0
X			;;
X		q)	xwdcommon="${xwdcommon} -silent";;
X		s)	unset xwdroot ;;
X		h|*)	usage ;;
X		esac
X	done
X
X	OPTC=$((${OPTIND} - 1))
X}
X
Xusage()
X{
X	echo "usage: ${0##*/} [-bhlqs] [-d sec] [-f outfmt] [shotname]"
X	echo '	-b when selecting a window, grab wm border too'
X	echo '	-d wait sec seconds before taking a shot'
X	echo '	-f set output format'
X	echo '	-h display this help and exit'
X	echo '	-l list output formats'
X	echo '	-q be silent'
X	echo '	-s interactively choose a window'
X	exit 1
X}
X
Xparse_options ${1+"$@"}
Xshift ${OPTC}
X
Xif [ -z ${@+1} ]; then
X	SHOTNAME="${STOREDIR}/screenshot-${SHOTDATE}.${OUTFMT}"
Xelse
X	SHOTNAME=$1
X	shift
X
X	[ -z ${@+1} ] || usage
Xfi
X
X[ -d "${STOREDIR}" ] || mkdir "${STOREDIR}"
X
X[ -n "${delay}" ] && sleep "${delay}"
X
Xxwd ${xwdcommon} ${xwdroot} | xwdtopnm 2>/dev/null | \
X	"${INFMT}to${OUTFMT}" 2>/dev/null > "${SHOTNAME}"
END-of-printscreen/files/printscreen.in
echo x - printscreen/Makefile
sed 's/^X//' >printscreen/Makefile << 'END-of-printscreen/Makefile'
X# New ports collection makefile for:	printscreen
X# Date created:	25 Jan 2006
X# Whom:	Alex Kozlov <spam@rm-rf.kiev.ua>
X#
X# $FreeBSD$
X#
X
XPORTNAME=	printscreen
XPORTVERSION=	1.2
XCATEGORIES=	x11
XDISTFILES=
X
XMAINTAINER=	spam@rm-rf.kiev.ua
XCOMMENT=	Simple screenshot program for X11
X
XRUN_DEPENDS=	xwd:${PORTSDIR}/x11/xwd \
X		xwdtopnm:${PORTSDIR}/graphics/netpbm
X
XNO_BUILD=	yes
X
XSUB_FILES=	printscreen
X
XPLIST_FILES=	bin/printscreen
X
Xdo-install:
X	@${INSTALL_SCRIPT} ${WRKDIR}/printscreen ${PREFIX}/bin/printscreen
X
X.include <bsd.port.mk>
END-of-printscreen/Makefile
echo x - printscreen/pkg-descr
sed 's/^X//' >printscreen/pkg-descr << 'END-of-printscreen/pkg-descr'
XIs a Simple screenshot program for X11
END-of-printscreen/pkg-descr
exit
Comment 5 Dmitry Marakasov freebsd_committer freebsd_triage 2008-07-08 22:11:51 UTC
State Changed
From-To: feedback->closed

Sorry, but I still don't believe this simple script deserves a port.
Comment 6 Alex Kozlov 2008-07-08 22:44:44 UTC
On Tue, Jul 08, 2008 at 09:11:52PM +0000, amdmi3@FreeBSD.org wrote:
> Synopsis: [new port] x11/printscreen: simple screenshot program for X11
> 
> State-Changed-From-To: feedback->closed
> State-Changed-By: amdmi3
> State-Changed-When: Tue Jul 8 21:11:51 UTC 2008
> State-Changed-Why: 
> Sorry, but I still don't believe this simple script deserves a port.
So if I spent another half of hour and rewrite this script in C, he will
begin 'deserves a port'?

Anyway, thanks for You work.


--
Adios
Comment 7 Dmitry Marakasov 2008-07-08 23:24:30 UTC
* Alex Kozlov (spam@rm-rf.kiev.ua) wrote:

> > State-Changed-From-To: feedback->closed
> > State-Changed-By: amdmi3
> > State-Changed-When: Tue Jul 8 21:11:51 UTC 2008
> > State-Changed-Why: 
> > Sorry, but I still don't believe this simple script deserves a port.
> So if I spent another half of hour and rewrite this script in C, he will
> begin 'deserves a port'?
Unlikely, unless it brings in enough useful functionality not present
in existing ports. As for now, one will much more likely use
well-known scrot or import, or run pipeline with xwd by hand. I
myself have 117 scripts of 3..500 lines in ~/bin (any I'm sure many
FreeBSD users do), but I really don't think those may be useful in
ports.

-- 
Dmitry Marakasov   .   55B5 0596 FF1E 8D84 5F56  9510 D35A 80DD F9D2 F77D
amdmi3@amdmi3.ru  ..:  jabber: amdmi3@jabber.ru    http://www.amdmi3.ru
Comment 8 Alex Kozlov 2008-07-09 02:33:23 UTC
On Wed, Jul 09, 2008 at 06:24:30AM, Dmitry Marakasov wrote:
> * Alex Kozlov (spam@rm-rf.kiev.ua) wrote:
> 
> > > State-Changed-From-To: feedback->closed
> > > State-Changed-By: amdmi3
> > > State-Changed-When: Tue Jul 8 21:11:51 UTC 2008
> > > State-Changed-Why: 
> > > Sorry, but I still don't believe this simple script deserves a port.
> > So if I spent another half of hour and rewrite this script in C, he will
> > begin 'deserves a port'?
> Unlikely, unless it brings in enough useful functionality not present
> in existing ports. As for now, one will much more likely use
> well-known scrot or import, or run pipeline with xwd by hand. I
> myself have 117 scripts of 3..500 lines in ~/bin (any I'm sure many
> FreeBSD users do), but I really don't think those may be useful in
> ports.
I think You are discriminating against scripts. ;-)

Ok. I try again.
Now this script has functionality comparable with scrot short of multidisplay
and thumb options. But scrot know too few formats: argb, bmp, jpeg, png, pnm,
tga, tiff. Sometimes I need ps and xpm or even gif for example. import can
handle this, but ImageMagick is too big and bloated.
That why I use xwd + netbpm + this script.

Are You still not convinced about this port usefulness?


By the way, how can I get a list of scrot output formats?   
Not by greping imlib2 loader sources for save* function?
In this script I at least can do printscreen -l 

--
Adios
Comment 9 Dmitry Marakasov 2008-07-09 03:34:38 UTC
* Alex Kozlov (spam@rm-rf.kiev.ua) wrote:

> I think You are discriminating against scripts. ;-)
I'm against pulluting portstree with stuff that you can do with a
single pipe.

-- 
Dmitry Marakasov   .   55B5 0596 FF1E 8D84 5F56  9510 D35A 80DD F9D2 F77D
amdmi3@amdmi3.ru  ..:  jabber: amdmi3@jabber.ru    http://www.amdmi3.ru
Comment 10 Alex Kozlov 2008-07-09 03:45:21 UTC
On Wed, Jul 09, 2008 at 06:34:38AM +0400, Dmitry Marakasov wrote:
> * Alex Kozlov (spam@rm-rf.kiev.ua) wrote:
> 
> > I think You are discriminating against scripts. ;-)
> I'm against pulluting portstree with stuff that you can do with a
> single pipe.
In that case can You please reopen this pr and return it in pool.
Thank You.


--
Adios
Comment 11 Dmitry Marakasov freebsd_committer freebsd_triage 2008-07-09 03:50:27 UTC
State Changed
From-To: closed->open

Reopen at submitters request
Comment 12 Dmitry Marakasov freebsd_committer freebsd_triage 2008-07-09 03:51:29 UTC
Responsible Changed
From-To: amdmi3->freebsd-ports-bugs

Back to pool
Comment 13 Pietro Cerutti freebsd_committer freebsd_triage 2008-07-09 12:50:19 UTC
Responsible Changed
From-To: gahr->freebsd-ports-bugs

Sorry, picked up the wrong one.
Comment 14 Felippe de Meirelles Motta freebsd_committer freebsd_triage 2008-07-19 05:12:04 UTC
Responsible Changed
From-To: freebsd-ports-bugs->lippe

I'll take it.
Comment 15 dfilter service freebsd_committer freebsd_triage 2008-07-26 18:03:13 UTC
lippe       2008-07-26 17:02:59 UTC

  FreeBSD ports repository

  Added files:
    x11/printscreen      Makefile pkg-descr 
    x11/printscreen/files printscreen.in 
  Log:
  printscreen - Simple screenshot program for X11.
  
  PR:             ports/125369
  Submitted by:   Alex Kozlov <spam@rm-rf.kiev.ua>
  Approved by:    gabor (mentor, implicit)
  
  Revision  Changes    Path
  1.1       +27 -0     ports/x11/printscreen/Makefile (new)
  1.1       +13 -0     ports/x11/printscreen/files/printscreen.in (new)
  1.1       +1 -0      ports/x11/printscreen/pkg-descr (new)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 16 Felippe de Meirelles Motta freebsd_committer freebsd_triage 2008-07-26 18:07:08 UTC
State Changed
From-To: open->closed

Committed. Thanks!