summaryrefslogtreecommitdiff
path: root/gui-apps/tuigreet/files/tuigreet-0.7.1-power-command-notify.patch
diff options
context:
space:
mode:
Diffstat (limited to 'gui-apps/tuigreet/files/tuigreet-0.7.1-power-command-notify.patch')
-rw-r--r--gui-apps/tuigreet/files/tuigreet-0.7.1-power-command-notify.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/gui-apps/tuigreet/files/tuigreet-0.7.1-power-command-notify.patch b/gui-apps/tuigreet/files/tuigreet-0.7.1-power-command-notify.patch
new file mode 100644
index 000000000000..99b79d7c2a1b
--- /dev/null
+++ b/gui-apps/tuigreet/files/tuigreet-0.7.1-power-command-notify.patch
@@ -0,0 +1,42 @@
+--- a/src/greeter.rs
++++ b/src/greeter.rs
+@@ -16,7 +16,7 @@ use tokio::{
+ process::Command,
+ sync::{
+ oneshot::{Receiver, Sender},
+- RwLock, RwLockWriteGuard,
++ Notify, RwLock, RwLockWriteGuard,
+ },
+ };
+ use zeroize::Zeroize;
+@@ -90,6 +90,7 @@ pub struct Greeter {
+
+ pub power_commands: HashMap<PowerOption, String>,
+ pub power_command: Option<Command>,
++ pub power_command_notify: Arc<Notify>,
+ pub power_setsid: bool,
+
+ pub working: bool,
+--- a/src/main.rs
++++ b/src/main.rs
+@@ -64,9 +64,12 @@ async fn run() -> Result<(), Box<dyn Error>> {
+
+ tokio::task::spawn({
+ let greeter = greeter.clone();
++ let notify = greeter.read().await.power_command_notify.clone();
+
+ async move {
+ loop {
++ notify.notified().await;
++
+ let command = greeter.write().await.power_command.take();
+
+ if let Some(mut command) = command {
+--- a/src/power.rs
++++ b/src/power.rs
+@@ -50,4 +50,5 @@ pub fn power(greeter: &mut Greeter, option: PowerOption) {
+ };
+
+ greeter.power_command = Some(command);
++ greeter.power_command_notify.notify_one();
+ }