2 (c) 2009 by Leon Winter
3 (c) 2009-2012 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.2.0"
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*/
23 char temp_dir
[MAX_SETTING_SIZE
] = "/tmp"; /* location of temporary files, default will be overridden if TEMPDIR is set */
26 char statusbgcolor
[MAX_SETTING_SIZE
] = "#000000"; /* background color for status bar */
27 char statuscolor
[MAX_SETTING_SIZE
] = "#ffffff"; /* color for status bar */
28 char sslbgcolor
[MAX_SETTING_SIZE
] = "#b0ff00"; /* background color for status bar with SSL url */
29 char sslinvalidbgcolor
[MAX_SETTING_SIZE
]= "#ff0000"; /* background color for status bar with unverified SSL url */
30 char sslcolor
[MAX_SETTING_SIZE
] = "#000000"; /* color for status bar with SSL url */
32 /* normal, warning, error */
33 static const char *urlboxfont
[] = { "monospace normal 8", "monospace normal 8", "monospace bold 8"};
34 static const char *urlboxcolor
[] = { NULL
, "#ff0000", "#ffffff" };
35 static const char *urlboxbgcolor
[] = { NULL
, NULL
, "#ff0000" };
38 static const char *completionfont
[] = { "monospace normal 8", "monospace bold 8" };
40 static const char *completioncolor
[] = { "#000000", "#ff00ff", "#000000" };
41 /* current row background */
42 static const char *completionbgcolor
[] = { "#ffffff", "#ffffff", "#fff000" };
43 /* pango markup for prefix highliting: opening, closing */
44 #define COMPLETION_TAG_OPEN "<b>"
45 #define COMPLETION_TAG_CLOSE "</b>"
47 static const char statusfont
[] = "monospace bold 8"; /* font for status bar */
48 #define ENABLE_HISTORY_INDICATOR
49 #define ENABLE_INCREMENTAL_SEARCH
50 #define ENABLE_GTK_PROGRESS_BAR
51 #define ENABLE_WGET_PROGRESS_BAR
52 static const int progressbartick
= 20;
53 static const char progressborderleft
= '[';
54 static const char progressbartickchar
= '=';
55 static const char progressbarcurrent
= '>';
56 static const char progressbarspacer
= ' ';
57 static const char progressborderright
= ']';
60 * the handle (first string) contain what the handled links have to start with
61 * the handlers (second string) contain the external applications which should be called for this sort of link
62 * %s can be used as a placeholder for the link argument after the handler
63 * e.g.: "mailto:user@example.org
64 * "handle" is "mailto:"
65 * "%s" will translate to "user@example.org"
67 static URIHandler uri_handlers
[] = {
68 { "mailto:", "x-terminal-emulator -e mutt %s" },
69 { "vimprobableedit:", "x-terminal-emulator -e vi %s" },
70 { "ftp://", "x-terminal-emulator -e wget ftp://%s" },
74 #define ENABLE_COOKIE_SUPPORT
75 #define COOKIES_STORAGE_FILENAME "%s/vimprobable/cookies", config_base
76 #define COOKIES_STORAGE_READONLY FALSE /* if TRUE new cookies will be lost if you quit */
78 /* downloads directory */
79 #define DOWNLOADS_PATH "%s", getenv("HOME")
82 #define DEFAULT_FONT_SIZE 12
85 #define USER_STYLESHEET "%s/vimprobable/style.css", config_base
88 #define ENABLE_USER_SCRIPTFILE
89 #define USER_SCRIPTFILE "%s/vimprobable/scripts.js", config_base
92 static gboolean strict_ssl
= TRUE
; /* FALSE will accept any SSL certificate at face value */
93 static char ca_bundle
[MAX_SETTING_SIZE
] = "/etc/ssl/certs/ca-certificates.crt";
96 static const gboolean use_proxy
= TRUE
; /* TRUE if you're going to use a proxy (whose address
97 is specified in http_proxy environment variable), false otherwise */
99 static unsigned int scrollstep
= 40; /* cursor difference in pixel */
100 static unsigned int pagingkeep
= 40; /* pixels kept when paging */
101 #define DISABLE_SCROLLBAR
104 #define ENABLE_MATCH_HIGHLITING
105 static const int searchoptions
= CaseInsensitive
| Wrapping
;
106 gboolean complete_case_sensitive
= TRUE
;
109 static Searchengine searchengines
[] = {
110 { "i", "http://ixquick.com/do/metasearch.pl?query=%s" },
111 { "w", "https://secure.wikimedia.org/wikipedia/en/w/index.php?title=Special%%3ASearch&search=%s&go=Go" },
112 { "wd", "https://secure.wikimedia.org/wikipedia/de/w/index.php?title=Special%%3ASearch&search=%s&go=Go" },
113 { "d", "https://duckduckgo.com/?q=%s&t=vimprobable" },
114 { "dd", "https://duckduckgo.com/html/?q=%s&t=vimprobable" },
117 static char defaultsearch
[MAX_SETTING_SIZE
] = "i";
119 /* command mapping */
120 Command commands
[COMMANDSIZE
] = {
121 /* command, function, argument */
122 { "ba", navigate
, {NavigationBack
} },
123 { "back", navigate
, {NavigationBack
} },
124 { "ec", script
, {Info
} },
125 { "echo", script
, {Info
} },
126 { "echoe", script
, {Error
} },
127 { "echoerr", script
, {Error
} },
128 { "fw", navigate
, {NavigationForward
} },
129 { "fo", navigate
, {NavigationForward
} },
130 { "forward", navigate
, {NavigationForward
} },
131 { "javascript", script
, {Silent
} },
132 { "o", open_arg
, {TargetCurrent
} },
133 { "open", open_arg
, {TargetCurrent
} },
135 { "quit", quit
, {0} },
136 { "re", navigate
, {NavigationReload
} },
137 { "re!", navigate
, {NavigationForceReload
} },
138 { "reload", navigate
, {NavigationReload
} },
139 { "reload!", navigate
, {NavigationForceReload
} },
140 { "qt", search_tag
, {0} },
141 { "st", navigate
, {NavigationCancel
} },
142 { "stop", navigate
, {NavigationCancel
} },
143 { "t", open_arg
, {TargetNew
} },
144 { "tabopen", open_arg
, {TargetNew
} },
145 { "print", print_frame
, {0} },
146 { "bma", bookmark
, {0} },
147 { "bookmark", bookmark
, {0} },
148 { "source", view_source
, {0} },
149 { "openeditor", open_editor
, {0} },
150 { "set", browser_settings
, {0} },
151 { "map", mappings
, {0} },
152 { "inspect", open_inspector
, {0} },
153 { "jumpleft", scroll
, {ScrollJumpTo
| DirectionLeft
} },
154 { "jumpright", scroll
, {ScrollJumpTo
| DirectionRight
} },
155 { "jumptop", scroll
, {ScrollJumpTo
| DirectionTop
} },
156 { "jumpbottom", scroll
, {ScrollJumpTo
| DirectionBottom
} },
157 { "pageup", scroll
, {ScrollMove
| DirectionTop
| UnitPage
} },
158 { "pagedown", scroll
, {ScrollMove
| DirectionBottom
| UnitPage
} },
159 { "navigationback", navigate
, {NavigationBack
} },
160 { "navigationforward", navigate
, {NavigationForward
} },
161 { "scrollleft", scroll
, {ScrollMove
| DirectionLeft
| UnitLine
} },
162 { "scrollright", scroll
, {ScrollMove
| DirectionRight
| UnitLine
} },
163 { "scrollup", scroll
, {ScrollMove
| DirectionTop
| UnitLine
} },
164 { "scrolldown", scroll
, {ScrollMove
| DirectionBottom
| UnitLine
} },
168 you can use MOUSE_BUTTON_1 to MOUSE_BUTTON_5
170 static Mouse mouse
[] = {
171 /* modmask, modkey, button, function, argument */
172 { 0, 0, MOUSE_BUTTON_2
, paste
, {TargetCurrent
| ClipboardPrimary
| ClipboardGTK
, rememberedURI
} },
173 { GDK_CONTROL_MASK
, 0, MOUSE_BUTTON_2
, paste
, {TargetNew
| ClipboardPrimary
| ClipboardGTK
} },
174 { GDK_CONTROL_MASK
, 0, MOUSE_BUTTON_1
, open_remembered
, {TargetNew
} },
177 /* settings (arguments of :set command) */
178 static Setting browsersettings
[] = {
179 /* public name, internal variable webkit setting integer value? boolean value? colour value? reload page? */
180 { "useragent", useragent
, "user-agent", FALSE
, FALSE
, FALSE
, FALSE
},
181 { "scripts", NULL
, "enable-scripts", FALSE
, TRUE
, FALSE
, FALSE
},
182 { "plugins", NULL
, "enable-plugins", FALSE
, TRUE
, FALSE
, FALSE
},
183 { "pagecache", NULL
, "enable-page-cache", FALSE
, TRUE
, FALSE
, FALSE
},
184 { "java", NULL
, "enable-java-applet", FALSE
, TRUE
, FALSE
, FALSE
},
185 { "images", NULL
, "auto-load-images", FALSE
, TRUE
, FALSE
, FALSE
},
186 { "shrinkimages", NULL
, "auto-shrink-images", FALSE
, TRUE
, FALSE
, FALSE
},
187 { "cursivefont", NULL
, "cursive-font-family", FALSE
, FALSE
, FALSE
, FALSE
},
188 { "defaultencoding", NULL
, "default-encoding", FALSE
, FALSE
, FALSE
, FALSE
},
189 { "defaultfont", NULL
, "default-font-family", FALSE
, FALSE
, FALSE
, FALSE
},
190 { "fontsize", NULL
, "default-font-size", TRUE
, FALSE
, FALSE
, FALSE
},
191 { "monofontsize", NULL
, "default-monospace-font-size", TRUE
, FALSE
, FALSE
, FALSE
},
192 { "caret", NULL
, "enable-caret-browsing", FALSE
, TRUE
, FALSE
, FALSE
},
193 { "fantasyfont", NULL
, "fantasy-font-family", FALSE
, FALSE
, FALSE
, FALSE
},
194 { "minimumfontsize", NULL
, "minimum-font-size", TRUE
, FALSE
, FALSE
, FALSE
},
195 { "monofont", NULL
, "monospace-font-family", FALSE
, FALSE
, FALSE
, FALSE
},
196 { "backgrounds", NULL
, "print-backgrounds", FALSE
, TRUE
, FALSE
, FALSE
},
197 { "sansfont", NULL
, "sans-serif-font-family", FALSE
, FALSE
, FALSE
, FALSE
},
198 { "seriffont", NULL
, "serif-font-family", FALSE
, FALSE
, FALSE
, FALSE
},
199 { "stylesheet", NULL
, "user-stylesheet-uri", FALSE
, FALSE
, FALSE
, FALSE
},
200 { "resizetextareas", NULL
, "resizable-text-areas", FALSE
, TRUE
, FALSE
, FALSE
},
201 { "webinspector", NULL
, "enable-developer-extras", FALSE
, TRUE
, FALSE
, FALSE
},
203 { "homepage", startpage
, "", FALSE
, FALSE
, FALSE
, FALSE
},
204 { "statusbgcolor", statusbgcolor
, "", FALSE
, FALSE
, TRUE
, TRUE
},
205 { "statuscolor", statuscolor
, "", FALSE
, FALSE
, TRUE
, TRUE
},
206 { "sslbgcolor", sslbgcolor
, "", FALSE
, FALSE
, TRUE
, TRUE
},
207 { "sslcolor", sslcolor
, "", FALSE
, FALSE
, TRUE
, TRUE
},
208 { "acceptlanguage", acceptlanguage
, "", FALSE
, FALSE
, FALSE
, FALSE
},
209 { "defaultsearch", defaultsearch
, "", FALSE
, FALSE
, FALSE
, FALSE
},
210 { "qmark", NULL
, "", FALSE
, FALSE
, FALSE
, FALSE
},
211 { "proxy", NULL
, "", FALSE
, TRUE
, FALSE
, FALSE
},
212 { "windowsize", NULL
, "", FALSE
, FALSE
, FALSE
, FALSE
},
213 { "scrollbars", NULL
, "", FALSE
, TRUE
, FALSE
, FALSE
},
214 { "statusbar", NULL
, "", FALSE
, TRUE
, FALSE
, FALSE
},
215 { "inputbox", NULL
, "", FALSE
, TRUE
, FALSE
, FALSE
},
216 { "completioncase", NULL
, "", FALSE
, TRUE
, FALSE
, FALSE
},
217 { "escapeinput", NULL
, "", FALSE
, TRUE
, FALSE
, FALSE
},
218 { "strictssl", NULL
, "", FALSE
, TRUE
, FALSE
, FALSE
},
219 { "cabundle", ca_bundle
, "", FALSE
, FALSE
, FALSE
, FALSE
},
220 { "tempdir", temp_dir
, "", FALSE
, FALSE
, FALSE
, FALSE
},