commit 1c75314faf5a6d6a9d330b01d50ebbf0cd424b15
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
AuthorDate: Fri May 29 14:24:17 2020 +0200
Commit: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
CommitDate: Fri May 29 14:46:33 2020 +0200
cleanup Makefile, add initial man page svkbd.1
diff --git a/Makefile b/Makefile
index c34b112..a07facd 100644
--- a/Makefile
+++ b/Makefile
_AT_@ -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:
_AT_echo svkbd build options:
- _AT_echo "CFLAGS = ${CFLAGS}"
- _AT_echo "LDFLAGS = ${LDFLAGS}"
+ _AT_echo "CFLAGS = ${SVKBD_CFLAGS}"
+ _AT_echo "CPPLAGS = ${SVKBD_CPPFLAGS}"
+ _AT_echo "LDFLAGS = ${SVKBD_LDFLAGS}"
_AT_echo "CC = ${CC}"
-config.h: config.mk
- _AT_echo creating $@ from config.def.h
- _AT_cp config.def.h $@
+config.h:
+ cp config.def.h $_AT_
+
+${BIN}: config.h ${OBJ}
+
+${OBJ}: config.h
-svkbd-%: layout.%.h config.h ${SRC}
- _AT_echo creating layout.h from $<
- _AT_cp $< layout.h
- _AT_echo CC -o $@
- _AT_${CC} -o $@ ${SRC} ${LDFLAGS} ${CFLAGS}
+${OBJ}:
+ ${CC} -o $_AT_ -c ${SRC} ${SVKBD_CFLAGS} ${SVKBD_CPPFLAGS}
+
+${BIN}:
+ ${CC} -o ${BIN} ${OBJ} ${SVKBD_LDFLAGS}
clean:
- _AT_echo cleaning
- _AT_for i in svkbd-*; \
- do \
- if [ -x $$i ]; \
- then \
- rm -f $$i 2> /dev/null; \
- fi \
- done; true
- _AT_rm -f ${OBJ} svkbd-${VERSION}.tar.gz 2> /dev/null; true
+ rm -f ${NAME}-?? ${NAME}-??.o ${OBJ}
-dist: clean
- _AT_echo creating dist tarball
- _AT_mkdir -p svkbd-${VERSION}
- _AT_cp LICENSE Makefile README config.def.h config.mk \
- ${SRC} svkbd-${VERSION}
- _AT_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
- _AT_tar -cf svkbd-${VERSION}.tar svkbd-${VERSION}
- _AT_gzip svkbd-${VERSION}.tar
- _AT_rm -rf svkbd-${VERSION}
+ tar -cf - "${NAME}-${VERSION}" | \
+ gzip -c > "${NAME}-${VERSION}.tar.gz"
+ rm -rf "${NAME}-${VERSION}"
install: all
- _AT_echo installing executable files to ${DESTDIR}${PREFIX}/bin
- _AT_mkdir -p ${DESTDIR}${PREFIX}/bin
- _AT_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
-# _AT_echo installing manual page to ${DESTDIR}${MANPREFIX}/man1
-# _AT_mkdir -p ${DESTDIR}${MANPREFIX}/man1
-# _AT_sed "s/VERSION/${VERSION}/g" < svkbd.1 > ${DESTDIR}${MANPREFIX}/man1/svkbd.1
-# _AT_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:
- _AT_echo removing executable files from ${DESTDIR}${PREFIX}/bin
- _AT_rm -f ${DESTDIR}${PREFIX}/bin/svkbd-*
-# _AT_echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
-# _AT_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.md b/README
similarity index 86%
rename from README.md
rename to README
index 71ebd1a..f1f2b82 100644
--- a/README.md
+++ b/README
_AT_@ -6,13 +6,13 @@ where no keyboard is available.
Installation
------------
- % make
- % make install
+ $ 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
+ $ 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.
_AT_@ -20,19 +20,19 @@ This will take the file `layout.$layout.h` and create `svkbd-$layout`.
Usage
-----
- % svkbd-en
+ $ svkbd-en
This will open svkbd at the bottom of the screen, showing the default
English layout.
- % svkbd-en -d
+ $ 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
+ $ svkbd-en -g 400x200+1+1
This will start svkbd-en with a size of 400x200 and at the upper left
window corner.
_AT_@ -40,5 +40,5 @@ window corner.
Repository
----------
- git clone
http://git.suckless.org/svkbd
+ git clone
https://git.suckless.org/svkbd
diff --git a/config.mk b/config.mk
index fbb721e..507d1cb 100644
--- a/config.mk
+++ b/config.mk
_AT_@ -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
new file mode 100644
index 0000000..126c6c6
--- /dev/null
+++ b/svkbd.1
_AT_@ -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_AT_r-36.net
+and
+.An Enno Boland Aq Mt gottox_AT_s01.de
diff --git a/svkbd.c b/svkbd.c
index 92ddf23..337f769 100644
--- a/svkbd.c
+++ b/svkbd.c
_AT_@ -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)
Received on Fri May 29 2020 - 14:50:41 CEST