Created
June 24, 2015 13:35
-
-
Save nachanon/0ce5742970c8a3ed7aa6 to your computer and use it in GitHub Desktop.
Improved patch for MATE Power Manager 1.8.0 to fix backlight brightness reset on login (AC-power only)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From: Nachanon Vetjasit <nachanon@users.noreply.github.com> | |
Subject: Save AC-power backlight set via brightness keys in GSettings | |
Bug: https://github.com/mate-desktop/mate-power-manager/issues/76 | |
Bug-Debian: https://bugs.debian.org/785017 | |
Based on a patch by Flos Lonicerae. | |
--- a/src/gpm-backlight.c | |
+++ b/src/gpm-backlight.c | |
@@ -429,6 +429,7 @@ | |
GError *error = NULL; | |
guint percentage; | |
gboolean hw_changed; | |
+ gboolean on_battery; | |
egg_debug ("Button press event type=%s", type); | |
if (g_strcmp0 (type, GPM_BUTTON_BRIGHT_UP) == 0) { | |
@@ -444,6 +445,13 @@ | |
gpm_backlight_dialog_show (backlight); | |
/* save the new percentage */ | |
backlight->priv->master_percentage = percentage; | |
+ /* if using AC power supply, save the new brightness settings */ | |
+ g_object_get (backlight->priv->client, "on-battery", &on_battery, NULL); | |
+ if (!on_battery) { | |
+ egg_debug ("saving brightness for ac supply: %i", percentage); | |
+ g_settings_set_double (backlight->priv->settings, GPM_SETTINGS_BRIGHTNESS_AC, | |
+ percentage*1.0); | |
+ } | |
} | |
/* we emit a signal for the brightness applet */ | |
if (ret && hw_changed) { | |
@@ -463,6 +471,13 @@ | |
gpm_backlight_dialog_show (backlight); | |
/* save the new percentage */ | |
backlight->priv->master_percentage = percentage; | |
+ /* if using AC power supply, save the new brightness settings */ | |
+ g_object_get (backlight->priv->client, "on-battery", &on_battery, NULL); | |
+ if (!on_battery) { | |
+ egg_debug ("saving brightness for ac supply: %i", percentage); | |
+ g_settings_set_double (backlight->priv->settings, GPM_SETTINGS_BRIGHTNESS_AC, | |
+ percentage*1.0); | |
+ } | |
} | |
/* we emit a signal for the brightness applet */ | |
if (ret && hw_changed) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment