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