From 5d099931e332b16d6cbb1a3ee724898e68e76c60 Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Sun, 17 Jan 2016 19:28:46 +0100 Subject: [PATCH] Reset font size to startup default using a keybinding Reset the font size to the default startup value by pressing '=' in selection mode. Closes: #164 --- README.rst | 2 ++ man/termite.1 | 2 ++ termite.cc | 9 +++++++++ 3 files changed, 13 insertions(+) diff --git a/README.rst b/README.rst index 3a0b9fb..770e319 100644 --- a/README.rst +++ b/README.rst @@ -146,6 +146,8 @@ SELECTION MODE +-----------------------------------+-----------------------------------------------------------+ | ``-`` | decrease font size | +-----------------------------------+-----------------------------------------------------------+ +| ``=`` | reset font size to default | ++-----------------------------------+-----------------------------------------------------------+ During scrollback search, the current selection is changed to the search match and copied to the PRIMARY clipboard buffer. diff --git a/man/termite.1 b/man/termite.1 index e49e8ba..0ea511f 100644 --- a/man/termite.1 +++ b/man/termite.1 @@ -135,6 +135,8 @@ previous search match increase font size .IP "\fB-\fP" decrease font size +.IP "\fB=\fP" +reset font size to default .SS Hints Mode The \fBHints Mode\fP is meant for accessing urls outputted to the terminal. diff --git a/termite.cc b/termite.cc index b32b366..d5f99c2 100644 --- a/termite.cc +++ b/termite.cc @@ -123,6 +123,7 @@ struct config_info { gboolean fullscreen; int tag; char *config_file; + gdouble font_scale; }; struct keybind_info { @@ -722,6 +723,10 @@ void window_title_cb(VteTerminal *vte, gboolean *dynamic_title) { title ? title : "termite"); } +static void reset_font_scale(VteTerminal *vte, gdouble scale) { + vte_terminal_set_font_scale(vte, scale); +} + static void increase_font_scale(VteTerminal *vte) { gdouble scale = vte_terminal_get_font_scale(vte); @@ -902,6 +907,9 @@ gboolean key_press_cb(VteTerminal *vte, GdkEventKey *event, keybind_info *info) case GDK_KEY_minus: decrease_font_scale(vte); break; + case GDK_KEY_equal: + reset_font_scale(vte, info->config.font_scale); + break; } return TRUE; } @@ -1371,6 +1379,7 @@ static void set_config(GtkWindow *window, VteTerminal *vte, config_info *info, info->filter_unmatched_urls = cfg_bool("filter_unmatched_urls", TRUE); info->modify_other_keys = cfg_bool("modify_other_keys", FALSE); info->fullscreen = cfg_bool("fullscreen", TRUE); + info->font_scale = vte_terminal_get_font_scale(vte); g_free(info->browser); info->browser = nullptr;