mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-27 13:26:00 +01:00
Add a snap_to_page command
This commit is contained in:
parent
13119854c7
commit
0cf5be08cd
4 changed files with 30 additions and 0 deletions
|
@ -289,6 +289,10 @@ They can also be combined with modifiers:
|
|||
|
||||
Set an option.
|
||||
|
||||
* ``snap_to_page``
|
||||
|
||||
Snaps to the current page. Equivalent to ``goto <current_page>``
|
||||
|
||||
* ``toggle_fullscreen``
|
||||
|
||||
Toggle fullscreen.
|
||||
|
|
|
@ -358,6 +358,8 @@ config_load_default(zathura_t* zathura)
|
|||
\
|
||||
girara_shortcut_add(gsession, 0, GDK_KEY_n, NULL, sc_search, (mode), FORWARD, NULL); \
|
||||
girara_shortcut_add(gsession, 0, GDK_KEY_N, NULL, sc_search, (mode), BACKWARD, NULL); \
|
||||
\
|
||||
girara_shortcut_add(gsession, 0, GDK_KEY_P, NULL, sc_snap_to_page, (mode), 0, NULL); \
|
||||
\
|
||||
girara_shortcut_add(gsession, 0, GDK_KEY_Tab, NULL, sc_toggle_index, (mode), 0, NULL); \
|
||||
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_n, NULL, girara_sc_toggle_statusbar, (mode), 0, NULL); \
|
||||
|
@ -527,6 +529,7 @@ config_load_default(zathura_t* zathura)
|
|||
girara_shortcut_mapping_add(gsession, "rotate", sc_rotate);
|
||||
girara_shortcut_mapping_add(gsession, "scroll", sc_scroll);
|
||||
girara_shortcut_mapping_add(gsession, "search", sc_search);
|
||||
girara_shortcut_mapping_add(gsession, "snap_to_page", sc_snap_to_page);
|
||||
girara_shortcut_mapping_add(gsession, "toggle_fullscreen", sc_toggle_fullscreen);
|
||||
girara_shortcut_mapping_add(gsession, "toggle_index", sc_toggle_index);
|
||||
girara_shortcut_mapping_add(gsession, "toggle_page_mode", sc_toggle_page_mode);
|
||||
|
|
|
@ -1469,3 +1469,16 @@ sc_nohlsearch(girara_session_t* session, girara_argument_t* UNUSED(argument), gi
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool sc_snap_to_page(girara_session_t *session,
|
||||
girara_argument_t *UNUSED(argument),
|
||||
girara_event_t *UNUSED(event), unsigned int UNUSED(t)) {
|
||||
g_return_val_if_fail(session != NULL, false);
|
||||
g_return_val_if_fail(session->global.data != NULL, false);
|
||||
zathura_t *zathura = session->global.data;
|
||||
g_return_val_if_fail(zathura->document != NULL, false);
|
||||
zathura_document_t *document = zathura->document;
|
||||
|
||||
int page = zathura_document_get_current_page_number(document);
|
||||
return page_set(zathura, page);
|
||||
}
|
||||
|
|
|
@ -303,5 +303,15 @@ bool sc_exec(girara_session_t* session, girara_argument_t* argument, girara_even
|
|||
*/
|
||||
bool sc_nohlsearch(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t);
|
||||
|
||||
/**
|
||||
* Snaps the current view to the current page
|
||||
*
|
||||
* @param session The used girara session
|
||||
* @param argument The used argument
|
||||
* @param event Girara event
|
||||
* @param t Number of executions
|
||||
* @return true if no error occurred otherwise false
|
||||
*/
|
||||
bool sc_snap_to_page(girara_session_t *session, girara_argument_t *argument, girara_event_t *event, unsigned int t);
|
||||
|
||||
#endif // SHORTCUTS_H
|
||||
|
|
Loading…
Reference in a new issue