tweak: Add hide searchbar option

Also bring config.def.h up to date
This commit is contained in:
NunoSempere 2022-12-16 01:27:04 +01:00
parent ca5438c626
commit 350e6022df
3 changed files with 32 additions and 19 deletions

View File

@ -45,9 +45,11 @@ typedef enum {
prev_tab, prev_tab,
close_tab, close_tab,
show_searchbar, show_searchbar,
hide_searchbar,
show_finder, show_finder,
finder_next, finder_next,
finder_prev finder_prev
prettify
} func; } func;
#define SFT 1 << 0 #define SFT 1 << 0
@ -59,22 +61,24 @@ static struct {
unsigned key; unsigned key;
func id; func id;
} keys[] = { } keys[] = {
{ CTRL, KEY(h), goback }, { CTRL, KEY(h), goback },
{ CTRL, KEY(l), goforward }, { CTRL, KEY(l), goforward },
{ CTRL, KEY(r), refresh }, { CTRL, KEY(r), refresh },
{ CTRL | SFT, KEY(R), refresh_force }, { CTRL | SFT, KEY(R), refresh_force },
{ CTRL | SFT, KEY(H), back_to_home }, { CTRL | SFT, KEY(H), back_to_home },
{ CTRL, KEY(equal), zoomin }, { CTRL, KEY(equal), zoomin },
{ CTRL, KEY(minus), zoomout }, { CTRL, KEY(minus), zoomout },
{ CTRL, KEY(0), zoom_reset }, { CTRL, KEY(0), zoom_reset },
{ ALT, KEY(h), prev_tab }, { ALT, KEY(h), prev_tab },
{ ALT, KEY(l), next_tab }, { ALT, KEY(l), next_tab },
{ CTRL, KEY(w), close_tab }, { CTRL, KEY(w), close_tab },
{ 0x0, KEY(F11), toggle_fullscreen }, { 0x0, KEY(F11), toggle_fullscreen },
{ CTRL, KEY(e), show_searchbar }, { CTRL, KEY(e), show_searchbar },
{ CTRL, KEY(f), show_finder }, { CTRL, KEY(k), hide_searchbar },
{ CTRL, KEY(n), finder_next }, { CTRL, KEY(f), show_finder },
{ CTRL | SFT, KEY(N), finder_prev } { CTRL, KEY(n), finder_next },
{ CTRL | SFT, KEY(N), finder_prev },
{ CTRL, KEY(p), prettify }
}; };
/* For controls more akin to normal browsers, use: /* For controls more akin to normal browsers, use:
@ -94,7 +98,8 @@ static struct {
{ CTRL, KEY(l), show_searchbar }, { CTRL, KEY(l), show_searchbar },
{ CTRL, KEY(f), show_finder }, { CTRL, KEY(f), show_finder },
{ CTRL, KEY(n), finder_next }, { CTRL, KEY(n), finder_next },
{ CTRL | SFT, KEY(N), finder_prev } { CTRL | SFT, KEY(N), finder_prev },
{ CTRL, KEY(p), prettify }
}; };
*/ */
/* Reference for the key shorthand: /* Reference for the key shorthand:

View File

@ -46,6 +46,7 @@ typedef enum {
prev_tab, prev_tab,
close_tab, close_tab,
show_searchbar, show_searchbar,
hide_searchbar,
show_finder, show_finder,
finder_next, finder_next,
finder_prev, finder_prev,
@ -75,10 +76,11 @@ static struct {
{ CTRL, KEY(w), close_tab }, { CTRL, KEY(w), close_tab },
{ 0x0, KEY(F11), toggle_fullscreen }, { 0x0, KEY(F11), toggle_fullscreen },
{ CTRL, KEY(l), show_searchbar }, { CTRL, KEY(l), show_searchbar },
{ CTRL, KEY(k), hide_searchbar },
{ CTRL, KEY(f), show_finder }, { CTRL, KEY(f), show_finder },
{ CTRL, KEY(n), finder_next }, { CTRL, KEY(n), finder_next },
{ CTRL | SFT, KEY(N), finder_prev }, { CTRL | SFT, KEY(N), finder_prev },
{ CTRL, KEY(p), prettify }, { CTRL, KEY(p), prettify }
}; };
/* ^ For controls more akin to normal browsers */ /* ^ For controls more akin to normal browsers */
/* Reference for the key shorthand: /* Reference for the key shorthand:
@ -94,12 +96,14 @@ static struct {
{ CTRL, KEY(minus), zoomout }, { CTRL, KEY(minus), zoomout },
{ CTRL, KEY(0), zoom_reset }, { CTRL, KEY(0), zoom_reset },
{ ALT, KEY(h), prev_tab }, { ALT, KEY(h), prev_tab },
{ CTRL, KEY(k), hide_searchbar },
{ ALT, KEY(l), next_tab }, { ALT, KEY(l), next_tab },
{ CTRL, KEY(w), close_tab }, { CTRL, KEY(w), close_tab },
{ 0x0, KEY(F11), toggle_fullscreen }, { 0x0, KEY(F11), toggle_fullscreen },
{ CTRL, KEY(e), show_searchbar }, { CTRL, KEY(e), show_searchbar },
{ CTRL, KEY(f), show_finder }, { CTRL, KEY(f), show_finder },
{ CTRL, KEY(n), finder_next }, { CTRL, KEY(n), finder_next },
{ CTRL | SFT, KEY(N), finder_prev } { CTRL | SFT, KEY(N), finder_prev },
{ CTRL, KEY(p), prettify }
}; };
*/ */

4
rose.c
View File

@ -259,6 +259,10 @@ int handle_key(func id, GtkNotebook *notebook)
entry_mode = _SEARCH; entry_mode = _SEARCH;
show_bar(notebook); show_bar(notebook);
break; break;
case hide_searchbar:
gtk_widget_hide(GTK_WIDGET(bar));
break;
case show_finder: case show_finder:
entry_mode = _FIND; entry_mode = _FIND;