commit e23caa6e2da17e57de52d846d4c1bd8f0a2d2ff9
parent b038d6e825b44c91514ce19bb54a362be1264a67
Author: Christian Hesse <mail@eworm.de>
Date: Sun, 10 Mar 2013 13:53:02 +0100
add kioskmode to files and patches
Diffstat:
3 files changed, 169 insertions(+), 0 deletions(-)
diff --git a/surf.suckless.org/files/kioskmode.md b/surf.suckless.org/files/kioskmode.md
@@ -0,0 +1,74 @@
+kiosk mode
+==========
+
+Description
+-----------
+
+With these steps you can change your system into a kiosk mode terminal.
+Please note that you do not have any access to the system but the web
+browser. To undo the changes you need a rescue system.
+
+Software
+--------
+
+This software has to be installed on the system for my whoto to work:
+
+* 'lxdm' login manager
+* 'i3' window manager
+* 'surf' web browser
+
+Feel free to use other components if desired.
+
+I do apply a patch to 'surf' that adds parameter '-k' and disables all
+key strokes. See the [patches](../patches/kioskmode) section for the patch.
+
+Basic setup
+-----------
+
+We have to ensure that the basic system can not be altered, so we lock
+all user accounts ('root' and 'kiosk' in this example):
+
+ passwd -l root
+ passwd -l kiosk
+
+Additionally we create a file '/etc/X11/xorg.conf.d/15-no-vt.conf'.
+
+ Section "ServerFlags"
+ Option "DontVTSwitch" "True"
+ EndSection
+
+Now X.org does not allow to change to the virtual terminal via
+'Ctrl-Alt-F1'.
+
+Login manager
+-------------
+
+As the accounts are locked we need to enable auto login in the login
+manager. To make sure the correct window manager is started we add this
+in '/etc/lxdm/lxdm.cond', too.
+
+ autologin=kiosk
+ session=i3
+
+Window manager
+--------------
+
+The window manager 'i3' is locked down to just start web browser 'surf'
+with parameter '-k' in fullscreen mode. All key strokes are disallowed,
+except Ctrl+Shift+C to poweroff the system (via 'systemd'). Save the
+following file to '/home/kiosk/.i3/config':
+
+ set $mod Mod4
+
+ # shut down system with systemd/polkit
+ bindsym Control+Shift+E exec /usr/bin/systemctl poweroff
+
+ for_window [title="surf"] fullscreen enable
+ exec /usr/bin/surf -k http://surf.suckless.org/
+
+Now reboot your system and have fun. ;)
+
+Author
+------
+
+* Christian Hesse <mail@eworm.de>
diff --git a/surf.suckless.org/patches/kioskmode.md b/surf.suckless.org/patches/kioskmode.md
@@ -0,0 +1,18 @@
+kiosk mode
+==========
+
+Description
+-----------
+
+This patch adds a new command parameter '-k' which disables all key
+strokes within surf. Text input on websites is still possible though.
+
+Download
+--------
+
+* [surf-kiosk.diff](surf-kiosk.diff) (.2k) (20130310)
+
+Author
+------
+
+* Christian Hesse <mail@eworm.de>
diff --git a/surf.suckless.org/patches/surf-kiosk.diff b/surf.suckless.org/patches/surf-kiosk.diff
@@ -0,0 +1,77 @@
+diff --git a/config.def.h b/config.def.h
+index d9a2be9..adfa7a6 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -8,6 +8,7 @@ static char *cookiefile = "~/.surf/cookies.txt";
+ static time_t sessiontime = 3600;
+ static char *cafile = "/etc/ssl/certs/ca-certificates.crt";
+ static char *strictssl = FALSE; /* Refuse untrusted SSL connections */
++static Bool kioskmode = FALSE;
+
+ /* Webkit default features */
+ static Bool enablescrollbars = TRUE;
+diff --git a/surf.1 b/surf.1
+index 97c00f0..6b8e233 100644
+--- a/surf.1
++++ b/surf.1
+@@ -32,6 +32,9 @@ Reparents to window specified by
+ .B \-i
+ Disable Images
+ .TP
++.B \-k
++Enable kiosk mode (disable key stokes)
++.TP
+ .B \-n
+ Disable the Web Inspector (Developer Tools).
+ .TP
+diff --git a/surf.c b/surf.c
+index 214b9c7..06d6767 100644
+--- a/surf.c
++++ b/surf.c
+@@ -644,7 +644,8 @@ newclient(void) {
+ g_signal_connect(G_OBJECT(c->win),
+ "destroy",
+ G_CALLBACK(destroywin), c);
+- g_signal_connect(G_OBJECT(c->win),
++ if (!kioskmode)
++ g_signal_connect(G_OBJECT(c->win),
+ "key-press-event",
+ G_CALLBACK(keypress), c);
+
+@@ -790,7 +791,7 @@ newclient(void) {
+ static void
+ newwindow(Client *c, const Arg *arg, gboolean noembed) {
+ guint i = 0;
+- const char *cmd[11], *uri;
++ const char *cmd[12], *uri;
+ const Arg a = { .v = (void *)cmd };
+ char tmp[64];
+
+@@ -804,6 +805,8 @@ newwindow(Client *c, const Arg *arg, gboolean noembed) {
+ }
+ if(!loadimages)
+ cmd[i++] = "-i";
++ if(!kioskmode)
++ cmd[i++] = "-k";
+ if(!enableplugins)
+ cmd[i++] = "-p";
+ if(!enablescripts)
+@@ -1180,7 +1183,7 @@ updatewinid(Client *c) {
+
+ static void
+ usage(void) {
+- die("usage: %s [-binpsvx] [-c cookiefile] [-e xid] [-r scriptfile]"
++ die("usage: %s [-biknpsvx] [-c cookiefile] [-e xid] [-r scriptfile]"
+ " [-t stylefile] [-u useragent] [uri]\n", basename(argv0));
+ }
+
+@@ -1226,6 +1229,9 @@ main(int argc, char *argv[]) {
+ case 'i':
+ loadimages = 0;
+ break;
++ case 'k':
++ kioskmode = 1;
++ break;
+ case 'n':
+ enableinspector = 0;
+ break;