mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-11-14 18:03:46 +01:00
Clean up shortcuts
This commit is contained in:
parent
2913fd5dac
commit
bd3f292afc
114
config.def.h
114
config.def.h
@ -62,63 +62,61 @@ int adjust_open = ADJUST_BESTFIT;
|
||||
|
||||
/* shortcuts */
|
||||
Shortcut shortcuts[] = {
|
||||
/* mask, key, function, mode, argument */
|
||||
{GDK_CONTROL_MASK, GDK_n, sc_toggle_statusbar, NORMAL, {0} },
|
||||
{GDK_CONTROL_MASK, GDK_m, sc_toggle_inputbar, NORMAL, {0} },
|
||||
{0, GDK_F5, sc_toggle_fullscreen, NORMAL, {0} },
|
||||
{GDK_CONTROL_MASK, GDK_q, sc_quit, -1, {0} },
|
||||
{GDK_CONTROL_MASK, GDK_c, sc_abort, -1, {0} },
|
||||
{GDK_CONTROL_MASK, GDK_i, sc_recolor, NORMAL, {0} },
|
||||
{GDK_CONTROL_MASK, GDK_d, sc_scroll, NORMAL, { HALF_DOWN } },
|
||||
{GDK_CONTROL_MASK, GDK_u, sc_scroll, NORMAL, { HALF_UP } },
|
||||
{GDK_CONTROL_MASK, GDK_f, sc_scroll, NORMAL, { FULL_DOWN } },
|
||||
{GDK_CONTROL_MASK, GDK_b, sc_scroll, NORMAL, { FULL_UP } },
|
||||
{0, GDK_slash, sc_focus_inputbar, NORMAL, { .data = "/" } },
|
||||
{GDK_SHIFT_MASK, GDK_slash, sc_focus_inputbar, NORMAL, { .data = "/" } },
|
||||
{GDK_SHIFT_MASK, GDK_question, sc_focus_inputbar, NORMAL, { .data = "?" } },
|
||||
{0, GDK_Tab, sc_toggle_index, NORMAL, {0} },
|
||||
{0, GDK_Tab, sc_toggle_index, INDEX, {0} },
|
||||
{0, GDK_J, sc_navigate, NORMAL, { NEXT } },
|
||||
{0, GDK_K, sc_navigate, NORMAL, { PREVIOUS } },
|
||||
{GDK_MOD1_MASK, GDK_Right, sc_navigate, NORMAL, { NEXT } },
|
||||
{GDK_MOD1_MASK, GDK_Left, sc_navigate, NORMAL, { PREVIOUS } },
|
||||
{0, GDK_O, sc_switch_goto_mode, NORMAL, {0} },
|
||||
{0, GDK_space, sc_navigate, NORMAL, { NEXT } },
|
||||
{0, GDK_Escape, sc_abort, -1, {0} },
|
||||
{0, GDK_i, sc_change_mode, NORMAL, { INSERT } },
|
||||
{0, GDK_v, sc_change_mode, NORMAL, { VISUAL } },
|
||||
{0, GDK_m, sc_change_mode, NORMAL, { ADD_MARKER } },
|
||||
{0, GDK_apostrophe, sc_change_mode, NORMAL, { EVAL_MARKER } },
|
||||
{0, GDK_colon, sc_focus_inputbar, NORMAL, { .data = ":" } },
|
||||
{0, GDK_o, sc_focus_inputbar, NORMAL, { .data = ":open " } },
|
||||
{0, GDK_f, sc_follow, NORMAL, {0} },
|
||||
{0, GDK_r, sc_rotate, NORMAL, {0} },
|
||||
{0, GDK_R, sc_reload, NORMAL, {0} },
|
||||
{0, GDK_h, sc_scroll, NORMAL, { LEFT } },
|
||||
{0, GDK_j, sc_scroll, NORMAL, { DOWN } },
|
||||
{0, GDK_k, sc_scroll, NORMAL, { UP } },
|
||||
{0, GDK_l, sc_scroll, NORMAL, { RIGHT } },
|
||||
{0, GDK_Left, sc_scroll, NORMAL, { LEFT } },
|
||||
{0, GDK_Up, sc_scroll, NORMAL, { UP } },
|
||||
{0, GDK_Down, sc_scroll, NORMAL, { DOWN } },
|
||||
{0, GDK_Right, sc_scroll, NORMAL, { RIGHT } },
|
||||
{0, GDK_n, sc_search, NORMAL, { FORWARD } },
|
||||
{0, GDK_N, sc_search, NORMAL, { BACKWARD } },
|
||||
{0, GDK_a, sc_adjust_window, NORMAL, { ADJUST_BESTFIT } },
|
||||
{0, GDK_s, sc_adjust_window, NORMAL, { ADJUST_WIDTH } },
|
||||
{0, GDK_BackSpace, sc_change_buffer, -1, { DELETE_LAST } },
|
||||
{0, GDK_k, sc_navigate_index, INDEX, { UP } },
|
||||
{0, GDK_j, sc_navigate_index, INDEX, { DOWN } },
|
||||
{0, GDK_h, sc_navigate_index, INDEX, { COLLAPSE } },
|
||||
{0, GDK_l, sc_navigate_index, INDEX, { EXPAND } },
|
||||
{0, GDK_space, sc_navigate_index, INDEX, { SELECT } },
|
||||
{0, GDK_Return, sc_navigate_index, INDEX, { SELECT } },
|
||||
{0, GDK_F5, sc_toggle_fullscreen, FULLSCREEN, {0} },
|
||||
{0, GDK_Left, sc_navigate, FULLSCREEN, { PREVIOUS } },
|
||||
{0, GDK_Up, sc_navigate, FULLSCREEN, { PREVIOUS } },
|
||||
{0, GDK_Down, sc_navigate, FULLSCREEN, { NEXT } },
|
||||
{0, GDK_Right, sc_navigate, FULLSCREEN, { NEXT } },
|
||||
{0, GDK_space, sc_navigate, FULLSCREEN, { NEXT } },
|
||||
/* mask, key, function, mode, argument */
|
||||
{GDK_CONTROL_MASK, GDK_c, sc_abort, ALL, {0} },
|
||||
{0, GDK_a, sc_adjust_window, NORMAL, { ADJUST_BESTFIT } },
|
||||
{0, GDK_s, sc_adjust_window, NORMAL, { ADJUST_WIDTH } },
|
||||
{0, GDK_Escape, sc_abort, ALL, {0} },
|
||||
{0, GDK_BackSpace, sc_change_buffer, ALL, { DELETE_LAST } },
|
||||
{0, GDK_i, sc_change_mode, NORMAL, { INSERT } },
|
||||
{0, GDK_v, sc_change_mode, NORMAL, { VISUAL } },
|
||||
{0, GDK_m, sc_change_mode, NORMAL, { ADD_MARKER } },
|
||||
{0, GDK_apostrophe, sc_change_mode, NORMAL, { EVAL_MARKER } },
|
||||
{0, GDK_slash, sc_focus_inputbar, NORMAL, { .data = "/" } },
|
||||
{GDK_SHIFT_MASK, GDK_slash, sc_focus_inputbar, NORMAL, { .data = "/" } },
|
||||
{GDK_SHIFT_MASK, GDK_question, sc_focus_inputbar, NORMAL, { .data = "?" } },
|
||||
{0, GDK_colon, sc_focus_inputbar, NORMAL, { .data = ":" } },
|
||||
{0, GDK_o, sc_focus_inputbar, NORMAL, { .data = ":open " } },
|
||||
{0, GDK_f, sc_follow, NORMAL, {0} },
|
||||
{0, GDK_J, sc_navigate, NORMAL, { NEXT } },
|
||||
{0, GDK_K, sc_navigate, NORMAL, { PREVIOUS } },
|
||||
{GDK_MOD1_MASK, GDK_Right, sc_navigate, NORMAL, { NEXT } },
|
||||
{GDK_MOD1_MASK, GDK_Left, sc_navigate, NORMAL, { PREVIOUS } },
|
||||
{0, GDK_space, sc_navigate, NORMAL, { NEXT } },
|
||||
{0, GDK_Left, sc_navigate, FULLSCREEN, { PREVIOUS } },
|
||||
{0, GDK_Up, sc_navigate, FULLSCREEN, { PREVIOUS } },
|
||||
{0, GDK_Down, sc_navigate, FULLSCREEN, { NEXT } },
|
||||
{0, GDK_Right, sc_navigate, FULLSCREEN, { NEXT } },
|
||||
{0, GDK_space, sc_navigate, FULLSCREEN, { NEXT } },
|
||||
{0, GDK_k, sc_navigate_index, INDEX, { UP } },
|
||||
{0, GDK_j, sc_navigate_index, INDEX, { DOWN } },
|
||||
{0, GDK_h, sc_navigate_index, INDEX, { COLLAPSE } },
|
||||
{0, GDK_l, sc_navigate_index, INDEX, { EXPAND } },
|
||||
{0, GDK_space, sc_navigate_index, INDEX, { SELECT } },
|
||||
{0, GDK_Return, sc_navigate_index, INDEX, { SELECT } },
|
||||
{GDK_CONTROL_MASK, GDK_i, sc_recolor, NORMAL, {0} },
|
||||
{0, GDK_R, sc_reload, NORMAL, {0} },
|
||||
{0, GDK_r, sc_rotate, NORMAL, {0} },
|
||||
{0, GDK_n, sc_search, NORMAL, { FORWARD } },
|
||||
{0, GDK_N, sc_search, NORMAL, { BACKWARD } },
|
||||
{0, GDK_h, sc_scroll, NORMAL, { LEFT } },
|
||||
{0, GDK_j, sc_scroll, NORMAL, { DOWN } },
|
||||
{0, GDK_k, sc_scroll, NORMAL, { UP } },
|
||||
{0, GDK_l, sc_scroll, NORMAL, { RIGHT } },
|
||||
{0, GDK_Left, sc_scroll, NORMAL, { LEFT } },
|
||||
{0, GDK_Up, sc_scroll, NORMAL, { UP } },
|
||||
{0, GDK_Down, sc_scroll, NORMAL, { DOWN } },
|
||||
{0, GDK_Right, sc_scroll, NORMAL, { RIGHT } },
|
||||
{GDK_CONTROL_MASK, GDK_d, sc_scroll, NORMAL, { HALF_DOWN } },
|
||||
{GDK_CONTROL_MASK, GDK_u, sc_scroll, NORMAL, { HALF_UP } },
|
||||
{GDK_CONTROL_MASK, GDK_f, sc_scroll, NORMAL, { FULL_DOWN } },
|
||||
{GDK_CONTROL_MASK, GDK_b, sc_scroll, NORMAL, { FULL_UP } },
|
||||
{0, GDK_O, sc_switch_goto_mode, NORMAL, {0} },
|
||||
{0, GDK_F5, sc_toggle_fullscreen, NORMAL | FULLSCREEN, {0} },
|
||||
{0, GDK_Tab, sc_toggle_index, NORMAL | INDEX, {0} },
|
||||
{GDK_CONTROL_MASK, GDK_m, sc_toggle_inputbar, NORMAL, {0} },
|
||||
{GDK_CONTROL_MASK, GDK_n, sc_toggle_statusbar, NORMAL, {0} },
|
||||
{GDK_CONTROL_MASK, GDK_q, sc_quit, ALL, {0} },
|
||||
};
|
||||
|
||||
/* inputbar shortcuts */
|
||||
@ -279,7 +277,7 @@ ArgumentName argument_names[] = {
|
||||
|
||||
/* mode names */
|
||||
ModeName mode_names[] = {
|
||||
{"all", -1},
|
||||
{"all", ALL},
|
||||
{"fullscreen", FULLSCREEN},
|
||||
{"index", INDEX},
|
||||
{"insert", INSERT},
|
||||
|
26
zathura.c
26
zathura.c
@ -19,16 +19,20 @@
|
||||
#define LENGTH(x) sizeof(x)/sizeof((x)[0])
|
||||
|
||||
/* enums */
|
||||
enum { NEXT, PREVIOUS, LEFT, RIGHT, UP, DOWN,
|
||||
BOTTOM, TOP, HIDE, NORMAL, HIGHLIGHT,
|
||||
INSERT, VISUAL, DELETE_LAST_WORD, DEFAULT,
|
||||
ERROR, WARNING, NEXT_GROUP, PREVIOUS_GROUP,
|
||||
ZOOM_IN, ZOOM_OUT, ZOOM_ORIGINAL, ZOOM_SPECIFIC,
|
||||
FORWARD, BACKWARD, ADJUST_BESTFIT, ADJUST_WIDTH,
|
||||
ADJUST_NONE, CONTINUOUS, DELETE_LAST, ADD_MARKER,
|
||||
EVAL_MARKER, INDEX, EXPAND, COLLAPSE, SELECT,
|
||||
GOTO_DEFAULT, GOTO_LABELS, GOTO_OFFSET, FULLSCREEN,
|
||||
HALF_UP, HALF_DOWN, FULL_UP, FULL_DOWN };
|
||||
enum { NEXT, PREVIOUS, LEFT, RIGHT, UP, DOWN, BOTTOM, TOP, HIDE, HIGHLIGHT,
|
||||
DELETE_LAST_WORD, DEFAULT, ERROR, WARNING, NEXT_GROUP, PREVIOUS_GROUP,
|
||||
ZOOM_IN, ZOOM_OUT, ZOOM_ORIGINAL, ZOOM_SPECIFIC, FORWARD, BACKWARD,
|
||||
ADJUST_BESTFIT, ADJUST_WIDTH, ADJUST_NONE, CONTINUOUS, DELETE_LAST,
|
||||
ADD_MARKER, EVAL_MARKER, EXPAND, COLLAPSE, SELECT, GOTO_DEFAULT, GOTO_LABELS,
|
||||
GOTO_OFFSET, HALF_UP, HALF_DOWN, FULL_UP, FULL_DOWN };
|
||||
|
||||
/* define modes */
|
||||
#define ALL (1 << 0)
|
||||
#define FULLSCREEN (1 << 1)
|
||||
#define INDEX (1 << 2)
|
||||
#define INSERT (1 << 3)
|
||||
#define NORMAL (1 << 4)
|
||||
#define VISUAL (1 << 5)
|
||||
|
||||
/* typedefs */
|
||||
struct CElement
|
||||
@ -3876,7 +3880,7 @@ cb_view_kb_pressed(GtkWidget *widget, GdkEventKey *event, gpointer data)
|
||||
if( event->keyval == sc->element.key &&
|
||||
((event->state == sc->element.mask) ||
|
||||
((sc->element.mask == 0) && (sc->element.key >= 20 && sc->element.key <= 126))) &&
|
||||
(Zathura.Global.mode == sc->element.mode || sc->element.mode == -1) &&
|
||||
(Zathura.Global.mode & sc->element.mode || sc->element.mode == ALL) &&
|
||||
sc->element.function
|
||||
)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user