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.9.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. */
24 char statusbgcolor
[MAX_SETTING_SIZE
] = "#000000"; /* background color for status bar */
25 char statuscolor
[MAX_SETTING_SIZE
] = "#ffffff"; /* color for status bar */
26 char sslbgcolor
[MAX_SETTING_SIZE
] = "#b0ff00"; /* background color for status bar with SSL url */
27 char sslcolor
[MAX_SETTING_SIZE
] = "#000000"; /* color for status bar with SSL url */
29 /* normal, warning, error */
30 static const char *urlboxfont
[] = { "monospace normal 8", "monospace normal 8", "monospace bold 8"};
31 static const char *urlboxcolor
[] = { NULL
, "#ff0000", "#ffffff" };
32 static const char *urlboxbgcolor
[] = { NULL
, NULL
, "#ff0000" };
35 static const char *completionfont
[] = { "monospace normal 8", "monospace bold 8" };
37 static const char *completioncolor
[] = { "#000000", "#ff00ff", "#000000" };
38 /* current row background */
39 static const char *completionbgcolor
[] = { "#ffffff", "#ffffff", "#fff000" };
40 /* pango markup for prefix highliting: opening, closing */
41 #define COMPLETION_TAG_OPEN "<b>"
42 #define COMPLETION_TAG_CLOSE "</b>"
44 static const char statusfont
[] = "monospace bold 8"; /* font for status bar */
45 #define ENABLE_HISTORY_INDICATOR
46 #define ENABLE_INCREMENTAL_SEARCH
47 #define ENABLE_GTK_PROGRESS_BAR
48 #define ENABLE_WGET_PROGRESS_BAR
49 static const int progressbartick
= 20;
50 static const char progressborderleft
= '[';
51 static const char progressbartickchar
= '=';
52 static const char progressbarcurrent
= '>';
53 static const char progressbarspacer
= ' ';
54 static const char progressborderright
= ']';
57 #define ENABLE_COOKIE_SUPPORT
58 #define COOKIES_STORAGE_FILENAME "%s/.config/vimprobable/cookies", getenv("HOME")
59 #define COOKIES_STORAGE_READONLY FALSE /* if TRUE new cookies will be lost if you quit */
61 /* downloads directory */
62 #define DOWNLOADS_PATH "%s", getenv("HOME")
65 #define DEFAULT_FONT_SIZE 12
68 #define USER_STYLESHEET "%s/.config/vimprobable/style.css", getenv("HOME")
71 static const gboolean use_proxy
= TRUE
; /* TRUE if you're going to use a proxy (whose address
72 is specified in http_proxy environment variable), false otherwise */
74 static unsigned int scrollstep
= 40; /* cursor difference in pixel */
75 static unsigned int pagingkeep
= 40; /* pixels kept when paging */
76 #define DISABLE_SCROLLBAR
79 #define ENABLE_MATCH_HIGHLITING
80 static const int searchoptions
= CaseInsensitive
| Wrapping
;
81 gboolean complete_case_sensitive
= TRUE
;
84 static Searchengine searchengines
[] = {
85 { "i", "http://ixquick.com/do/metasearch.pl?query=%s" },
86 { "s", "https://ssl.scroogle.org/cgi-bin/nbbwssl.cgi?Gw=%s" },
87 { "w", "https://secure.wikimedia.org/wikipedia/en/w/index.php?title=Special%%3ASearch&search=%s&go=Go" },
88 { "wd", "https://secure.wikimedia.org/wikipedia/de/w/index.php?title=Special%%3ASearch&search=%s&go=Go" },
91 static char defaultsearch
[MAX_SETTING_SIZE
] = "i";
94 Command commands
[COMMANDSIZE
] = {
95 /* command, function, argument */
96 { "ba", navigate
, {NavigationBack
} },
97 { "back", navigate
, {NavigationBack
} },
98 { "ec", script
, {Info
} },
99 { "echo", script
, {Info
} },
100 { "echoe", script
, {Error
} },
101 { "echoerr", script
, {Error
} },
102 { "fw", navigate
, {NavigationForward
} },
103 { "fo", navigate
, {NavigationForward
} },
104 { "forward", navigate
, {NavigationForward
} },
105 { "javascript", script
, {Silent
} },
106 { "o", open_arg
, {TargetCurrent
} },
107 { "open", open_arg
, {TargetCurrent
} },
109 { "quit", quit
, {0} },
110 { "re", navigate
, {NavigationReload
} },
111 { "re!", navigate
, {NavigationForceReload
} },
112 { "reload", navigate
, {NavigationReload
} },
113 { "reload!", navigate
, {NavigationForceReload
} },
114 { "qt", search_tag
, {0} },
115 { "st", navigate
, {NavigationCancel
} },
116 { "stop", navigate
, {NavigationCancel
} },
117 { "t", open_arg
, {TargetNew
} },
118 { "tabopen", open_arg
, {TargetNew
} },
119 { "print", print_frame
, {0} },
120 { "bma", bookmark
, {0} },
121 { "bookmark", bookmark
, {0} },
122 { "source", view_source
, {0} },
123 { "set", browser_settings
, {0} },
124 { "map", mappings
, {0} },
125 { "jumpleft", scroll
, {ScrollJumpTo
| DirectionLeft
} },
126 { "jumpright", scroll
, {ScrollJumpTo
| DirectionRight
} },
127 { "jumptop", scroll
, {ScrollJumpTo
| DirectionTop
} },
128 { "jumpbottom", scroll
, {ScrollJumpTo
| DirectionBottom
} },
129 { "pageup", scroll
, {ScrollMove
| DirectionTop
| UnitPage
} },
130 { "pagedown", scroll
, {ScrollMove
| DirectionBottom
| UnitPage
} },
131 { "navigationback", navigate
, {NavigationBack
} },
132 { "navigationforward", navigate
, {NavigationForward
} },
133 { "scrollleft", scroll
, {ScrollMove
| DirectionLeft
| UnitLine
} },
134 { "scrollright", scroll
, {ScrollMove
| DirectionRight
| UnitLine
} },
135 { "scrollup", scroll
, {ScrollMove
| DirectionTop
| UnitLine
} },
136 { "scrolldown", scroll
, {ScrollMove
| DirectionBottom
| UnitLine
} },
140 you can use MOUSE_BUTTON_1 to MOUSE_BUTTON_5
142 static Mouse mouse
[] = {
143 /* modmask, modkey, button, function, argument */
144 { 0, 0, MOUSE_BUTTON_2
, paste
, {TargetCurrent
| ClipboardPrimary
| ClipboardGTK
, rememberedURI
} },
145 { GDK_CONTROL_MASK
, 0, MOUSE_BUTTON_2
, paste
, {TargetNew
| ClipboardPrimary
| ClipboardGTK
} },
146 { GDK_CONTROL_MASK
, 0, MOUSE_BUTTON_1
, open_remembered
, {TargetNew
} },
149 /* settings (arguments of :set command) */
150 static Setting browsersettings
[] = {
151 /* public name, internal variable webkit setting integer value? boolean value? colour value? reload page? */
152 { "useragent", useragent
, "user-agent", FALSE
, FALSE
, FALSE
, FALSE
},
153 { "scripts", NULL
, "enable-scripts", FALSE
, TRUE
, FALSE
, FALSE
},
154 { "plugins", NULL
, "enable-plugins", FALSE
, TRUE
, FALSE
, FALSE
},
155 { "pagecache", NULL
, "enable-page-cache", FALSE
, TRUE
, FALSE
, FALSE
},
156 { "java", NULL
, "enable-java-applet", FALSE
, TRUE
, FALSE
, FALSE
},
157 { "images", NULL
, "auto-load-images", FALSE
, TRUE
, FALSE
, FALSE
},
158 { "shrinkimages", NULL
, "auto-shrink-images", FALSE
, TRUE
, FALSE
, FALSE
},
159 { "cursivefont", NULL
, "cursive-font-family", FALSE
, FALSE
, FALSE
, FALSE
},
160 { "defaultencoding", NULL
, "default-encoding", FALSE
, FALSE
, FALSE
, FALSE
},
161 { "defaultfont", NULL
, "default-font-family", FALSE
, FALSE
, FALSE
, FALSE
},
162 { "fontsize", NULL
, "default-font-size", TRUE
, FALSE
, FALSE
, FALSE
},
163 { "monofontsize", NULL
, "default-monospace-font-size", TRUE
, FALSE
, FALSE
, FALSE
},
164 { "caret", NULL
, "enable-caret-browsing", FALSE
, TRUE
, FALSE
, FALSE
},
165 { "fantasyfont", NULL
, "fantasy-font-family", FALSE
, FALSE
, FALSE
, FALSE
},
166 { "minimumfontsize", NULL
, "minimum-font-size", TRUE
, FALSE
, FALSE
, FALSE
},
167 { "monofont", NULL
, "monospace-font-family", FALSE
, FALSE
, FALSE
, FALSE
},
168 { "backgrounds", NULL
, "print-backgrounds", FALSE
, TRUE
, FALSE
, FALSE
},
169 { "sansfont", NULL
, "sans-serif-font-family", FALSE
, FALSE
, FALSE
, FALSE
},
170 { "seriffont", NULL
, "serif-font-family", FALSE
, FALSE
, FALSE
, FALSE
},
171 { "stylesheet", NULL
, "user-stylesheet-uri", FALSE
, FALSE
, FALSE
, FALSE
},
172 { "resizetextareas", NULL
, "resizable-text-areas", FALSE
, TRUE
, FALSE
, FALSE
},
173 { "webinspector", NULL
, "enable-developer-extras", FALSE
, TRUE
, FALSE
, FALSE
},
175 { "homepage", startpage
, "", FALSE
, FALSE
, FALSE
, FALSE
},
176 { "statusbgcolor", statusbgcolor
, "", FALSE
, FALSE
, TRUE
, TRUE
},
177 { "statuscolor", statuscolor
, "", FALSE
, FALSE
, TRUE
, TRUE
},
178 { "sslbgcolor", sslbgcolor
, "", FALSE
, FALSE
, TRUE
, TRUE
},
179 { "sslcolor", sslcolor
, "", FALSE
, FALSE
, TRUE
, TRUE
},
180 { "acceptlanguage", acceptlanguage
, "", FALSE
, FALSE
, FALSE
, FALSE
},
181 { "defaultsearch", defaultsearch
, "", FALSE
, FALSE
, FALSE
, FALSE
},
182 { "qmark", NULL
, "", FALSE
, FALSE
, FALSE
, FALSE
},
183 { "proxy", NULL
, "", FALSE
, TRUE
, FALSE
, FALSE
},
184 { "scrollbars", NULL
, "", FALSE
, TRUE
, FALSE
, FALSE
},
185 { "statusbar", NULL
, "", FALSE
, TRUE
, FALSE
, FALSE
},
186 { "inputbox", NULL
, "", FALSE
, TRUE
, FALSE
, FALSE
},
187 { "completioncase", NULL
, "", FALSE
, TRUE
, FALSE
, FALSE
},