Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15
gnome-settings-daemon.11222
gnome-settings-daemon-notify-idle-resumed.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File gnome-settings-daemon-notify-idle-resumed.patch of Package gnome-settings-daemon.11222
Index: gnome-settings-daemon-3.26.0/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in.in =================================================================== --- gnome-settings-daemon-3.26.0.orig/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in.in 2017-09-01 14:12:11.000000000 +0200 +++ gnome-settings-daemon-3.26.0/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in.in 2017-09-14 13:46:40.155168354 +0200 @@ -40,5 +40,10 @@ <_summary>Power button action</_summary> <_description>The action to take when the system power button is pressed. This action is hard-coded (and the setting ignored) on virtual machines (power off) and tablets (suspend).</_description> </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> Index: gnome-settings-daemon-3.26.0/plugins/power/gsd-power-manager.c =================================================================== --- gnome-settings-daemon-3.26.0.orig/plugins/power/gsd-power-manager.c 2017-09-01 14:12:11.000000000 +0200 +++ gnome-settings-daemon-3.26.0/plugins/power/gsd-power-manager.c 2017-09-14 13:46:40.155168354 +0200 @@ -153,6 +153,7 @@ NotifyNotification *notification_ups_discharging; NotifyNotification *notification_low; NotifyNotification *notification_sleep_warning; + NotifyNotification *notification_resumed; GsdPowerActionType sleep_action_type; gboolean battery_is_low; /* laptop battery low, or UPS discharging */ @@ -188,6 +189,7 @@ guint inhibit_lid_switch_timer_id; gboolean is_virtual_machine; gboolean is_tablet; + GsdPowerActionType last_idle_power_action; /* Idles */ GnomeIdleMonitor *idle_monitor; @@ -1514,6 +1516,49 @@ } 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 */ + notify_close_if_showing (&manager->priv->notification_resumed); + + /* 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; @@ -1603,6 +1648,7 @@ 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 */ @@ -2382,6 +2428,12 @@ static void handle_resume_actions (GsdPowerManager *manager) { + 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 */ backlight_enable (manager);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor