svkbd

simple virtual keyboard
git clone git://git.suckless.org/svkbd
Log | Files | Refs | README | LICENSE

commit 1c75314faf5a6d6a9d330b01d50ebbf0cd424b15
parent fc267005ced2251de9e05e62e8a2b42a2712236a
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Fri, 29 May 2020 14:24:17 +0200

cleanup Makefile, add initial man page svkbd.1

Diffstat:
MMakefile | 93+++++++++++++++++++++++++++++++++++++------------------------------------------
AREADME | 44++++++++++++++++++++++++++++++++++++++++++++
DREADME.md | 44--------------------------------------------
Mconfig.mk | 30++++++++----------------------
Asvkbd.1 | 36++++++++++++++++++++++++++++++++++++
Msvkbd.c | 5++++-
6 files changed, 136 insertions(+), 116 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,73 +1,68 @@ # svkbd - simple virtual keyboard # See LICENSE file for copyright and license details. +.POSIX: + +NAME = svkbd +VERSION = 0.1 include config.mk -SRC = svkbd.c +BIN = ${NAME}-${LAYOUT} +SRC = ${NAME}.c +OBJ = ${NAME}-${LAYOUT}.o +MAN1 = ${NAME}.1 -all: options svkbd-${LAYOUT} +all: ${BIN} options: @echo svkbd build options: - @echo "CFLAGS = ${CFLAGS}" - @echo "LDFLAGS = ${LDFLAGS}" + @echo "CFLAGS = ${SVKBD_CFLAGS}" + @echo "CPPLAGS = ${SVKBD_CPPFLAGS}" + @echo "LDFLAGS = ${SVKBD_LDFLAGS}" @echo "CC = ${CC}" -config.h: config.mk - @echo creating $@ from config.def.h - @cp config.def.h $@ +config.h: + cp config.def.h $@ + +${BIN}: config.h ${OBJ} + +${OBJ}: config.h -svkbd-%: layout.%.h config.h ${SRC} - @echo creating layout.h from $< - @cp $< layout.h - @echo CC -o $@ - @${CC} -o $@ ${SRC} ${LDFLAGS} ${CFLAGS} +${OBJ}: + ${CC} -o $@ -c ${SRC} ${SVKBD_CFLAGS} ${SVKBD_CPPFLAGS} + +${BIN}: + ${CC} -o ${BIN} ${OBJ} ${SVKBD_LDFLAGS} clean: - @echo cleaning - @for i in svkbd-*; \ - do \ - if [ -x $$i ]; \ - then \ - rm -f $$i 2> /dev/null; \ - fi \ - done; true - @rm -f ${OBJ} svkbd-${VERSION}.tar.gz 2> /dev/null; true + rm -f ${NAME}-?? ${NAME}-??.o ${OBJ} -dist: clean - @echo creating dist tarball - @mkdir -p svkbd-${VERSION} - @cp LICENSE Makefile README config.def.h config.mk \ - ${SRC} svkbd-${VERSION} - @for i in layout.*.h; \ +dist: + rm -rf "${NAME}-${VERSION}" + mkdir -p "${NAME}-${VERSION}" + cp LICENSE Makefile README config.def.h config.mk ${MAN1} \ + ${SRC} ${NAME}-${VERSION} + for i in layout.*.h; \ do \ - cp $$i svkbd-${VERSION}; \ + cp $$i ${NAME}-${VERSION}; \ done - @tar -cf svkbd-${VERSION}.tar svkbd-${VERSION} - @gzip svkbd-${VERSION}.tar - @rm -rf svkbd-${VERSION} + tar -cf - "${NAME}-${VERSION}" | \ + gzip -c > "${NAME}-${VERSION}.tar.gz" + rm -rf "${NAME}-${VERSION}" install: all - @echo installing executable files to ${DESTDIR}${PREFIX}/bin - @mkdir -p ${DESTDIR}${PREFIX}/bin - @for i in svkbd-*; \ + mkdir -p ${DESTDIR}${PREFIX}/bin + for i in ${NAME}-??; \ do \ - if [ -x $$i ]; \ - then \ - echo CP $$i; \ - cp $$i ${DESTDIR}${PREFIX}/bin; \ - chmod 755 ${DESTDIR}${PREFIX}/bin/$$i; \ - fi \ + cp $$i ${DESTDIR}${PREFIX}/bin; \ + chmod 755 ${DESTDIR}${PREFIX}/bin/$$i; \ done -# @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1 -# @mkdir -p ${DESTDIR}${MANPREFIX}/man1 -# @sed "s/VERSION/${VERSION}/g" < svkbd.1 > ${DESTDIR}${MANPREFIX}/man1/svkbd.1 -# @chmod 644 ${DESTDIR}${MANPREFIX}/man1/svkbd.1 + mkdir -p "${DESTDIR}${MANPREFIX}/man1" + sed "s/VERSION/${VERSION}/g" < ${MAN1} > ${DESTDIR}${MANPREFIX}/man1/${MAN1} + chmod 644 ${DESTDIR}${MANPREFIX}/man1/${MAN1} uninstall: - @echo removing executable files from ${DESTDIR}${PREFIX}/bin - @rm -f ${DESTDIR}${PREFIX}/bin/svkbd-* -# @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1 -# @rm -f ${DESTDIR}${MANPREFIX}/man1/svkbd.1 + rm -f ${DESTDIR}${PREFIX}/bin/${NAME}-?? + rm -f ${DESTDIR}${MANPREFIX}/man1/${MAN1} -.PHONY: all options clean dist install uninstall +.PHONY: all clean dist install uninstall diff --git a/README b/README @@ -0,0 +1,44 @@ +SVKBD +===== +This is a simple virtual keyboard, intended to be used in environments, +where no keyboard is available. + +Installation +------------ + + $ make + $ make install + +This will create by default `svkbd-en`, which is svkbd using an English +keyboard layout. You can create svkbd for additional layouts by doing: + + $ make LAYOUT=$layout + +This will take the file `layout.$layout.h` and create `svkbd-$layout`. +`make install` will then pick up the new file and install it accordingly. + +Usage +----- + + $ svkbd-en + +This will open svkbd at the bottom of the screen, showing the default +English layout. + + $ svkbd-en -d + +This tells svkbd-en to announce itself being a dock window, which then +is managed differently between different window managers. If using dwm +and the dock patch, then this will make svkbd being managed by dwm and +some space of the screen being reserved for it. + + $ svkbd-en -g 400x200+1+1 + +This will start svkbd-en with a size of 400x200 and at the upper left +window corner. + +Repository +---------- + + git clone https://git.suckless.org/svkbd + diff --git a/README.md b/README.md @@ -1,44 +0,0 @@ -SVKBD -===== -This is a simple virtual keyboard, intended to be used in environments, -where no keyboard is available. - -Installation ------------- - - % make - % make install - -This will create by default `svkbd-en`, which is svkbd using an English -keyboard layout. You can create svkbd for additional layouts by doing: - - % make svkbd-$layout - -This will take the file `layout.$layout.h` and create `svkbd-$layout`. -`make install` will then pick up the new file and install it accordingly. - -Usage ------ - - % svkbd-en - -This will open svkbd at the bottom of the screen, showing the default -English layout. - - % svkbd-en -d - -This tells svkbd-en to announce itself being a dock window, which then -is managed differently between different window managers. If using dwm -and the dock patch, then this will make svkbd being managed by dwm and -some space of the screen being reserved for it. - - % svkbd-en -g 400x200+1+1 - -This will start svkbd-en with a size of 400x200 and at the upper left -window corner. - -Repository ----------- - - git clone http://git.suckless.org/svkbd - diff --git a/config.mk b/config.mk @@ -1,31 +1,17 @@ -# svkbd version -VERSION = 0.1 - -LAYOUT ?= en - -# Customize below to fit your system +LAYOUT = en # paths -PREFIX ?= /usr/local +PREFIX = /usr/local MANPREFIX = ${PREFIX}/share/man X11INC = /usr/X11R6/include X11LIB = /usr/X11R6/lib # includes and libs -INCS = -I. -I./layouts -I/usr/include -I${X11INC} -LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 -lXtst - -# flags -CPPFLAGS = -DVERSION=\"${VERSION}\" \ - ${XINERAMAFLAGS} -CFLAGS = -g -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS} -LDFLAGS = -g ${LIBS} - -# Solaris -#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\" -#LDFLAGS = ${LIBS} - -# compiler and linker -CC = cc +INCS = -I. -I./layouts -I${X11INC} +LIBS = -L${X11LIB} -lX11 -lXtst +# use system flags +SVKBD_CFLAGS = ${CFLAGS} +SVKBD_LDFLAGS = ${LDFLAGS} ${LIBS} +SVKBD_CPPFLAGS = ${CPPFLAGS} ${INCS} -DVERSION=\"VERSION\" -DLAYOUT=\"layout.${LAYOUT}.h\" diff --git a/svkbd.1 b/svkbd.1 @@ -0,0 +1,36 @@ +.Dd May 29, 2020 +.Dt SVKBD 1 +.Os +.Sh NAME +.Nm svkbd +.Nd simple virtual keyboard +.Sh SYNOPSIS +.Nm +.Op Fl d +.Op Fl g Ar geometry +.Op Fl h +.Op Fl v +.Sh DESCRIPTION +.Nm +is a simple virtual keyboard, intended to be used in environments, where no +keyboard is available. +.Pp +The options are as follows: +.Bl -tag -width Ds +.It Fl d +Set the _NET_WM_WINDOW_TYPE_DOCK property to hint windowmanagers it is +dockable, by default off. +.It Fl g Ar geometry +Adjust the initial window position or size as specified by the standard X11 +geometry format. +.It Fl h +Show the usage information. +.It Fl v +Show the version information. +.El +.Sh SEE ALSO +.Xr XParseGeometry 3 +.Sh AUTHORS +.An Christoph Lohmann Aq Mt 20h@r-36.net +and +.An Enno Boland Aq Mt gottox@s01.de diff --git a/svkbd.c b/svkbd.c @@ -101,7 +101,10 @@ Bool ispressing = False; /* configuration, allows nested code to access above variables */ #include "config.h" -#include "layout.h" +#ifndef LAYOUT +#error "make sure to define LAYOUT" +#endif +#include LAYOUT void motionnotify(XEvent *e)