parent
b2c81bc5e1
commit
e6930e1f14
@ -0,0 +1,45 @@
|
|||||||
|
From a94fd3a1a055c55f96adb1482cb96c7a541af7dd Mon Sep 17 00:00:00 2001
|
||||||
|
From: Felipe Borges <felipeborges@gnome.org>
|
||||||
|
Date: Wed, 15 Feb 2023 15:27:59 +0100
|
||||||
|
Subject: [PATCH] Make power-button-action always power off when chassis=server
|
||||||
|
|
||||||
|
Servers often don't support hibernation/suspend.
|
||||||
|
---
|
||||||
|
.../org.gnome.settings-daemon.plugins.power.gschema.xml.in | 2 +-
|
||||||
|
plugins/media-keys/gsd-media-keys-manager.c | 7 ++++---
|
||||||
|
2 files changed, 5 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in b/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in
|
||||||
|
index e1a8787b..ef0ea530 100644
|
||||||
|
--- a/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in
|
||||||
|
+++ b/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in
|
||||||
|
@@ -39,7 +39,7 @@
|
||||||
|
<key name="power-button-action" enum="org.gnome.settings-daemon.GsdPowerButtonActionType">
|
||||||
|
<default>'suspend'</default>
|
||||||
|
<summary>Power button action</summary>
|
||||||
|
- <description>The action to take when the system power button is pressed. Virtual machines only honor the 'nothing' action, and will shutdown otherwise. Tablets always suspend, ignoring all the other action options.</description>
|
||||||
|
+ <description>The action to take when the system power button is pressed. Virtual machines and servers only honor the 'nothing' action, and will shutdown otherwise. Tablets always suspend, ignoring all the other action options.</description>
|
||||||
|
</key>
|
||||||
|
<key name="power-saver-profile-on-low-battery" type="b">
|
||||||
|
<default>true</default>
|
||||||
|
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
|
||||||
|
index 60ff2ced..26d0e438 100644
|
||||||
|
--- a/plugins/media-keys/gsd-media-keys-manager.c
|
||||||
|
+++ b/plugins/media-keys/gsd-media-keys-manager.c
|
||||||
|
@@ -2042,9 +2042,10 @@ do_config_power_button_action (GsdMediaKeysManager *manager,
|
||||||
|
return;
|
||||||
|
|
||||||
|
action_type = g_settings_get_enum (priv->power_settings, "power-button-action");
|
||||||
|
- /* Always power off VMs, except when power-button-action is "nothing" */
|
||||||
|
- if (g_strcmp0 (priv->chassis_type, "vm") == 0) {
|
||||||
|
- g_warning_once ("Virtual machines only honor the 'nothing' power-button-action, and will shutdown otherwise");
|
||||||
|
+ /* Always power off VMs and servers, except when power-button-action is "nothing" */
|
||||||
|
+ if (g_strcmp0 (priv->chassis_type, "vm") == 0 ||
|
||||||
|
+ g_strcmp0 (priv->chassis_type, "server")) {
|
||||||
|
+ g_warning ("Virtual machines only honor the 'nothing' power-button-action, and will shutdown otherwise");
|
||||||
|
|
||||||
|
if (action_type != GSD_POWER_BUTTON_ACTION_NOTHING)
|
||||||
|
power_action (manager, "PowerOff", FALSE);
|
||||||
|
--
|
||||||
|
2.37.1
|
||||||
|
|
@ -0,0 +1,57 @@
|
|||||||
|
From f71fb47c3f783f3405bd910e1e170dc5e1f10e7c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Felipe Borges <felipeborges@gnome.org>
|
||||||
|
Date: Wed, 4 Jan 2023 13:41:31 +0100
|
||||||
|
Subject: [PATCH] power: Respect the "nothing" power-button-action for VMs
|
||||||
|
|
||||||
|
There are use-cases when one wants to forcefully make the guest ignore
|
||||||
|
poweroff requests from the hypervisor.
|
||||||
|
|
||||||
|
See https://bugzilla.redhat.com/2062051
|
||||||
|
|
||||||
|
See also https://gitlab.gnome.org/GNOME/gnome-settings-daemon/-/issues/46
|
||||||
|
---
|
||||||
|
....gnome.settings-daemon.plugins.power.gschema.xml.in | 2 +-
|
||||||
|
plugins/media-keys/gsd-media-keys-manager.c | 10 +++++++---
|
||||||
|
2 files changed, 8 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in b/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in
|
||||||
|
index 04b287bd..e1a8787b 100644
|
||||||
|
--- a/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in
|
||||||
|
+++ b/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in
|
||||||
|
@@ -39,7 +39,7 @@
|
||||||
|
<key name="power-button-action" enum="org.gnome.settings-daemon.GsdPowerButtonActionType">
|
||||||
|
<default>'suspend'</default>
|
||||||
|
<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>
|
||||||
|
+ <description>The action to take when the system power button is pressed. Virtual machines only honor the 'nothing' action, and will shutdown otherwise. Tablets always suspend, ignoring all the other action options.</description>
|
||||||
|
</key>
|
||||||
|
<key name="power-saver-profile-on-low-battery" type="b">
|
||||||
|
<default>true</default>
|
||||||
|
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
|
||||||
|
index 15e96e0e..60ff2ced 100644
|
||||||
|
--- a/plugins/media-keys/gsd-media-keys-manager.c
|
||||||
|
+++ b/plugins/media-keys/gsd-media-keys-manager.c
|
||||||
|
@@ -2041,13 +2041,17 @@ do_config_power_button_action (GsdMediaKeysManager *manager,
|
||||||
|
if (priv->power_button_disabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
- /* Always power off VMs when power off is pressed in the menus */
|
||||||
|
+ action_type = g_settings_get_enum (priv->power_settings, "power-button-action");
|
||||||
|
+ /* Always power off VMs, except when power-button-action is "nothing" */
|
||||||
|
if (g_strcmp0 (priv->chassis_type, "vm") == 0) {
|
||||||
|
- power_action (manager, "PowerOff", !in_lock_screen);
|
||||||
|
+ g_warning_once ("Virtual machines only honor the 'nothing' power-button-action, and will shutdown otherwise");
|
||||||
|
+
|
||||||
|
+ if (action_type != GSD_POWER_BUTTON_ACTION_NOTHING)
|
||||||
|
+ power_action (manager, "PowerOff", FALSE);
|
||||||
|
+
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
- action_type = g_settings_get_enum (priv->power_settings, "power-button-action");
|
||||||
|
switch (action_type) {
|
||||||
|
case GSD_POWER_BUTTON_ACTION_SUSPEND:
|
||||||
|
action = GSD_POWER_ACTION_SUSPEND;
|
||||||
|
--
|
||||||
|
2.37.1
|
||||||
|
|
@ -0,0 +1,45 @@
|
|||||||
|
--- gnome-settings-daemon-40.0.1/plugins/print-notifications/gsd-print-notifications-manager.c
|
||||||
|
+++ gnome-settings-daemon-40.0.1/plugins/print-notifications/gsd-print-notifications-manager.c
|
||||||
|
@@ -1268,6 +1268,7 @@ scp_handler (GsdPrintNotificationsManage
|
||||||
|
kill (manager->scp_handler_pid, SIGHUP);
|
||||||
|
g_spawn_close_pid (manager->scp_handler_pid);
|
||||||
|
manager->scp_handler_spawned = FALSE;
|
||||||
|
+ manager->scp_handler_pid = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1636,8 +1636,10 @@ gsd_print_notifications_manager_stop (Gs
|
||||||
|
manager->check_source_id = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (manager->subscription_id >= 0)
|
||||||
|
+ if (manager->subscription_id >= 0) {
|
||||||
|
cancel_subscription (manager->subscription_id);
|
||||||
|
+ manager->subscription_id = -1;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
g_clear_pointer (&manager->printing_printers, g_hash_table_destroy);
|
||||||
|
|
||||||
|
@@ -1649,6 +1651,7 @@ gsd_print_notifications_manager_stop (Gs
|
||||||
|
g_source_remove (data->timeout_id);
|
||||||
|
}
|
||||||
|
g_list_free_full (manager->timeouts, free_timeout_data);
|
||||||
|
+ manager->timeouts = NULL;
|
||||||
|
|
||||||
|
for (tmp = manager->active_notifications; tmp; tmp = g_list_next (tmp)) {
|
||||||
|
reason_data = (ReasonData *) tmp->data;
|
||||||
|
@@ -1665,12 +1668,14 @@ gsd_print_notifications_manager_stop (Gs
|
||||||
|
}
|
||||||
|
}
|
||||||
|
g_list_free_full (manager->active_notifications, free_reason_data);
|
||||||
|
+ manager->active_notifications = NULL;
|
||||||
|
|
||||||
|
for (tmp = manager->held_jobs; tmp; tmp = g_list_next (tmp)) {
|
||||||
|
job = (HeldJob *) tmp->data;
|
||||||
|
g_source_remove (job->timeout_id);
|
||||||
|
}
|
||||||
|
g_list_free_full (manager->held_jobs, free_held_job);
|
||||||
|
+ manager->held_jobs = NULL;
|
||||||
|
|
||||||
|
scp_handler (manager, FALSE);
|
||||||
|
}
|
Loading…
Reference in new issue