2 (c) 2009 by Leon Winter
3 (c) 2009-2011 by Hannes Schueller
4 (c) 2009-2010 by Matto Fransen
5 (c) 2010-2011 by Hans-Peter Deifel
6 (c) 2010-2011 by Thomas Adam
11 /* Vimprobable version number */
12 #define VERSION "1.0.1"
13 #define INTERNAL_VERSION "Vimprobable2/"VERSION
15 /* general settings */
16 char startpage
[MAX_SETTING_SIZE
] = "http://www.vimprobable.org/";
17 char useragent
[MAX_SETTING_SIZE
] = "Vimprobable2/" VERSION
;
18 char acceptlanguage
[MAX_SETTING_SIZE
] = "";
19 static const gboolean enablePlugins
= TRUE
; /* TRUE keeps plugins enabled */
20 static const gboolean enableJava
= TRUE
; /* FALSE disables Java applets */
21 static const gboolean enablePagecache
= FALSE
; /* TRUE turns on the page cache. */
22 static gboolean escape_input_on_load
= TRUE
; /* TRUE will disable automatic focusing of input fields via Javascript*/
25 char statusbgcolor
[MAX_SETTING_SIZE
] = "#000000"; /* background color for status bar */
26 char statuscolor
[MAX_SETTING_SIZE
] = "#ffffff"; /* color for status bar */
27 char sslbgcolor
[MAX_SETTING_SIZE
] = "#b0ff00"; /* background color for status bar with SSL url */
28 char sslinvalidbgcolor
[MAX_SETTING_SIZE
]= "#ff0000"; /* background color for status bar with unverified SSL url */
29 char sslcolor
[MAX_SETTING_SIZE
] = "#000000"; /* color for status bar with SSL url */
31 /* normal, warning, error */
32 static const char *urlboxfont
[] = { "monospace normal 8", "monospace normal 8", "monospace bold 8"};
33 static const char *urlboxcolor
[] = { NULL
, "#ff0000", "#ffffff" };
34 static const char *urlboxbgcolor
[] = { NULL
, NULL
, "#ff0000" };
37 static const char *completionfont
[] = { "monospace normal 8", "monospace bold 8" };
39 static const char *completioncolor
[] = { "#000000", "#ff00ff", "#000000" };
40 /* current row background */
41 static const char *completionbgcolor
[] = { "#ffffff", "#ffffff", "#fff000" };
42 /* pango markup for prefix highliting: opening, closing */
43 #define COMPLETION_TAG_OPEN "<b>"
44 #define COMPLETION_TAG_CLOSE "</b>"
46 static const char statusfont
[] = "monospace bold 8"; /* font for status bar */
47 #define ENABLE_HISTORY_INDICATOR
48 #define ENABLE_INCREMENTAL_SEARCH
49 #define ENABLE_GTK_PROGRESS_BAR
50 #define ENABLE_WGET_PROGRESS_BAR
51 static const int progressbartick
= 20;
52 static const char progressborderleft
= '[';
53 static const char progressbartickchar
= '=';
54 static const char progressbarcurrent
= '>';
55 static const char progressbarspacer
= ' ';
56 static const char progressborderright
= ']';
59 * the handle (first string) contain what the handled links have to start with
60 * the handlers (second string) contain the external applications which should be called for this sort of link
61 * %s can be used as a placeholder for the link argument after the handler
62 * e.g.: "mailto:user@example.org
63 * "handle" is "mailto:"
64 * "%s" will translate to "user@example.org"
66 static URIHandler uri_handlers
[] = {
67 { "mailto:", "x-terminal-emulator -e mutt %s" },
68 { "ftp://", "x-terminal-emulator -e wget ftp://%s" },
72 #define ENABLE_COOKIE_SUPPORT
73 #define COOKIES_STORAGE_FILENAME "%s/vimprobable/cookies", config_base
74 #define COOKIES_STORAGE_READONLY FALSE /* if TRUE new cookies will be lost if you quit */
76 /* downloads directory */
77 #define DOWNLOADS_PATH "%s", getenv("HOME")
80 #define DEFAULT_FONT_SIZE 12
83 #define USER_STYLESHEET "%s/vimprobable/style.css", config_base
86 static gboolean strict_ssl
= TRUE
; /* FALSE will accept any SSL certificate at face value */
87 static char ca_bundle
[MAX_SETTING_SIZE
] = "/etc/ssl/certs/ca-certificates.crt";
90 static const gboolean use_proxy
= TRUE
; /* TRUE if you're going to use a proxy (whose address
91 is specified in http_proxy environment variable), false otherwise */
93 static unsigned int scrollstep
= 40; /* cursor difference in pixel */
94 static unsigned int pagingkeep
= 40; /* pixels kept when paging */
95 #define DISABLE_SCROLLBAR
98 #define ENABLE_MATCH_HIGHLITING
99 static const int searchoptions
= CaseInsensitive
| Wrapping
;
100 gboolean complete_case_sensitive
= TRUE
;
103 static Searchengine searchengines
[] = {
104 { "i", "http://ixquick.com/do/metasearch.pl?query=%s" },
105 { "w", "https://secure.wikimedia.org/wikipedia/en/w/index.php?title=Special%%3ASearch&search=%s&go=Go" },
106 { "wd", "https://secure.wikimedia.org/wikipedia/de/w/index.php?title=Special%%3ASearch&search=%s&go=Go" },
107 { "d", "https://duckduckgo.com/?q=%s&t=Vimprobable" },
108 { "dd", "https://duckduckgo.com/html/?q=%s&t=Vimprobable" },
111 static char defaultsearch
[MAX_SETTING_SIZE
] = "i";
113 /* command mapping */
114 Command commands
[COMMANDSIZE
] = {
115 /* command, function, argument */
116 { "ba", navigate
, {NavigationBack
} },
117 { "back", navigate
, {NavigationBack
} },
118 { "ec", script
, {Info
} },
119 { "echo", script
, {Info
} },
120 { "echoe", script
, {Error
} },
121 { "echoerr", script
, {Error
} },
122 { "fw", navigate
, {NavigationForward
} },
123 { "fo", navigate
, {NavigationForward
} },
124 { "forward", navigate
, {NavigationForward
} },
125 { "javascript", script
, {Silent
} },
126 { "o", open_arg
, {TargetCurrent
} },
127 { "open", open_arg
, {TargetCurrent
} },
129 { "quit", quit
, {0} },
130 { "re", navigate
, {NavigationReload
} },
131 { "re!", navigate
, {NavigationForceReload
} },
132 { "reload", navigate
, {NavigationReload
} },
133 { "reload!", navigate
, {NavigationForceReload
} },
134 { "qt", search_tag
, {0} },
135 { "st", navigate
, {NavigationCancel
} },
136 { "stop", navigate
, {NavigationCancel
} },
137 { "t", open_arg
, {TargetNew
} },
138 { "tabopen", open_arg
, {TargetNew
} },
139 { "print", print_frame
, {0} },
140 { "bma", bookmark
, {0} },
141 { "bookmark", bookmark
, {0} },
142 { "source", view_source
, {0} },
143 { "set", browser_settings
, {0} },
144 { "map", mappings
, {0} },
145 { "jumpleft", scroll
, {ScrollJumpTo
| DirectionLeft
} },
146 { "jumpright", scroll
, {ScrollJumpTo
| DirectionRight
} },
147 { "jumptop", scroll
, {ScrollJumpTo
| DirectionTop
} },
148 { "jumpbottom", scroll
, {ScrollJumpTo
| DirectionBottom
} },
149 { "pageup", scroll
, {ScrollMove
| DirectionTop
| UnitPage
} },
150 { "pagedown", scroll
, {ScrollMove
| DirectionBottom
| UnitPage
} },
151 { "navigationback", navigate
, {NavigationBack
} },
152 { "navigationforward", navigate
, {NavigationForward
} },
153 { "scrollleft", scroll
, {ScrollMove
| DirectionLeft
| UnitLine
} },
154 { "scrollright", scroll
, {ScrollMove
| DirectionRight
| UnitLine
} },
155 { "scrollup", scroll
, {ScrollMove
| DirectionTop
| UnitLine
} },
156 { "scrolldown", scroll
, {ScrollMove
| DirectionBottom
| UnitLine
} },
160 you can use MOUSE_BUTTON_1 to MOUSE_BUTTON_5
162 static Mouse mouse
[] = {
163 /* modmask, modkey, button, function, argument */
164 { 0, 0, MOUSE_BUTTON_2
, paste
, {TargetCurrent
| ClipboardPrimary
| ClipboardGTK
, rememberedURI
} },
165 { GDK_CONTROL_MASK
, 0, MOUSE_BUTTON_2
, paste
, {TargetNew
| ClipboardPrimary
| ClipboardGTK
} },
166 { GDK_CONTROL_MASK
, 0, MOUSE_BUTTON_1
, open_remembered
, {TargetNew
} },
169 /* settings (arguments of :set command) */
170 static Setting browsersettings
[] = {
171 /* public name, internal variable webkit setting integer value? boolean value? colour value? reload page? */
172 { "useragent", useragent
, "user-agent", FALSE
, FALSE
, FALSE
, FALSE
},
173 { "scripts", NULL
, "enable-scripts", FALSE
, TRUE
, FALSE
, FALSE
},
174 { "plugins", NULL
, "enable-plugins", FALSE
, TRUE
, FALSE
, FALSE
},
175 { "pagecache", NULL
, "enable-page-cache", FALSE
, TRUE
, FALSE
, FALSE
},
176 { "java", NULL
, "enable-java-applet", FALSE
, TRUE
, FALSE
, FALSE
},
177 { "images", NULL
, "auto-load-images", FALSE
, TRUE
, FALSE
, FALSE
},
178 { "shrinkimages", NULL
, "auto-shrink-images", FALSE
, TRUE
, FALSE
, FALSE
},
179 { "cursivefont", NULL
, "cursive-font-family", FALSE
, FALSE
, FALSE
, FALSE
},
180 { "defaultencoding", NULL
, "default-encoding", FALSE
, FALSE
, FALSE
, FALSE
},
181 { "defaultfont", NULL
, "default-font-family", FALSE
, FALSE
, FALSE
, FALSE
},
182 { "fontsize", NULL
, "default-font-size", TRUE
, FALSE
, FALSE
, FALSE
},
183 { "monofontsize", NULL
, "default-monospace-font-size", TRUE
, FALSE
, FALSE
, FALSE
},
184 { "caret", NULL
, "enable-caret-browsing", FALSE
, TRUE
, FALSE
, FALSE
},
185 { "fantasyfont", NULL
, "fantasy-font-family", FALSE
, FALSE
, FALSE
, FALSE
},
186 { "minimumfontsize", NULL
, "minimum-font-size", TRUE
, FALSE
, FALSE
, FALSE
},
187 { "monofont", NULL
, "monospace-font-family", FALSE
, FALSE
, FALSE
, FALSE
},
188 { "backgrounds", NULL
, "print-backgrounds", FALSE
, TRUE
, FALSE
, FALSE
},
189 { "sansfont", NULL
, "sans-serif-font-family", FALSE
, FALSE
, FALSE
, FALSE
},
190 { "seriffont", NULL
, "serif-font-family", FALSE
, FALSE
, FALSE
, FALSE
},
191 { "stylesheet", NULL
, "user-stylesheet-uri", FALSE
, FALSE
, FALSE
, FALSE
},
192 { "resizetextareas", NULL
, "resizable-text-areas", FALSE
, TRUE
, FALSE
, FALSE
},
193 { "webinspector", NULL
, "enable-developer-extras", FALSE
, TRUE
, FALSE
, FALSE
},
195 { "homepage", startpage
, "", FALSE
, FALSE
, FALSE
, FALSE
},
196 { "statusbgcolor", statusbgcolor
, "", FALSE
, FALSE
, TRUE
, TRUE
},
197 { "statuscolor", statuscolor
, "", FALSE
, FALSE
, TRUE
, TRUE
},
198 { "sslbgcolor", sslbgcolor
, "", FALSE
, FALSE
, TRUE
, TRUE
},
199 { "sslcolor", sslcolor
, "", FALSE
, FALSE
, TRUE
, TRUE
},
200 { "acceptlanguage", acceptlanguage
, "", FALSE
, FALSE
, FALSE
, FALSE
},
201 { "defaultsearch", defaultsearch
, "", FALSE
, FALSE
, FALSE
, FALSE
},
202 { "qmark", NULL
, "", FALSE
, FALSE
, FALSE
, FALSE
},
203 { "proxy", NULL
, "", FALSE
, TRUE
, FALSE
, FALSE
},
204 { "scrollbars", NULL
, "", FALSE
, TRUE
, FALSE
, FALSE
},
205 { "statusbar", NULL
, "", FALSE
, TRUE
, FALSE
, FALSE
},
206 { "inputbox", NULL
, "", FALSE
, TRUE
, FALSE
, FALSE
},
207 { "completioncase", NULL
, "", FALSE
, TRUE
, FALSE
, FALSE
},
208 { "escapeinput", NULL
, "", FALSE
, TRUE
, FALSE
, FALSE
},
209 { "strictssl", NULL
, "", FALSE
, TRUE
, FALSE
, FALSE
},
210 { "cabundle", ca_bundle
, "", FALSE
, FALSE
, FALSE
, FALSE
},