diff --git a/config.c b/config.c index d25a386..1e61b88 100644 --- a/config.c +++ b/config.c @@ -354,6 +354,9 @@ config_load_default(zathura_t* zathura) girara_shortcut_add(gsession, 0, GDK_KEY_Right, NULL, sc_navigate_index, INDEX, EXPAND, NULL); girara_shortcut_add(gsession, 0, GDK_KEY_space, NULL, sc_navigate_index, INDEX, SELECT, NULL); girara_shortcut_add(gsession, 0, GDK_KEY_Return, NULL, sc_navigate_index, INDEX, SELECT, NULL); + girara_shortcut_add(gsession, 0, 0, "gg", sc_navigate_index, INDEX, TOP, NULL); + girara_shortcut_add(gsession, 0, 0, "G", sc_navigate_index, INDEX, BOTTOM, NULL); + /* Presentation mode */ girara_shortcut_add(gsession, 0, GDK_KEY_J, NULL, sc_navigate, PRESENTATION, NEXT, NULL); diff --git a/shortcuts.c b/shortcuts.c index 103ac09..96cd552 100644 --- a/shortcuts.c +++ b/shortcuts.c @@ -983,6 +983,19 @@ sc_navigate_index(girara_session_t* session, girara_argument_t* argument, gboolean is_valid_path = TRUE; switch(argument->n) { + case TOP: + gtk_tree_path_free(path); + path = gtk_tree_path_new_first(); + break; + case BOTTOM: + gtk_tree_path_free(path); + path = gtk_tree_path_new_from_indices(gtk_tree_model_iter_n_children(model, NULL) - 1, -1); + gtk_tree_model_get_iter(model, &iter, path); + while (gtk_tree_model_iter_has_child(model, &iter) == TRUE && + gtk_tree_view_row_expanded(tree_view, path) == TRUE) { + gtk_tree_path_append_index(path, gtk_tree_model_iter_n_children(model, &iter) - 1); + } + break; case UP: if (gtk_tree_path_prev(path) == FALSE) { /* For some reason gtk_tree_path_up returns TRUE although we're not