sprop-0.1/0000755000175000001440000000000012043260044011706 5ustar anselmuserssprop-0.1/Makefile0000644000175000001440000000251612043260044013352 0ustar anselmusers# sprop - simple X property utility include config.mk SRC = sprop.c OBJ = ${SRC:.c=.o} all: options sprop options: @echo sprop build options: @echo "CFLAGS = ${CFLAGS}" @echo "LDFLAGS = ${LDFLAGS}" @echo "CC = ${CC}" .c.o: @echo CC $< @${CC} -c ${CFLAGS} $< ${OBJ}: config.mk sprop: ${OBJ} @echo CC -o $@ @${CC} -o $@ ${OBJ} ${LDFLAGS} clean: @echo cleaning @rm -f sprop ${OBJ} sprop-${VERSION}.tar.gz dist: clean @echo creating dist tarball @mkdir -p sprop-${VERSION} @cp -R LICENSE Makefile README config.mk sprop.1 ${SRC} sprop-${VERSION} @tar -cf sprop-${VERSION}.tar sprop-${VERSION} @gzip sprop-${VERSION}.tar @rm -rf sprop-${VERSION} install: all @echo installing executable file to ${DESTDIR}${PREFIX}/bin @mkdir -p ${DESTDIR}${PREFIX}/bin @cp -f sprop ${DESTDIR}${PREFIX}/bin @chmod 755 ${DESTDIR}${PREFIX}/bin/sprop @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1 @mkdir -p ${DESTDIR}${MANPREFIX}/man1 @sed "s/VERSION/${VERSION}/g" < sprop.1 > ${DESTDIR}${MANPREFIX}/man1/sprop.1 @chmod 644 ${DESTDIR}${MANPREFIX}/man1/sprop.1 uninstall: @echo removing executable file from ${DESTDIR}${PREFIX}/bin @rm -f ${DESTDIR}${PREFIX}/bin/sprop @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1 @rm -f ${DESTDIR}${MANPREFIX}/man1/sprop.1 .PHONY: all options clean dist install uninstall sprop-0.1/README0000644000175000001440000000077212043260044012574 0ustar anselmuserssprop - simple X property utility ================================= Prints/sets window properties in an X server. Requirements ------------ In order to build sprop you need the Xlib header files. Installation ------------ Edit config.mk to match your local setup (sprop is installed into the /usr/local namespace by default). Afterwards enter the following command to build and install sprop (if necessary as root): make clean install Running sprop -------------- See the man page for details. sprop-0.1/config.mk0000644000175000001440000000066412043260044013512 0ustar anselmusers# sprop version VERSION = 0.1 # Customize below to fit your system # paths PREFIX = /usr/local MANPREFIX = ${PREFIX}/share/man X11INC = /usr/X11R6/include X11LIB = /usr/X11R6/lib # includes and libs INCS = -I. -I/usr/include -I${X11INC} LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 # flags CPPFLAGS = -DVERSION=\"${VERSION}\" CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS} LDFLAGS = -s ${LIBS} # compiler and linker CC = cc sprop-0.1/sprop.10000644000175000001440000000066612043260044013143 0ustar anselmusers.TH SPROP 1 sprop\-VERSION .SH NAME sprop \- simple X property utility .SH SYNOPSIS .B sprop .I xid atom .RI [ value ] [\-v] .SH DESCRIPTION .SS Overview The .I sprop utility prints the value of the property .I atom of the window with the given .IR xid , or alternatively sets it to .I value if given. sprop can only interact with atoms which are strings. .SS Options .TP .B \-v prints version information to standard output, then exits. sprop-0.1/LICENSE0000644000175000001440000000210612043260044012712 0ustar anselmusersMIT/X Consortium License © 2010 Connor Lane Smith Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. sprop-0.1/sprop.c0000644000175000001440000000252012043260044013214 0ustar anselmusers#include #include #include #include #include static char *getprop(Atom atom); static void setprop(Atom atom, char *value); static Atom utf8; static Display *dpy; static Window win; int main(int argc, char *argv[]) { char *value = NULL; Atom atom; if(!(dpy = XOpenDisplay(NULL))) { fputs("sprop: cannot open display\n", stderr); return 1; } switch(argc) { case 4: value = argv[3]; case 3: atom = XInternAtom(dpy, argv[2], True); utf8 = XInternAtom(dpy, "UTF8_STRING", True); win = atol(argv[1]); break; case 2: if(!strcmp(argv[1], "-v")) { fputs("sprop-"VERSION", © 2010 Connor Lane Smith\n", stdout); return 0; } default: fprintf(stderr, "usage: sprop [] [-v]\n"); return 1; } if(value) setprop(atom, value); else { if(!(value = getprop(atom))) { fputs("sprop: cannot get atom\n", stderr); return 1; } printf("%s\n", value); XFree(value); } XCloseDisplay(dpy); return 0; } char * getprop(Atom atom) { int di; unsigned long dl; unsigned char *p = NULL; Atom da; XGetWindowProperty(dpy, win, atom, 0, BUFSIZ, False, utf8, &da, &di, &dl, &dl, &p); return (char *)p; } void setprop(Atom atom, char *value) { XChangeProperty(dpy, win, atom, utf8, 8, PropModeReplace, (unsigned char *)value, strlen(value)); }