2015-09-04 13:32:40 +02:00
|
|
|
Index: gnome-settings-daemon-3.17.2/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in.in
|
2015-03-19 15:37:09 +01:00
|
|
|
===================================================================
|
2015-09-04 13:32:40 +02:00
|
|
|
--- gnome-settings-daemon-3.17.2.orig/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in.in
|
|
|
|
+++ gnome-settings-daemon-3.17.2/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in.in
|
2014-05-28 13:59:19 +02:00
|
|
|
@@ -66,5 +66,10 @@
|
2015-09-04 13:32:40 +02:00
|
|
|
<summary>Enable the ALS sensor</summary>
|
|
|
|
<description>If the ambient light sensor functionality is enabled.</description>
|
2013-01-21 17:38:42 +01:00
|
|
|
</key>
|
|
|
|
+ <key name="notify-idle-resumed" type="b">
|
|
|
|
+ <default>true</default>
|
|
|
|
+ <_summary>If an information message should be displayed when returning from idle sleep.</_summary>
|
|
|
|
+ <_description>If an information message should be displayed when returning from idle sleep.</_description>
|
|
|
|
+ </key>
|
|
|
|
</schema>
|
|
|
|
</schemalist>
|
2015-09-04 13:32:40 +02:00
|
|
|
Index: gnome-settings-daemon-3.17.2/plugins/power/gsd-power-manager.c
|
2015-03-19 15:37:09 +01:00
|
|
|
===================================================================
|
2015-09-04 13:32:40 +02:00
|
|
|
--- gnome-settings-daemon-3.17.2.orig/plugins/power/gsd-power-manager.c
|
|
|
|
+++ gnome-settings-daemon-3.17.2/plugins/power/gsd-power-manager.c
|
|
|
|
@@ -148,6 +148,7 @@ struct GsdPowerManagerPrivate
|
2014-05-28 13:59:19 +02:00
|
|
|
NotifyNotification *notification_ups_discharging;
|
2013-01-21 17:38:42 +01:00
|
|
|
NotifyNotification *notification_low;
|
2013-03-13 23:54:12 +01:00
|
|
|
NotifyNotification *notification_sleep_warning;
|
2013-01-21 17:38:42 +01:00
|
|
|
+ NotifyNotification *notification_resumed;
|
2013-03-13 23:54:12 +01:00
|
|
|
GsdPowerActionType sleep_action_type;
|
|
|
|
gboolean battery_is_low; /* laptop battery low, or UPS discharging */
|
|
|
|
|
2015-09-04 13:32:40 +02:00
|
|
|
@@ -183,6 +184,7 @@ struct GsdPowerManagerPrivate
|
2013-03-13 23:54:12 +01:00
|
|
|
guint inhibit_lid_switch_timer_id;
|
2013-01-21 17:38:42 +01:00
|
|
|
gboolean is_virtual_machine;
|
2015-03-19 15:37:09 +01:00
|
|
|
gboolean is_tablet;
|
|
|
|
+ GsdPowerActionType last_idle_power_action;
|
2013-01-21 17:38:42 +01:00
|
|
|
|
2013-03-13 23:54:12 +01:00
|
|
|
/* Idles */
|
|
|
|
GnomeIdleMonitor *idle_monitor;
|
2015-09-04 13:32:40 +02:00
|
|
|
@@ -1477,6 +1479,49 @@ is_session_active (GsdPowerManager *mana
|
2013-01-21 17:38:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
+show_resumed_notification (GsdPowerManager *manager)
|
|
|
|
+{
|
|
|
|
+ GError *error = NULL;
|
|
|
|
+ gboolean ret;
|
|
|
|
+
|
|
|
|
+ /* don't show when running under GDM */
|
|
|
|
+ if (g_getenv ("RUNNING_UNDER_GDM") != NULL) {
|
|
|
|
+ g_debug ("running under gdm, so no notification");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ret = g_settings_get_boolean (manager->priv->settings, "notify-idle-resumed");
|
|
|
|
+ if (!ret)
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+ /* close any existing notification of this class */
|
2014-05-28 13:59:19 +02:00
|
|
|
+ notify_close_if_showing (&manager->priv->notification_resumed);
|
2013-01-21 17:38:42 +01:00
|
|
|
+
|
|
|
|
+ /* create a new notification */
|
|
|
|
+ create_notification (_("System resumed from sleep"),
|
|
|
|
+ _("The system automatically went to sleep because the system was idle."),
|
|
|
|
+ NULL,
|
|
|
|
+ &manager->priv->notification_resumed);
|
|
|
|
+ notify_notification_set_timeout (manager->priv->notification_resumed,
|
|
|
|
+ GSD_POWER_MANAGER_NOTIFY_TIMEOUT_SHORT);
|
|
|
|
+ notify_notification_set_urgency (manager->priv->notification_resumed,
|
|
|
|
+ NOTIFY_URGENCY_NORMAL);
|
|
|
|
+ /* TRANSLATORS: this is the notification application name */
|
|
|
|
+ notify_notification_set_app_name (manager->priv->notification_resumed, _("Power"));
|
|
|
|
+ notify_notification_set_hint (manager->priv->notification_resumed,
|
|
|
|
+ "transient", g_variant_new_boolean (TRUE));
|
|
|
|
+
|
|
|
|
+ /* try to show */
|
|
|
|
+ ret = notify_notification_show (manager->priv->notification_resumed,
|
|
|
|
+ &error);
|
|
|
|
+ if (!ret) {
|
|
|
|
+ g_warning ("failed to show notification: %s", error->message);
|
|
|
|
+ g_error_free (error);
|
|
|
|
+ g_object_unref (manager->priv->notification_resumed);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static void
|
|
|
|
idle_set_mode (GsdPowerManager *manager, GsdPowerIdleMode mode)
|
|
|
|
{
|
|
|
|
gboolean ret = FALSE;
|
2015-09-04 13:32:40 +02:00
|
|
|
@@ -1568,6 +1613,7 @@ idle_set_mode (GsdPowerManager *manager,
|
2013-01-21 17:38:42 +01:00
|
|
|
action_type = g_settings_get_enum (manager->priv->settings,
|
|
|
|
"sleep-inactive-ac-type");
|
|
|
|
}
|
|
|
|
+ manager->priv->last_idle_power_action = action_type;
|
|
|
|
do_power_action_type (manager, action_type);
|
|
|
|
|
|
|
|
/* turn on screen and restore user-selected brightness level */
|
2015-09-04 13:32:40 +02:00
|
|
|
@@ -2340,6 +2386,12 @@ handle_suspend_actions (GsdPowerManager
|
2014-05-28 13:59:19 +02:00
|
|
|
static void
|
|
|
|
handle_resume_actions (GsdPowerManager *manager)
|
|
|
|
{
|
2013-01-21 17:38:42 +01:00
|
|
|
+ if (manager->priv->last_idle_power_action == GSD_POWER_ACTION_SUSPEND ||
|
|
|
|
+ manager->priv->last_idle_power_action == GSD_POWER_ACTION_HIBERNATE)
|
|
|
|
+ show_resumed_notification (manager);
|
|
|
|
+
|
|
|
|
+ manager->priv->last_idle_power_action = GSD_POWER_ACTION_NOTHING;
|
|
|
|
+
|
|
|
|
/* ensure we turn the panel back on after resume */
|
2013-03-13 23:54:12 +01:00
|
|
|
backlight_enable (manager);
|
|
|
|
|
2015-09-04 13:32:40 +02:00
|
|
|
@@ -2349,6 +2401,7 @@ handle_resume_actions (GsdPowerManager *
|
2014-05-28 13:59:19 +02:00
|
|
|
|
|
|
|
/* set up the delay again */
|
|
|
|
inhibit_suspend (manager);
|
|
|
|
+
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|