From d4d9c34d622e24fa9aafcb1bdf0020174622fd00 Mon Sep 17 00:00:00 2001 From: Anderson Laverde Gracia Date: Wed, 8 Sep 2021 10:28:51 -0500 Subject: [PATCH 1/2] fix brightness on closed laptop --- src/Widgets/ScreenBrightness.vala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Widgets/ScreenBrightness.vala b/src/Widgets/ScreenBrightness.vala index 39def320..54e24ab7 100644 --- a/src/Widgets/ScreenBrightness.vala +++ b/src/Widgets/ScreenBrightness.vala @@ -41,7 +41,9 @@ public class Power.Widgets.ScreenBrightness : Gtk.Grid { dm.brightness_changed.connect ((brightness) => { brightness_slider.value_changed.disconnect (on_scale_value_changed); - brightness_slider.set_value ((double)brightness); + if (brightness > 0) { + brightness_slider.set_value ((double)brightness); + } brightness_slider.value_changed.connect (on_scale_value_changed); }); From 411b8428d20098e9d9d81b30fd8720ff98086222 Mon Sep 17 00:00:00 2001 From: Anderson Laverde Gracia Date: Wed, 8 Sep 2021 10:47:46 -0500 Subject: [PATCH 2/2] fix brightness --- src/Widgets/ScreenBrightness.vala | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Widgets/ScreenBrightness.vala b/src/Widgets/ScreenBrightness.vala index 80cb97f9..ad7d515a 100644 --- a/src/Widgets/ScreenBrightness.vala +++ b/src/Widgets/ScreenBrightness.vala @@ -64,15 +64,18 @@ public class Power.Widgets.ScreenBrightness : Gtk.EventBox { }); brightness_slider.value_changed.connect ((value) => { - if (value > 0) { - brightness_slider.set_value (value.get_value ()); - dm.brightness = (int) value.get_value (); + var brightness = value.get_value (); + if (brightness > 0) { + brightness_slider.set_value (brightness); + dm.brightness = (int) brightness; } }); dm.brightness_changed.connect ((brightness) => { - brightness_slider.set_value ((double)brightness); + if (brightness > 0) { + brightness_slider.set_value ((double)brightness); + } }); }