You are not logged in.
Hello, I'm trying to configure some site specific css styles and followed the instructions here: however compiling ends apruptly in the error mentioned in the title of this thread (unknown type name 'SiteStyle'). So what am I missing? Note: I'm not a programmer and normally don't mess around with source codes and such, and if I do, I follow step by step instructions. Any help = cool beans with awesome sauce (my favorite meal ;D)
Offline
How are you building surf? An AUR package, or via ABS? If it's an AUR package, which one (surf-git maybe)?
How do you edit the config file, and what are the steps (commands) used to build and install the new package?
Can you compile surf without making changes? The SiteStyle array is already present in both surf in abs and surf-git in the AUR. Simply adding new lines to the existing array couldn't possiby produce the error you are seeing if building without adding the lines works.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I did nothing special really, except for adding code for different features e. g. for adding and viewing bookmarks, etc. It compiled fine that way. I either downloaded it straight from git or downloaded the source with aurget (program) -o. I quite honestly don't remember anymore. I'm talking about version 0.6 by the way.
I simply just popped in the code for the site styles before the hotkeys segment. Here's the complete config.h. It's a bit messy, but as I said, I'm not a coder.
/* modifier 0 means no modifier */ static char *useragent = "Surf/5.0 (Windows NT 6.$
"AppleWebKit/537.15 (KHTML, like Gecko) Chrome/24.0.1295.0 "
"Safari/537.15 Surf/"VERSION;
static char *progress = "#0000FF";
static char *progress_untrust = "#FF0000";
static char *progress_trust = "#00FF00";
static char *progress_proxy = "#FFFF00";
static char *progress_proxy_trust = "#66FF00";
static char *progress_proxy_untrust = "#FF6600";
static char *stylefile = "~/.surf/style.css";
static char *scriptfile = "~/.surf/script.js";
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 int indicator_thickness = 2;
/* Regular expressions to match URLs that should not be loaded */
char *filter_patterns[] = {
#include "filters_compiled"
};
/* Define this for verbose filtering */
// #define FILTER_VERBOSE
/* Webkit default features */
static Bool enablespatialbrowsing = TRUE;
static Bool enableplugins = TRUE;
static Bool enablescripts = TRUE;
static Bool enableinspector = TRUE;
static Bool loadimages = TRUE;
static Bool hidebackground = FALSE;
/* Quick searching. */
#define QSEARCH { \
.v = (char *[]){"/bin/sh", "-c", "$HOME/.surf/surf_qsearch $0 $1", winid, NULL }$
}
#define SETPROP(p, q) { \
.v = (char *[]){ "/bin/sh", "-c", \
"prop=\"`xprop -id $2 $0 | cut -d '\"' -f 2 | dmenu`\" &&" \
"xprop -id $2 -f $1 8s -set $1 \"$prop\"", \
p, q, winid, NULL \
} \
}
#define SELNAV { \
.v = (char *[]){ "/bin/sh", "-c", \
"prop=\"`xprop -id $0 _SURF_HIST" \
" | sed -e 's/^.[^\"]*\"//' -e 's/\"$//' -e 's/\\\\\\n/\\n/g'" \
" | dmenu -i -l 10`\"" \
" && xprop -id $0 -f _SURF_NAV 8s -set _SURF_NAV \"$prop\"", \
winid, NULL \
} \
}
/* DOWNLOAD(URI, referer) */
#define DOWNLOAD(d, r) { \
.v = (char *[]){ "/bin/sh", "-c", \
"xterm -e /bin/sh -c \"curl -J -O --user-agent '$1'" \
" --referer '$2'" \
" -b ~/.surf/cookies.txt -c ~/.surf/cookies.txt '$0';" \
" sleep 5;\"", \
d, useragent, r, NULL \
} \
}
#define BM_PICK { .v = (char *[]){ "/bin/sh", "-c", \
"xprop -id $0 -f _SURF_GO 8s -set _SURF_GO \
`cat ~/.surf/bookmarks | dmenu || exit 0`", \
winid, NULL } }
#define BM_ADD { .v = (char *[]){ "/bin/sh", "-c", \
"(echo `xprop -id $0 _SURF_URI | cut -d '\"' -f 2` && \
cat ~/.surf/bookmarks) | sort -u > ~/.surf/bookmarks_new && \
mv ~/.surf/bookmarks_new ~/.surf/bookmarks", \
winid, NULL } }
#define WATCH {.v = (char *[]){ "/bin/sh", "-c", \
"exec \
yt $(xprop -id $0 _SURF_URI | cut -d \\\" -f 2)", \
winid, NULL } }
/* styles */
static SiteStyle styles [] = {
/* regexp file in $styledir */
{ ".*www.google.com.*", "google.css" };
{ ".*www.gmail.com.*", "gmail.css" };
{ ".*www.facebook.com.*", "facebook.css" };
{ ".*www.youtube.com.*", "youtube.css" };
};
#define MODKEY GDK_CONTROL_MASK
/* hotkeys */
/*
* If you use anything else but MODKEY and GDK_SHIFT_MASK, don't forget to
* edit the CLEANMASK() macro.
*/
static Key keys[] = {
/* modifier keyval function arg Focus */
{ MODKEY, GDK_q, spawn, QSEA$
{ MODKEY, GDK_w, spawn, WATCH },
{ MODKEY, GDK_b, spawn, BM_PICK },
{ MODKEY|GDK_SHIFT_MASK,GDK_b, spawn, BM_ADD },
{ MODKEY|GDK_SHIFT_MASK,GDK_r, reload, { .b = TRUE } },
{ MODKEY, GDK_r, reload, { .b = FALSE } },
{ MODKEY|GDK_SHIFT_MASK,GDK_p, print, { 0 } },
{ MODKEY, GDK_p, clipboard, { .b = TRUE } },
{ MODKEY, GDK_y, clipboard, { .b = FALSE } },
{ MODKEY|GDK_SHIFT_MASK,GDK_j, zoom, { .i = -1 } },
{ MODKEY|GDK_SHIFT_MASK,GDK_k, zoom, { .i = +1 } },
{ MODKEY|GDK_SHIFT_MASK,GDK_q, zoom, { .i = 0 } },
{ MODKEY, GDK_minus, zoom, { .i = -1 } },
{ MODKEY, GDK_plus, zoom, { .i = +1 } },
{ MODKEY, GDK_l, navigate, { .i = +1 } },
{ MODKEY, GDK_h, navigate, { .i = -1 } },
{ MODKEY|GDK_SHIFT_MASK,GDK_h, selhist, SELNAV },
{ MODKEY, GDK_j, scroll_v, { .i = +1 } },
{ MODKEY, GDK_k, scroll_v, { .i = -1 } },
{ MODKEY|GDK_SHIFT_MASK,GDK_space, scroll_v, { .i = -10000 } },
{ MODKEY, GDK_space, scroll_v, { .i = +10000 } },
{ MODKEY, GDK_i, scroll_h, { .i = +1 } },
{ MODKEY, GDK_u, scroll_h, { .i = -1 } },
{ 0, GDK_F11, fullscreen, { 0 } },
{ 0, GDK_Escape, stop, { 0 } },
{ MODKEY, GDK_o, source, { 0 } },
{ MODKEY|GDK_SHIFT_MASK,GDK_o, inspector, { 0 } },
{ MODKEY, GDK_g, spawn, SETPROP("_SURF_URI", "_SURF_GO")$
{ MODKEY, GDK_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIN$
{ MODKEY, GDK_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIN
{ MODKEY, GDK_n, find, { .b = TRUE } },
{ MODKEY|GDK_SHIFT_MASK,GDK_n, find, { .b = FALSE } },
{ MODKEY|GDK_SHIFT_MASK,GDK_c, toggle, { .v = "enable-caret-browsing" }$
{ MODKEY|GDK_SHIFT_MASK,GDK_i, toggle, { .v = "auto-load-images" } },
{ MODKEY|GDK_SHIFT_MASK,GDK_s, toggle, { .v = "enable-scripts" } },
{ MODKEY|GDK_SHIFT_MASK,GDK_v, toggle, { .v = "enable-plugins" } },
};
static char *searchengine = "https://google.com/?q=";Also, is there any way to grow or shrink web sites automatically, depending on the window size?
Last edited by bloodyhell (2016-10-02 21:13:07)
Offline
It's odd that you'd get the error you did from this (please post full output if the following doesn't work) but there is definitely a problem: change the semicolons in the SiteStyle list to commas.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Here's the output of he error message. Replacing the semicolons with commas made a bit of a difference, but still errors out at SiteStyle:
In file included from surf.c:176:0:
config.h:86:8: error: unknown type name 'SiteStyle'
static SiteStyle styles [] = {
^~~~~~~~~
config.h:88:5: warning: braces around scalar initializer
{ ".*www.google.com.*", "google.css" },
^
config.h:88:5: note: (near initialization for 'styles[0]')
config.h:88:7: warning: initialization makes integer from pointer without a cast [-Wint-conversion]
{ ".*www.google.com.*", "google.css" },
^~~~~~~~~~~~~~~~~~~~
config.h:88:7: note: (near initialization for 'styles[0]')
config.h:88:29: warning: excess elements in scalar initializer
{ ".*www.google.com.*", "google.css" },
^~~~~~~~~~~~
config.h:88:29: note: (near initialization for 'styles[0]')
config.h:89:5: warning: braces around scalar initializer
{ ".*www.gmail.com.*", "gmail.css" },
^
config.h:89:5: note: (near initialization for 'styles[1]')
config.h:89:7: warning: initialization makes integer from pointer without a cast [-Wint-conversion]
{ ".*www.gmail.com.*", "gmail.css" },
^~~~~~~~~~~~~~~~~~~
config.h:89:7: note: (near initialization for 'styles[1]')
config.h:89:28: warning: excess elements in scalar initializer
{ ".*www.gmail.com.*", "gmail.css" },
^~~~~~~~~~~
config.h:89:28: note: (near initialization for 'styles[1]')
config.h:90:5: warning: braces around scalar initializer
{ ".*www.facebook.com.*", "facebook.css" },
^
config.h:90:5: note: (near initialization for 'styles[2]')
config.h:90:7: warning: initialization makes integer from pointer without a cast [-Wint-conversion]
{ ".*www.facebook.com.*", "facebook.css" },
^~~~~~~~~~~~~~~~~~~~~~
config.h:90:7: note: (near initialization for 'styles[2]')
config.h:90:31: warning: excess elements in scalar initializer
{ ".*www.facebook.com.*", "facebook.css" },
^~~~~~~~~~~~~~
config.h:90:31: note: (near initialization for 'styles[2]')
config.h:91:5: warning: braces around scalar initializer
{ ".*www.youtube.com.*", "youtube.css" },
^
config.h:91:5: note: (near initialization for 'styles[3]')
config.h:91:7: warning: initialization makes integer from pointer without a cast [-Wint-conversion]
{ ".*www.youtube.com.*", "youtube.css" },
^~~~~~~~~~~~~~~~~~~~~
config.h:91:7: note: (near initialization for 'styles[3]')
config.h:91:30: warning: excess elements in scalar initializer
{ ".*www.youtube.com.*", "youtube.css" },
^~~~~~~~~~~~~
config.h:91:30: note: (near initialization for 'styles[3]')
surf.c:1180:1: warning: 'eval' defined but not used [-Wunused-function]
eval(Client *c, const Arg *arg) {
^~~~
In file included from surf.c:176:0:
config.h:149:14: warning: 'searchengine' defined but not used [-Wunused-variable]
static char *searchengine = "https://google.com/?q=";
^~~~~~~~~~~~
config.h:86:18: warning: 'styles' defined but not used [-Wunused-variable]
static SiteStyle styles [] = {
^~~~~~
make: *** [Makefile:19: surf.o] Error 1Hope that helps.
Offline
"In file included from surf.c:176:0:" That's odd. But then I re-read the thread and you said this is surf v 0.6?? Where are you getting it? 0.6 isn't in the repos or AUR.
This would be the problem, SiteStyles was not added until 0.7 (and 0.7 has been out for 9 months!)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Hmmm, I suppose it's about time for an update then? I believe I might have either downloaded it straight from git or off their site after all. So if what you say is the problem then I'll give 0.7 a spin with my custom config file and see what happens. I will report back with the results.
Offline
setstyle() was added in 0.7: http://git.suckless.org/surf/commit/?id … a74a260148
Offline