Toggle the value of boolean variable
.I VAR
and display the new set value.
+.SS Zoom
+.TP
+.BI [ N "]zoom{" "in" ", " "out" "}"
+Zoom \fIN\fP steps \fIin\fP or \fIout\fP of the current page \- effects only the text.
+.TP
+.BI [ N "]zoom{" "in" ", " "out" "}full"
+Zoom \fIN\fP steps \fIin\fP or \fIout\fP of the current page \- effecting all elements.
+.TP
+.B zoomreset
+Reset the zoomlevel to the default value.
.SS Misc
.TP
-.BI "[" "N" "]search-{forward, backward}"
-Search in current page forward or backward.
+.BI "[" "N" "]search-{" forward ", " "backward" "}"
+Search in current page
+.I forward
+or
+.IR backward .
.TP
.B inspect
Toggles the webinspector for current page. This is only available if the config
{"search-backward", command_search, {VP_SEARCH_BACKWARD}},
{"searchengine-add", command_searchengine,{1}},
{"searchengine-remove", command_searchengine,{0}},
+ {"zoomin", command_zoom, {COMMAND_ZOOM_IN}},
+ {"zoomout", command_zoom, {COMMAND_ZOOM_OUT}},
+ {"zoominfull", command_zoom, {COMMAND_ZOOM_IN | COMMAND_ZOOM_FULL}},
+ {"zoomoutfull", command_zoom, {COMMAND_ZOOM_OUT | COMMAND_ZOOM_FULL}},
+ {"zoomreset", command_zoom, {COMMAND_ZOOM_RESET}},
};
static void command_write_input(const char* str);
return result;
}
+gboolean command_zoom(const Arg* arg)
+{
+ float step, level;
+ int count;
+
+ if (arg->i & COMMAND_ZOOM_RESET) {
+ webkit_web_view_set_zoom_level(vp.gui.webview, 1.0);
+ vp_set_mode(VP_MODE_NORMAL, FALSE);
+
+ return TRUE;
+ }
+
+ count = vp.state.count ? vp.state.count : 1;
+ level = webkit_web_view_get_zoom_level(vp.gui.webview);
+
+ WebKitWebSettings* setting = webkit_web_view_get_settings(vp.gui.webview);
+ g_object_get(G_OBJECT(setting), "zoom-step", &step, NULL);
+
+ webkit_web_view_set_full_content_zoom(
+ vp.gui.webview, (arg->i & COMMAND_ZOOM_FULL) > 0
+ );
+
+ webkit_web_view_set_zoom_level(
+ vp.gui.webview,
+ level + (float)(count *step) * (arg->i & COMMAND_ZOOM_IN ? 1.0 : -1.0)
+ );
+
+ vp_set_mode(VP_MODE_NORMAL, FALSE);
+
+ return TRUE;
+
+}
+
static void command_write_input(const char* str)
{
int pos = 0;
COMMAND_YANK_SELECTION = (COMMAND_YANK_SECONDARY<<2)
};
+enum {
+ COMMAND_ZOOM_OUT,
+ COMMAND_ZOOM_IN,
+ COMMAND_ZOOM_FULL = (1<<1),
+ COMMAND_ZOOM_RESET = (1<<2)
+};
+
typedef gboolean (*Command)(const Arg* arg);
typedef struct {
gboolean command_paste(const Arg* arg);
gboolean command_search(const Arg* arg);
gboolean command_searchengine(const Arg* arg);
+gboolean command_zoom(const Arg* arg);
#endif /* end of include guard: _COMMAND_H */
{"nmap Y=yank-selection"},
{"nmap p=open-clipboard"},
{"nmap P=tabopen-clipboard"},
+ {"nmap zi=zoomin"},
+ {"nmap zI=zoominfull"},
+ {"nmap zo=zoomout"},
+ {"nmap zO=zoomoutfull"},
+ {"nmap zz=zoomreset"},
{"cmap <tab>=complete"},
{"cmap <shift-tab>=complete-back"},
{"hmap <tab>=hint-focus-next"},