Adding kiosk mode.
Thanks to Christian Hesse <mail@eworm.de>!
This commit is contained in:
parent
fe3bd631d4
commit
badb84387e
|
@ -8,6 +8,7 @@ static char *cookiefile = "~/.surf/cookies.txt";
|
||||||
static time_t sessiontime = 3600;
|
static time_t sessiontime = 3600;
|
||||||
static char *cafile = "/etc/ssl/certs/ca-certificates.crt";
|
static char *cafile = "/etc/ssl/certs/ca-certificates.crt";
|
||||||
static char *strictssl = FALSE; /* Refuse untrusted SSL connections */
|
static char *strictssl = FALSE; /* Refuse untrusted SSL connections */
|
||||||
|
static Bool kioskmode = FALSE; /* Ignore shortcuts */
|
||||||
|
|
||||||
/* Webkit default features */
|
/* Webkit default features */
|
||||||
static Bool enablescrollbars = TRUE;
|
static Bool enablescrollbars = TRUE;
|
||||||
|
|
5
surf.1
5
surf.1
|
@ -3,7 +3,7 @@
|
||||||
surf \- simple webkit-based browser
|
surf \- simple webkit-based browser
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B surf
|
.B surf
|
||||||
.RB [-bipnsvx]
|
.RB [-biknpsvx]
|
||||||
.RB [-c\ cookiefile]
|
.RB [-c\ cookiefile]
|
||||||
.RB [-e\ xid]
|
.RB [-e\ xid]
|
||||||
.RB [-r\ scriptfile]
|
.RB [-r\ scriptfile]
|
||||||
|
@ -32,6 +32,9 @@ Reparents to window specified by
|
||||||
.B \-i
|
.B \-i
|
||||||
Disable Images
|
Disable Images
|
||||||
.TP
|
.TP
|
||||||
|
.B \-k
|
||||||
|
Enable kiosk mode (disable key strokes and right click)
|
||||||
|
.TP
|
||||||
.B \-n
|
.B \-n
|
||||||
Disable the Web Inspector (Developer Tools).
|
Disable the Web Inspector (Developer Tools).
|
||||||
.TP
|
.TP
|
||||||
|
|
19
surf.c
19
surf.c
|
@ -644,9 +644,11 @@ newclient(void) {
|
||||||
g_signal_connect(G_OBJECT(c->win),
|
g_signal_connect(G_OBJECT(c->win),
|
||||||
"destroy",
|
"destroy",
|
||||||
G_CALLBACK(destroywin), c);
|
G_CALLBACK(destroywin), c);
|
||||||
g_signal_connect(G_OBJECT(c->win),
|
if(!kioskmode) {
|
||||||
"key-press-event",
|
g_signal_connect(G_OBJECT(c->win),
|
||||||
G_CALLBACK(keypress), c);
|
"key-press-event",
|
||||||
|
G_CALLBACK(keypress), c);
|
||||||
|
}
|
||||||
|
|
||||||
/* Pane */
|
/* Pane */
|
||||||
c->pane = gtk_vpaned_new();
|
c->pane = gtk_vpaned_new();
|
||||||
|
@ -748,6 +750,8 @@ newclient(void) {
|
||||||
enablespatialbrowsing, NULL);
|
enablespatialbrowsing, NULL);
|
||||||
g_object_set(G_OBJECT(settings), "enable-developer-extras",
|
g_object_set(G_OBJECT(settings), "enable-developer-extras",
|
||||||
enableinspector, NULL);
|
enableinspector, NULL);
|
||||||
|
g_object_set(G_OBJECT(settings), "enable-default-context-menu",
|
||||||
|
kioskmode ^ 1, NULL);
|
||||||
|
|
||||||
if(enableinspector) {
|
if(enableinspector) {
|
||||||
c->inspector = WEBKIT_WEB_INSPECTOR(
|
c->inspector = WEBKIT_WEB_INSPECTOR(
|
||||||
|
@ -790,7 +794,7 @@ newclient(void) {
|
||||||
static void
|
static void
|
||||||
newwindow(Client *c, const Arg *arg, gboolean noembed) {
|
newwindow(Client *c, const Arg *arg, gboolean noembed) {
|
||||||
guint i = 0;
|
guint i = 0;
|
||||||
const char *cmd[11], *uri;
|
const char *cmd[12], *uri;
|
||||||
const Arg a = { .v = (void *)cmd };
|
const Arg a = { .v = (void *)cmd };
|
||||||
char tmp[64];
|
char tmp[64];
|
||||||
|
|
||||||
|
@ -804,6 +808,8 @@ newwindow(Client *c, const Arg *arg, gboolean noembed) {
|
||||||
}
|
}
|
||||||
if(!loadimages)
|
if(!loadimages)
|
||||||
cmd[i++] = "-i";
|
cmd[i++] = "-i";
|
||||||
|
if(!kioskmode)
|
||||||
|
cmd[i++] = "-k";
|
||||||
if(!enableplugins)
|
if(!enableplugins)
|
||||||
cmd[i++] = "-p";
|
cmd[i++] = "-p";
|
||||||
if(!enablescripts)
|
if(!enablescripts)
|
||||||
|
@ -1180,7 +1186,7 @@ updatewinid(Client *c) {
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage(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));
|
" [-t stylefile] [-u useragent] [uri]\n", basename(argv0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1226,6 +1232,9 @@ main(int argc, char *argv[]) {
|
||||||
case 'i':
|
case 'i':
|
||||||
loadimages = 0;
|
loadimages = 0;
|
||||||
break;
|
break;
|
||||||
|
case 'k':
|
||||||
|
kioskmode = 1;
|
||||||
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
enableinspector = 0;
|
enableinspector = 0;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue