From a011f8afad5f2519f489d10cf4277bdea28f0ec9 Mon Sep 17 00:00:00 2001 From: David Yang Date: Fri, 12 May 2023 12:20:33 +0800 Subject: [PATCH] Save font size when changing zoom level with keyboard shortcuts --- guake/guake_app.py | 10 ++++++++-- releasenotes/notes/save_zoom-8b8f54485b975e7c.yaml | 7 +++++++ 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/save_zoom-8b8f54485b975e7c.yaml diff --git a/guake/guake_app.py b/guake/guake_app.py index 65cfd5fa0..d524275d6 100644 --- a/guake/guake_app.py +++ b/guake/guake_app.py @@ -937,14 +937,20 @@ def accel_reset_terminal(self, *args): def accel_zoom_in(self, *args): """Callback to zoom in.""" + font = " ".join(self.settings.styleFont.get_string("style").split(" ")[:-1]) + new_size = int(self.settings.styleFont.get_string("style").split(" ")[-1]) + 1 + self.settings.styleFont.set_string("style", f"{font} {new_size}") for term in self.get_notebook().iter_terminals(): - term.increase_font_size() + term.set_font_scale(new_size / (new_size - 1)) return True def accel_zoom_out(self, *args): """Callback to zoom out.""" + font = " ".join(self.settings.styleFont.get_string("style").split(" ")[:-1]) + new_size = int(self.settings.styleFont.get_string("style").split(" ")[-1]) - 1 + self.settings.styleFont.set_string("style", f"{font} {new_size}") for term in self.get_notebook().iter_terminals(): - term.decrease_font_size() + term.set_font_scale((new_size - 1) / new_size) return True def accel_increase_height(self, *args): diff --git a/releasenotes/notes/save_zoom-8b8f54485b975e7c.yaml b/releasenotes/notes/save_zoom-8b8f54485b975e7c.yaml new file mode 100644 index 000000000..bab2c8c7c --- /dev/null +++ b/releasenotes/notes/save_zoom-8b8f54485b975e7c.yaml @@ -0,0 +1,7 @@ +release_summary: > + Save font size when changing zoom level with keyboard shortcuts + +fixes: + - | + - Opening a new tab resets the zoom level/ #2109 +