diff --git a/data/Indicator.css b/data/Indicator.css index 4ca5a81..17d3184 100644 --- a/data/Indicator.css +++ b/data/Indicator.css @@ -9,7 +9,7 @@ quicksettings .togglebox { } quicksettings scalebox scale { - margin: 0.666rem 0.666rem 0; /* 6px */ + margin: 0 0.333rem 0 0.666rem; /* 0 3px 0 6px */ } quicksettings separator.horizontal { diff --git a/data/icons/text-large.svg b/data/icons/text-large.svg new file mode 100644 index 0000000..4846240 --- /dev/null +++ b/data/icons/text-large.svg @@ -0,0 +1,18 @@ + + diff --git a/data/icons/text-small.svg b/data/icons/text-small.svg new file mode 100644 index 0000000..7f986c5 --- /dev/null +++ b/data/icons/text-small.svg @@ -0,0 +1,49 @@ + + diff --git a/data/quick-settings.gresource.xml b/data/quick-settings.gresource.xml index 8ed165f..9cbf059 100644 --- a/data/quick-settings.gresource.xml +++ b/data/quick-settings.gresource.xml @@ -8,6 +8,8 @@ icons/dark-mode.svg icons/system-suspend.svg + icons/text-large.svg + icons/text-small.svg icons/quick-settings.svg icons/rotation-allowed.svg icons/rotation-locked.svg diff --git a/src/Widgets/TextScale.vala b/src/Widgets/TextScale.vala index cffcd2a..7ff9e98 100644 --- a/src/Widgets/TextScale.vala +++ b/src/Widgets/TextScale.vala @@ -4,8 +4,7 @@ */ public class QuickSettings.TextScale : Gtk.Box { - private Gtk.Button zoom_in_button; - private Gtk.Button zoom_out_button; + private Gtk.Button zoom_button; private Settings interface_settings; class construct { @@ -13,10 +12,8 @@ public class QuickSettings.TextScale : Gtk.Box { } construct { - zoom_out_button = new Gtk.Button.from_icon_name ("format-text-smaller-symbolic") { - tooltip_text = _("Decrease text size") - }; - zoom_out_button.get_style_context ().add_class ("circular"); + zoom_button = new Gtk.Button.from_icon_name ("quick-settings-text-small-symbolic"); + zoom_button.get_style_context ().add_class ("toggle"); var zoom_adjustment = new Gtk.Adjustment (-1, 0.75, 1.75, 0.05, 0, 0); @@ -24,36 +21,32 @@ public class QuickSettings.TextScale : Gtk.Box { draw_value = false, hexpand = true }; - zoom_scale.add_mark (1, BOTTOM, null); - zoom_scale.add_mark (1.5, BOTTOM, null); - - zoom_in_button = new Gtk.Button.from_icon_name ("format-text-larger-symbolic") { - tooltip_text = _("Increase text size") - }; - zoom_in_button.get_style_context ().add_class ("circular"); - get_style_context ().add_class ("font-size"); - add (zoom_out_button); + add (zoom_button); add (zoom_scale); - add (zoom_in_button); interface_settings = new Settings ("org.gnome.desktop.interface"); interface_settings.bind ("text-scaling-factor", zoom_adjustment, "value", DEFAULT); interface_settings.changed["text-scaling-factor"].connect (update_zoom_buttons); update_zoom_buttons (); - zoom_in_button.clicked.connect (() => { - zoom_adjustment.value += 0.05; - }); - - zoom_out_button.clicked.connect (() => { - zoom_adjustment.value += -0.05; + zoom_button.clicked.connect (() => { + if (zoom_adjustment.value > 1) { + zoom_adjustment.value = 1; + } else { + zoom_adjustment.value = 1.25; + } }); } private void update_zoom_buttons () { var scaling_factor = interface_settings.get_double ("text-scaling-factor"); - zoom_in_button.sensitive = scaling_factor < 1.75; - zoom_out_button.sensitive = scaling_factor > 0.75; + if (scaling_factor > 1) { + ((Gtk.Image) zoom_button.image).icon_name = "quick-settings-text-large-symbolic"; + zoom_button.tooltip_text = _("Decrease text size"); + } else { + ((Gtk.Image) zoom_button.image).icon_name = "quick-settings-text-small-symbolic"; + zoom_button.tooltip_text = _("Increase text size"); + } } }