summaryrefslogtreecommitdiffstats
path: root/surf.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--surf.c48
1 files changed, 36 insertions, 12 deletions
diff --git a/surf.c b/surf.c
index 2431a8d..8a36d21 100644
--- a/surf.c
+++ b/surf.c
@@ -62,6 +62,7 @@ static gboolean showxid = FALSE;
static int ignorexprop = 0;
static char winid[64];
static char *progname;
+static gboolean loadimage = 1, plugin = 1, script = 1;
static char *buildpath(const char *path);
static void cleanup(void);
@@ -535,6 +536,9 @@ newclient(void) {
g_object_set(G_OBJECT(settings), "user-agent", ua, NULL);
uri = g_strconcat("file://", stylefile, NULL);
g_object_set(G_OBJECT(settings), "user-stylesheet-uri", uri, NULL);
+ g_object_set(G_OBJECT(settings), "auto-load-images", loadimage, NULL);
+ g_object_set(G_OBJECT(settings), "enable-plugins", plugin, NULL);
+ g_object_set(G_OBJECT(settings), "enable-scripts", script, NULL);
g_free(uri);
setatom(c, findprop, "");
setatom(c, uriprop, "");
@@ -560,7 +564,7 @@ static void newrequest(SoupSession *s, SoupMessage *msg, gpointer v) {
void
newwindow(Client *c, const Arg *arg) {
guint i = 0;
- const char *cmd[7], *uri;
+ const char *cmd[10], *uri;
const Arg a = { .v = (void *)cmd };
char tmp[64];
@@ -570,6 +574,15 @@ newwindow(Client *c, const Arg *arg) {
snprintf(tmp, LENGTH(tmp), "%u\n", (int)embed);
cmd[i++] = tmp;
}
+ if(!script) {
+ cmd[i++] = "-s";
+ }
+ if(!plugin) {
+ cmd[i++] = "-p";
+ }
+ if(!loadimage) {
+ cmd[i++] = "-l";
+ }
if(showxid) {
cmd[i++] = "-x";
}
@@ -791,7 +804,7 @@ updatewinid(Client *c) {
void
usage(void) {
fputs("surf - simple browser\n", stderr);
- die("usage: surf [-e Window] [-x] [uri]\n");
+ die("usage: surf [-e Window] [-x] [-i] [-p] [-s] [uri]\n");
}
void
@@ -826,23 +839,34 @@ int main(int argc, char *argv[]) {
progname = argv[0];
/* command line args */
- for(i = 1, arg.v = NULL; i < argc && argv[i][0] == '-'; i++) {
- if(!strcmp(argv[i], "-x"))
+ for(i = 1, arg.v = NULL; i < argc && argv[i][0] == '-' &&
+ argv[i][1] != '\0' && argv[i][2] == '\0'; i++) {
+ if(!strcmp(argv[i], "--")) {
+ i++;
+ break;
+ }
+ switch(argv[i][1]) {
+ case 'x':
showxid = TRUE;
- else if(!strcmp(argv[i], "-e")) {
+ break;
+ case 'e':
if(++i < argc)
embed = atoi(argv[i]);
else
usage();
- }
- else if(!strcmp(argv[i], "--")) {
- i++;
break;
- }
- else if(!strcmp(argv[i], "-v"))
+ case 'i':
+ loadimage = 0;
+ break;
+ case 'p':
+ plugin = 0;
+ break;
+ case 's':
+ script = 0;
+ break;
+ case 'v':
die("surf-"VERSION", © 2009 surf engineers, see LICENSE for details\n");
- else
- usage();
+ }
}
if(i < argc)
arg.v = argv[i];
'Gravatar' /> Christoph Lohmann 1-0/+4 Thanks quing for noticing. 2015-01-18My CMD was too short. :OGravatar Christoph Lohmann 1-1/+1 Thanks Carlos Torres for mentioning this. 2015-01-17Add the manpage changes for the disk cache support.Gravatar Christoph Lohmann 1-1/+7 2015-01-17Adding disk cache support for soup.Gravatar Christoph Lohmann 2-9/+40 This is a merge of the patch of Ben Woolley <tautolog@gmail.com> 2015-01-17Fix extra newline, and add -g where other switches are forwarded.Gravatar Ben Woolley 1-1/+3 Signed-off-by: Christoph Lohmann <20h@r-36.net> 2015-01-17Newer libc want _DEFAULT_SOURCE.Gravatar Christoph Lohmann 1-1/+1 2015-01-17Major styles update.Gravatar Christoph Lohmann 3-11/+84 In config.h there is now some styles array to apply site-specific styles. This can be toggled using the -mM flags. If a stylefile is manually specified, then this will overwrite everything. 2015-01-02Fix a typo in surf manual.Gravatar Jakukyo Friel 1-1/+1 `Ctrl-/` displays incorrectly in `man surf` on my machine. A patch is attached. (You also access it here: https://github.com/weakish/surf/commit/07e97eccedd96eabf14b2fbf77de75ec1b594d97) ---- surf.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Signed-off-by: Christoph Lohmann <20h@r-36.net> 2014-09-28Minor style change.Gravatar Christoph Lohmann 1-1/+1 2014-09-28Make »Copy image address« work.Gravatar Christoph Lohmann 1-3/+10 Thanks yui@blekksprut.net for the patch! 2014-08-07Mention xdotool in SEE ALSO too.Gravatar Christoph Lohmann 1-1/+2 2014-08-07Fix the manpage about xid.Gravatar Christoph Lohmann 1-1/+3 Something was missing from this one sentence. Now it is complete.