diff options
-rw-r--r-- | doc/dwb.1 | 30 | ||||
-rw-r--r-- | src/commands.c | 33 | ||||
-rw-r--r-- | src/dwb.c | 8 | ||||
-rw-r--r-- | src/dwb.h | 2 |
4 files changed, 43 insertions, 30 deletions
@@ -276,20 +276,20 @@ Open quickmark in a new window (command aliases: .BR winqmarks ). .TP -.BR r -Reload focused tab (command +.BR [n]r +Reload tab n or current tab if n is omitted (command .BR reload , aliases: .BR re ). .TP -.BR R -Reload focused tab without using any cached data (command +.BR [n]R +Reload tab n or current tab if n is omitted without using any cached data (command .BR reload_bypass_cache , aliases: .BR refull ). .TP -.BR C-s -Stop loading current page (command +.BR [n]C-s +Stop loading of tab n or of current tab is [n] is omitted (command .BR stop_loading , aliases: .BR stop , @@ -497,27 +497,27 @@ not be saved persitently. (command aliases: .BR tcookie ). .TP -.BR yy -Yank the current url to clipboard +.BR [n]yy +Yank the url of tab n or of current tab is n omitted to clipboard (command .BR yank ). .TP .BR yY -Yank the current url to primary +Yank the url of tab n or of current tab is n omitted to primary selection (command .BR yank_primary , aliases: .BR pyank ). .TP .BR yt -Yank the current title to clipboard +Yank the title of tab n or of current tab is n omitted to clipboard (command .BR yank_title , aliases: .BR tyank ). .TP .BR yT -Yank the current title to primary +Yank the title of tab n or of current tab is n omitted to primary selection (command .BR yank_title_primary , aliases: @@ -650,8 +650,8 @@ Next navigation action will be opened in a new window (command .BR eu Show userscripts (command .TP -.BR wi -Show the webinspector. Note that 'enable-developer-extras' has to be set. +.BR [n]wi +Show the webinspector of tab n or of current tab if n is omitted. Note that 'enable-developer-extras' has to be set. (commmand .BR web_inspector , aliases: @@ -713,8 +713,8 @@ Toggle visibility of a tab. aliases: .BR vis ). .TP -.BR C-M-p -Print focused frame. +.BR [n]C-M-p +Print focused frame of tab n or of current tab if n is ommitted. (command .BR print , aliases: diff --git a/src/commands.c b/src/commands.c index 9e6314fd..cee003ff 100644 --- a/src/commands.c +++ b/src/commands.c @@ -69,6 +69,13 @@ commands_simple_command(KeyMap *km) { km->map->arg.p = NULL; dwb_clean_key_buffer(); }/*}}}*/ +static WebKitWebView * +commands_get_webview_with_nummod() { + if (dwb.state.nummod > 0 && dwb.state.nummod <= g_list_length(dwb.state.views)) + return WEBVIEW(g_list_nth(dwb.state.views, NUMMOD - 1)); + else + return CURRENT_WEBVIEW(); +} /* commands_add_view(KeyMap *, Arg *) {{{*/ DwbStatus @@ -236,14 +243,17 @@ commands_quickmark(KeyMap *km, Arg *arg) { /* commands_reload(KeyMap *km, Arg *){{{*/ DwbStatus commands_reload(KeyMap *km, Arg *arg) { - dwb_reload(); + GList *gl = dwb.state.nummod > 0 && dwb.state.nummod <= g_list_length(dwb.state.views) + ? g_list_nth(dwb.state.views, dwb.state.nummod-1) + : dwb.state.fview; + dwb_reload(gl); return STATUS_OK; }/*}}}*/ /* commands_reload_bypass_cache {{{*/ DwbStatus commands_reload_bypass_cache(KeyMap *km, Arg *arg) { - webkit_web_view_reload_bypass_cache(WEBVIEW_FROM_ARG(arg)); + webkit_web_view_reload_bypass_cache(commands_get_webview_with_nummod()); return STATUS_OK; } /*}}}*/ @@ -251,7 +261,7 @@ commands_reload_bypass_cache(KeyMap *km, Arg *arg) { /* commands_stop_loading {{{*/ DwbStatus commands_stop_loading(KeyMap *km, Arg *arg) { - webkit_web_view_stop_loading(WEBVIEW_FROM_ARG(arg)); + webkit_web_view_stop_loading(commands_get_webview_with_nummod()); return STATUS_OK; } /*}}}*/ @@ -402,10 +412,11 @@ DwbStatus commands_yank(KeyMap *km, Arg *arg) { GdkAtom atom = GDK_POINTER_TO_ATOM(arg->p); const char *text = NULL; + WebKitWebView *wv = commands_get_webview_with_nummod(); if (arg->n == CA_URI) - text = webkit_web_view_get_uri(CURRENT_WEBVIEW()); + text = webkit_web_view_get_uri(wv); else if (arg->n == CA_TITLE) - text = webkit_web_view_get_title(CURRENT_WEBVIEW()); + text = webkit_web_view_get_title(wv); return dwb_set_clipboard(text, atom); }/*}}}*/ @@ -596,8 +607,8 @@ commands_undo(KeyMap *km, Arg *arg) { /* commands_print (Arg *) {{{*/ DwbStatus commands_print(KeyMap *km, Arg *arg) { - WebKitWebFrame *frame = webkit_web_view_get_focused_frame(CURRENT_WEBVIEW()); - + WebKitWebView *wv = commands_get_webview_with_nummod(); + WebKitWebFrame *frame = webkit_web_view_get_focused_frame(wv); if (frame) { webkit_web_frame_print(frame); return STATUS_OK; @@ -609,7 +620,8 @@ commands_print(KeyMap *km, Arg *arg) { DwbStatus commands_web_inspector(KeyMap *km, Arg *arg) { if (GET_BOOL("enable-developer-extras")) { - webkit_web_inspector_show(webkit_web_view_get_inspector(CURRENT_WEBVIEW())); + WebKitWebView *wv = commands_get_webview_with_nummod(); + webkit_web_inspector_show(webkit_web_view_get_inspector(wv)); return STATUS_OK; } return STATUS_ERROR; @@ -639,7 +651,7 @@ commands_execute_userscript(KeyMap *km, Arg *arg) { DwbStatus commands_toggle_hidden_files(KeyMap *km, Arg *arg) { dwb.state.hidden_files = !dwb.state.hidden_files; - dwb_reload(); + dwb_reload(dwb.state.fview); return STATUS_OK; }/*}}}*/ @@ -736,7 +748,8 @@ commands_execute_javascript(KeyMap *km, Arg *arg) { FREE0(script); script = g_strdup(arg->p); } - dwb_execute_script(webkit_web_view_get_focused_frame(CURRENT_WEBVIEW()), script, false); + WebKitWebView *wv = commands_get_webview_with_nummod(); + dwb_execute_script(webkit_web_view_get_focused_frame(wv), script, false); return STATUS_OK; }/*}}}*/ /* commands_set {{{*/ @@ -468,7 +468,7 @@ dwb_update_status_text(GList *gl, GtkAdjustment *a) { /*}}}*/ /* FUNCTIONS {{{*/ - +/* dwb_glist_prepend_unique(GList **list, char *text) {{{*/ void dwb_glist_prepend_unique(GList **list, char *text) { for (GList *l = (*list); l; l=l->next) { @@ -992,10 +992,10 @@ dwb_toggle_allowed(const char *filename, const char *data) { }/*}}}*/ void -dwb_reload(void) { - const char *path = webkit_web_view_get_uri(CURRENT_WEBVIEW()); +dwb_reload(GList *gl) { + const char *path = webkit_web_view_get_uri(WEBVIEW(gl)); if ( !local_check_directory(dwb.state.fview, path, false, NULL) ) { - webkit_web_view_reload(CURRENT_WEBVIEW()); + webkit_web_view_reload(WEBVIEW(gl)); } } @@ -761,7 +761,7 @@ void dwb_save_searchengine(void); char * dwb_execute_script(WebKitWebFrame *, const char *, gboolean); void dwb_toggle_tabbar(void); DwbStatus dwb_history(Arg *a); -void dwb_reload(void); +void dwb_reload(GList *gl); DwbStatus dwb_history_back(void); DwbStatus dwb_history_forward(void); void dwb_scroll(GList *, double, ScrollDirection); |