initial commit - wmname - sets/prints window manager name similiar to hostname(… | |
git clone git://git.suckless.org/wmname | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit ac3fe41b9b77964a56da652c3930f5e52dc40668 | |
Author: Anselm R Garbe <[email protected]> | |
Date: Tue, 20 May 2008 15:04:05 +0100 | |
initial commit | |
Diffstat: | |
A LICENSE | 21 +++++++++++++++++++++ | |
A Makefile | 50 +++++++++++++++++++++++++++++… | |
A README | 24 ++++++++++++++++++++++++ | |
A config.mk | 25 +++++++++++++++++++++++++ | |
A setwmname.c | 44 +++++++++++++++++++++++++++++… | |
5 files changed, 164 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/LICENSE b/LICENSE | |
@@ -0,0 +1,21 @@ | |
+MIT/X Consortium License | |
+ | |
+© 2008 Anselm R. Garbe <garbeam at gmail dot com> | |
+ | |
+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. | |
diff --git a/Makefile b/Makefile | |
@@ -0,0 +1,50 @@ | |
+# set wm name - sets the WM name | |
+ | |
+include config.mk | |
+ | |
+SRC = setwmname.c | |
+OBJ = ${SRC:.c=.o} | |
+ | |
+all: options setwmname | |
+ | |
+options: | |
+ @echo setwmname build options: | |
+ @echo "CFLAGS = ${CFLAGS}" | |
+ @echo "LDFLAGS = ${LDFLAGS}" | |
+ @echo "CC = ${CC}" | |
+ @echo "LD = ${LD}" | |
+ | |
+.c.o: | |
+ @echo CC $< | |
+ @${CC} -c ${CFLAGS} $< | |
+ | |
+${OBJ}: config.mk | |
+ | |
+setwmname: ${OBJ} | |
+ @echo LD $@ | |
+ @${LD} -o $@ ${OBJ} ${LDFLAGS} | |
+ @strip $@ | |
+ | |
+clean: | |
+ @echo cleaning | |
+ @rm -f setwmname ${OBJ} setwmname-${VERSION}.tar.gz | |
+ | |
+dist: clean | |
+ @echo creating dist tarball | |
+ @mkdir -p setwmname-${VERSION} | |
+ @cp -R LICENSE Makefile README config.mk ${SRC} setwmname-${VERSION} | |
+ @tar -cf setwmname-${VERSION}.tar setwmname-${VERSION} | |
+ @gzip setwmname-${VERSION}.tar | |
+ @rm -rf setwmname-${VERSION} | |
+ | |
+install: all | |
+ @echo installing executable file to ${DESTDIR}${PREFIX}/bin | |
+ @mkdir -p ${DESTDIR}${PREFIX}/bin | |
+ @cp -f setwmname ${DESTDIR}${PREFIX}/bin | |
+ @chmod 755 ${DESTDIR}${PREFIX}/bin/setwmname | |
+ | |
+uninstall: | |
+ @echo removing executable file from ${DESTDIR}${PREFIX}/bin | |
+ @rm -f ${DESTDIR}${PREFIX}/bin/setwmname | |
+ | |
+.PHONY: all options clean dist install uninstall | |
diff --git a/README b/README | |
@@ -0,0 +1,24 @@ | |
+setwmname - sets the WM name | |
+============================ | |
+Sets the EWMH WM name property to a specified name. | |
+ | |
+ | |
+Requirements | |
+------------ | |
+In order to build setwmname you need the Xlib header files. | |
+ | |
+ | |
+Installation | |
+------------ | |
+Edit config.mk to match your local setup (swarp is installed into | |
+the /usr/local namespace by default). | |
+ | |
+Afterwards enter the following command to build and install swarp (if | |
+necessary as root): | |
+ | |
+ make clean install | |
+ | |
+ | |
+Running setwmname | |
+----------------- | |
+Simply invoke 'setwmname <name>'. | |
diff --git a/config.mk b/config.mk | |
@@ -0,0 +1,25 @@ | |
+# setwmname 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 | |
+CFLAGS = -Os ${INCS} -DVERSION=\"${VERSION}\" | |
+LDFLAGS = ${LIBS} | |
+#CFLAGS = -g -Wall -O2 ${INCS} -DVERSION=\"${VERSION}\" | |
+#LDFLAGS = -g ${LIBS} | |
+ | |
+# compiler and linker | |
+CC = cc | |
+LD = ${CC} | |
diff --git a/setwmname.c b/setwmname.c | |
@@ -0,0 +1,44 @@ | |
+/* See LICENSE file for details. */ | |
+#include <stdarg.h> | |
+#include <stdlib.h> | |
+#include <stdio.h> | |
+#include <string.h> | |
+#include <X11/Xlib.h> | |
+#include <X11/Xatom.h> | |
+#include <X11/Xutil.h> | |
+ | |
+void | |
+eprint(const char *errstr, ...) { | |
+ va_list ap; | |
+ | |
+ va_start(ap, errstr); | |
+ vfprintf(stderr, errstr, ap); | |
+ va_end(ap); | |
+ exit(EXIT_FAILURE); | |
+} | |
+ | |
+int | |
+main(int argc, char **argv) { | |
+ Display *dpy; | |
+ Window root, dummy; | |
+ Atom net_supporting_wm_check, net_wm_name, utf8_string; | |
+ | |
+ if(argc == 2) { | |
+ if(!strncmp(argv[1], "-v", 3)) | |
+ eprint("setwmname-"VERSION", © 2008 Anselm R Garbe\n"… | |
+ } | |
+ else | |
+ eprint("usage: setwmname <name> [-v]\n"); | |
+ | |
+ if(!(dpy = XOpenDisplay(0))) | |
+ eprint("dmenu: cannot open display\n"); | |
+ root = DefaultRootWindow(dpy); | |
+ net_supporting_wm_check = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK",… | |
+ net_wm_name = XInternAtom(dpy, "_NET_WM_NAME", False); | |
+ utf8_string = XInternAtom(dpy, "UTF8_STRING", False); | |
+ XChangeProperty(dpy, root, net_supporting_wm_check, XA_WINDOW, 32, Pro… | |
+ XChangeProperty(dpy, root, net_wm_name, utf8_string, 8, PropModeReplac… | |
+ XSync(dpy, False); | |
+ XCloseDisplay(dpy); | |
+ return 0; | |
+} |