2 (c) 2009 by Leon Winter
3 (c) 2009 by Hannes Schueller
8 static char startpage
[] = "http://www.yllr.net/vimprobable/";
9 static const gboolean enablePlugins
= TRUE
; /* TRUE keeps plugins enabled */
12 static const char statusbgcolor
[] = "#000000"; /* background color for status bar */
13 static const char statuscolor
[] = "#ffffff"; /* color for status bar */
14 static const char sslbgcolor
[] = "#b0ff00"; /* background color for status bar with SSL url */
15 static const char sslcolor
[] = "#000000"; /* color for status bar with SSL url */
17 /* normal, warning, error */
18 static const char *urlboxfont
[] = { "monospace normal 8", "monospace normal 8", "monospace bold 8"};
19 static const char *urlboxcolor
[] = { NULL
, "#ff0000", "#ffffff" };
20 static const char *urlboxbgcolor
[] = { NULL
, NULL
, "#ff0000" };
23 static const char *completionfont
[] = { "monospace normal 8", "monospace bold 8" };
25 static const char *completioncolor
[] = { "#000000", "#ff00ff", "#000000" };
26 /* current row background */
27 static const char *completionbgcolor
[] = { "#ffffff", "#ffffff", "#fff000" };
28 /* pango markup for prefix highliting: opening, closing */
29 #define COMPLETION_TAG_OPEN "<b>"
30 #define COMPLETION_TAG_CLOSE "</b>"
32 static const char statusfont
[] = "monospace bold 8"; /* font for status bar */
33 #define ENABLE_HISTORY_INDICATOR
34 #define ENABLE_INCREMENTAL_SEARCH
35 #define ENABLE_GTK_PROGRESS_BAR
36 #define ENABLE_WGET_PROGRESS_BAR
37 static const int progressbartick
= 20;
38 static const char progressborderleft
= '[';
39 static const char progressbartickchar
= '=';
40 static const char progressbarcurrent
= '>';
41 static const char progressbarspacer
= ' ';
42 static const char progressborderright
= ']';
45 #define ENABLE_COOKIE_SUPPORT
46 #define COOKIES_STORAGE_FILENAME "%s/.config/vimprobable/cookies", getenv("HOME")
47 #define COOKIES_STORAGE_READONLY FALSE /* if TRUE new cookies will be lost if you quit */
50 #define BOOKMARKS_STORAGE_FILENAME "%s/.config/vimprobable/bookmarks", getenv("HOME")
53 #define HISTORY_MAX_ENTRIES 1000
54 #define HISTORY_STORAGE_FILENAME "%s/.config/vimprobable/history", getenv("HOME")
56 /* downloads directory */
57 #define DOWNLOADS_PATH "%s", getenv("HOME")
60 #define USER_STYLES_FILENAME "%s/.config/vimprobable/style.css", getenv("HOME")
63 #define DEFAULT_FONT_SIZE 12
66 #define USER_AGENT "Vimprobable 0.8.3.3"
69 static unsigned int scrollstep
= 40; /* cursor difference in pixel */
70 static unsigned int pagingkeep
= 40; /* pixels kept when paging */
71 #define DISABLE_SCROLLBAR
74 #define ENABLE_MATCH_HIGHLITING
75 static const int searchoptions
= CaseInsensitive
| Wrapping
;
78 static Searchengine searchengines
[] = {
79 { "i", "http://ixquick.com/do/metasearch.pl?query=%s" },
80 { "s", "https://ssl.scroogle.org/cgi-bin/nbbwssl.cgi?Gw=%s" },
81 { "w", "https://secure.wikimedia.org/wikipedia/en/w/index.php?title=Special%%3ASearch&search=%s&go=Go" },
82 { "wd", "https://secure.wikimedia.org/wikipedia/de/w/index.php?title=Special%%3ASearch&search=%s&go=Go" },
84 static Searchengine
*defsearch
= &searchengines
[0];
86 /* key bindings for normal mode
87 Note: GDK_VoidSymbol is a wildcard so it matches on every modkey
90 /* modmask, modkey, key, function, argument */
91 { 0, 0, GDK_0
, scroll
, {ScrollJumpTo
| DirectionLeft
} },
92 { GDK_SHIFT_MASK
, 0, GDK_dollar
, scroll
, {ScrollJumpTo
| DirectionRight
} },
93 { 0, GDK_g
, GDK_g
, scroll
, {ScrollJumpTo
| DirectionTop
} },
94 { GDK_SHIFT_MASK
, 0, GDK_G
, scroll
, {ScrollJumpTo
| DirectionBottom
} },
95 { 0, 0, GDK_h
, scroll
, {ScrollMove
| DirectionLeft
| UnitLine
} },
96 { 0, 0, GDK_j
, scroll
, {ScrollMove
| DirectionBottom
| UnitLine
} },
97 { 0, 0, GDK_k
, scroll
, {ScrollMove
| DirectionTop
| UnitLine
} },
98 { 0, 0, GDK_l
, scroll
, {ScrollMove
| DirectionRight
| UnitLine
} },
99 { 0, 0, GDK_space
, scroll
, {ScrollMove
| DirectionBottom
| UnitPage
} },
100 { GDK_SHIFT_MASK
, 0, GDK_space
, scroll
, {ScrollMove
| DirectionTop
| UnitPage
} },
101 { GDK_CONTROL_MASK
, 0, GDK_b
, scroll
, {ScrollMove
| DirectionTop
| UnitPage
} },
102 { GDK_CONTROL_MASK
, 0, GDK_f
, scroll
, {ScrollMove
| DirectionBottom
| UnitPage
} },
103 { GDK_CONTROL_MASK
, 0, GDK_d
, scroll
, {ScrollMove
| DirectionBottom
| UnitBuffer
} },
104 { GDK_CONTROL_MASK
, 0, GDK_u
, scroll
, {ScrollMove
| DirectionTop
| UnitBuffer
} },
105 { GDK_CONTROL_MASK
, 0, GDK_e
, scroll
, {ScrollMove
| DirectionBottom
| UnitLine
} },
106 { GDK_CONTROL_MASK
, 0, GDK_y
, scroll
, {ScrollMove
| DirectionTop
| UnitLine
} },
108 { GDK_CONTROL_MASK
, 0, GDK_i
, navigate
, {NavigationBack
} },
109 { GDK_CONTROL_MASK
, 0, GDK_o
, navigate
, {NavigationForward
} },
110 { GDK_SHIFT_MASK
, 0, GDK_H
, navigate
, {NavigationBack
} },
111 { GDK_SHIFT_MASK
, 0, GDK_L
, navigate
, {NavigationForward
} },
112 { 0, 0, GDK_r
, navigate
, {NavigationReload
} },
113 { GDK_SHIFT_MASK
, 0, GDK_R
, navigate
, {NavigationForceReload
} },
114 { GDK_CONTROL_MASK
, 0, GDK_c
, navigate
, {NavigationCancel
} },
116 { 0, 0, GDK_plus
, zoom
, {ZoomIn
| ZoomText
} },
117 { 0, 0, GDK_minus
, zoom
, {ZoomOut
| ZoomText
} },
118 { 0, GDK_z
, GDK_i
, zoom
, {ZoomIn
| ZoomText
} },
119 { 0, GDK_z
, GDK_o
, zoom
, {ZoomOut
| ZoomText
} },
120 { 0, GDK_z
, GDK_z
, zoom
, {ZoomReset
| ZoomText
} },
121 { GDK_SHIFT_MASK
, GDK_z
, GDK_I
, zoom
, {ZoomIn
| ZoomFullContent
} },
122 { GDK_SHIFT_MASK
, GDK_z
, GDK_O
, zoom
, {ZoomOut
| ZoomFullContent
} },
123 { GDK_SHIFT_MASK
, GDK_z
, GDK_Z
, zoom
, {ZoomReset
| ZoomFullContent
} },
125 { 0, 0, GDK_y
, yank
, {SourceURL
| ClipboardPrimary
| ClipboardGTK
} },
126 { GDK_SHIFT_MASK
, 0, GDK_Y
, yank
, {SourceSelection
} },
128 { 0, GDK_g
, GDK_u
, descend
, {NthSubdir
} },
129 { GDK_SHIFT_MASK
, GDK_g
, GDK_U
, descend
, {Rootdir
} },
131 { 0, GDK_g
, GDK_h
, open
, {TargetCurrent
, startpage
} },
132 { GDK_SHIFT_MASK
, GDK_g
, GDK_H
, open
, {TargetNew
, startpage
} },
134 { 0, 0, GDK_p
, paste
, {TargetCurrent
| ClipboardPrimary
| ClipboardGTK
} },
135 { GDK_SHIFT_MASK
, 0, GDK_P
, paste
, {TargetNew
| ClipboardPrimary
| ClipboardGTK
} },
137 { GDK_CONTROL_MASK
, 0, GDK_a
, number
, {Increment
} },
138 { GDK_CONTROL_MASK
, 0, GDK_x
, number
, {Decrement
} },
140 { 0, 0, GDK_n
, search
, {DirectionNext
| CaseInsensitive
| Wrapping
} },
141 { GDK_SHIFT_MASK
, 0, GDK_N
, search
, {DirectionPrev
| CaseInsensitive
| Wrapping
} },
143 { GDK_SHIFT_MASK
, 0, GDK_colon
, input
, {.s
= ":" } },
144 { 0, 0, GDK_o
, input
, {.s
= ":open "} },
145 { GDK_SHIFT_MASK
, 0, GDK_O
, input
, {.s
= ":open ", .i
= InsertCurrentURL
} },
146 { 0, 0, GDK_t
, input
, {.s
= ":tabopen "} },
147 { GDK_SHIFT_MASK
, 0, GDK_T
, input
, {.s
= ":tabopen ", .i
= InsertCurrentURL
} },
148 { 0, 0, GDK_slash
, input
, {.s
= "/"} },
149 { GDK_SHIFT_MASK
, 0, GDK_slash
, input
, {.s
= "/"} },
150 { GDK_SHIFT_MASK
, 0, GDK_question
, input
, {.s
= "?"} },
152 { 0, GDK_VoidSymbol
, GDK_Escape
, set
, {ModeNormal
} },
153 { GDK_CONTROL_MASK
, 0, GDK_z
, set
, {ModePassThrough
} },
154 { GDK_CONTROL_MASK
, 0, GDK_v
, set
, {ModeSendKey
} },
155 { 0, 0, GDK_f
, set
, {ModeHints
} },
157 { 0, 0, GDK_d
, quit
, {0} },
159 { 0, 0, GDK_w
, toggle_plugins
,{0} },
160 { 0, 0, GDK_e
, toggle_images
,{0} },
163 /* command mapping */
164 static Command commands
[] = {
165 /* command, function, argument */
166 { "ba", navigate
, {NavigationBack
} },
167 { "back", navigate
, {NavigationBack
} },
168 { "ec", script
, {Info
} },
169 { "echo", script
, {Info
} },
170 { "echoe", script
, {Error
} },
171 { "echoerr", script
, {Error
} },
172 { "fw", navigate
, {NavigationForward
} },
173 { "fo", navigate
, {NavigationForward
} },
174 { "forward", navigate
, {NavigationForward
} },
175 { "javascript", script
, {Silent
} },
176 { "o", open
, {TargetCurrent
} },
177 { "open", open
, {TargetCurrent
} },
179 { "quit", quit
, {0} },
180 { "re", navigate
, {NavigationReload
} },
181 { "re!", navigate
, {NavigationForceReload
} },
182 { "reload", navigate
, {NavigationReload
} },
183 { "reload!", navigate
, {NavigationForceReload
} },
184 { "st", navigate
, {NavigationCancel
} },
185 { "stop", navigate
, {NavigationCancel
} },
186 { "t", open
, {TargetNew
} },
187 { "tabopen", open
, {TargetNew
} },
188 { "bma", bookmark
, {0} },
189 { "bookmark", bookmark
, {0} },
193 you can use MOUSE_BUTTON_1 to MOUSE_BUTTON_5
195 static Mouse mouse
[] = {
196 /* modmask, modkey, button, function, argument */
197 { 0, 0, MOUSE_BUTTON_2
, paste
, {TargetCurrent
| ClipboardPrimary
| ClipboardGTK
} },
198 { GDK_SHIFT_MASK
, 0, MOUSE_BUTTON_2
, paste
, {TargetNew
| ClipboardPrimary
| ClipboardGTK
} },
199 { GDK_CONTROL_MASK
, 0, MOUSE_BUTTON_2
, open
, {TargetNew
, rememberedURI
} },