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