Make only possible hints visible
Originally written by numeral <numerical@gmail.com>
This commit is contained in:
parent
4b08fd998b
commit
b10a5f2fac
3
config
3
config
|
@ -25,6 +25,9 @@ cursor_shape = block
|
||||||
# set size hints for the window
|
# set size hints for the window
|
||||||
#size_hints = false
|
#size_hints = false
|
||||||
|
|
||||||
|
# Hide links that are no longer valid in url select overlay mode
|
||||||
|
filter_unmatched_urls = true
|
||||||
|
|
||||||
# emit escape sequences for other keys modified by Control
|
# emit escape sequences for other keys modified by Control
|
||||||
#modify_other_keys = false
|
#modify_other_keys = false
|
||||||
|
|
||||||
|
|
17
termite.cc
17
termite.cc
|
@ -118,7 +118,8 @@ struct hint_info {
|
||||||
struct config_info {
|
struct config_info {
|
||||||
hint_info hints;
|
hint_info hints;
|
||||||
char *browser;
|
char *browser;
|
||||||
gboolean dynamic_title, urgent_on_bell, clickable_url, size_hints, modify_other_keys;
|
gboolean dynamic_title, urgent_on_bell, clickable_url, size_hints;
|
||||||
|
gboolean filter_unmatched_urls, modify_other_keys;
|
||||||
gboolean fullscreen;
|
gboolean fullscreen;
|
||||||
int tag;
|
int tag;
|
||||||
char *config_file;
|
char *config_file;
|
||||||
|
@ -137,6 +138,7 @@ struct draw_cb_info {
|
||||||
VteTerminal *vte;
|
VteTerminal *vte;
|
||||||
search_panel_info *panel;
|
search_panel_info *panel;
|
||||||
hint_info *hints;
|
hint_info *hints;
|
||||||
|
gboolean filter_unmatched_urls;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void launch_browser(char *browser, char *url);
|
static void launch_browser(char *browser, char *url);
|
||||||
|
@ -387,6 +389,7 @@ static gboolean draw_cb(const draw_cb_info *info, cairo_t *cr) {
|
||||||
if (len)
|
if (len)
|
||||||
active = strncmp(buffer, info->panel->fulltext, len) == 0;
|
active = strncmp(buffer, info->panel->fulltext, len) == 0;
|
||||||
|
|
||||||
|
if (!info->filter_unmatched_urls || active || len == 0)
|
||||||
draw_marker(cr, desc, info->hints, x, y, buffer, active);
|
draw_marker(cr, desc, info->hints, x, y, buffer, active);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -945,6 +948,13 @@ gboolean entry_key_press_cb(GtkEntry *entry, GdkEventKey *event, keybind_info *i
|
||||||
}
|
}
|
||||||
switch (event->keyval) {
|
switch (event->keyval) {
|
||||||
case GDK_KEY_BackSpace:
|
case GDK_KEY_BackSpace:
|
||||||
|
if (info->panel.mode == overlay_mode::urlselect) {
|
||||||
|
size_t slen = strlen(info->panel.fulltext);
|
||||||
|
if (info->panel.fulltext != nullptr && slen > 0)
|
||||||
|
info->panel.fulltext[slen-1] = '\0';
|
||||||
|
gtk_widget_queue_draw(info->panel.da);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case GDK_KEY_0:
|
case GDK_KEY_0:
|
||||||
case GDK_KEY_1:
|
case GDK_KEY_1:
|
||||||
case GDK_KEY_2:
|
case GDK_KEY_2:
|
||||||
|
@ -1325,6 +1335,7 @@ static void set_config(GtkWindow *window, VteTerminal *vte, config_info *info,
|
||||||
info->urgent_on_bell = cfg_bool("urgent_on_bell", TRUE);
|
info->urgent_on_bell = cfg_bool("urgent_on_bell", TRUE);
|
||||||
info->clickable_url = cfg_bool("clickable_url", TRUE);
|
info->clickable_url = cfg_bool("clickable_url", TRUE);
|
||||||
info->size_hints = cfg_bool("size_hints", FALSE);
|
info->size_hints = cfg_bool("size_hints", FALSE);
|
||||||
|
info->filter_unmatched_urls = cfg_bool("filter_unmatched_urls", TRUE);
|
||||||
info->modify_other_keys = cfg_bool("modify_other_keys", FALSE);
|
info->modify_other_keys = cfg_bool("modify_other_keys", FALSE);
|
||||||
info->fullscreen = cfg_bool("fullscreen", TRUE);
|
info->fullscreen = cfg_bool("fullscreen", TRUE);
|
||||||
|
|
||||||
|
@ -1511,7 +1522,7 @@ int main(int argc, char **argv) {
|
||||||
nullptr},
|
nullptr},
|
||||||
{vi_mode::insert, 0, 0, 0, 0},
|
{vi_mode::insert, 0, 0, 0, 0},
|
||||||
{{nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, 0, 0, 0},
|
{{nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, 0, 0, 0},
|
||||||
nullptr, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, config_file},
|
nullptr, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, -1, config_file},
|
||||||
gtk_window_fullscreen
|
gtk_window_fullscreen
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1551,7 +1562,7 @@ int main(int argc, char **argv) {
|
||||||
g_signal_connect(panel_overlay, "get-child-position", G_CALLBACK(position_overlay_cb), nullptr);
|
g_signal_connect(panel_overlay, "get-child-position", G_CALLBACK(position_overlay_cb), nullptr);
|
||||||
g_signal_connect(vte, "button-press-event", G_CALLBACK(button_press_cb), &info.config);
|
g_signal_connect(vte, "button-press-event", G_CALLBACK(button_press_cb), &info.config);
|
||||||
g_signal_connect(vte, "bell", G_CALLBACK(bell_cb), &info.config.urgent_on_bell);
|
g_signal_connect(vte, "bell", G_CALLBACK(bell_cb), &info.config.urgent_on_bell);
|
||||||
draw_cb_info draw_cb_info{vte, &info.panel, &info.config.hints};
|
draw_cb_info draw_cb_info{vte, &info.panel, &info.config.hints, info.config.filter_unmatched_urls};
|
||||||
g_signal_connect_swapped(info.panel.da, "draw", G_CALLBACK(draw_cb), &draw_cb_info);
|
g_signal_connect_swapped(info.panel.da, "draw", G_CALLBACK(draw_cb), &draw_cb_info);
|
||||||
|
|
||||||
g_signal_connect(window, "focus-in-event", G_CALLBACK(focus_cb), nullptr);
|
g_signal_connect(window, "focus-in-event", G_CALLBACK(focus_cb), nullptr);
|
||||||
|
|
Loading…
Reference in New Issue