diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2023-09-11 21:24:43 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2023-09-11 21:24:43 +0200 |
commit | b54bc7252b2587f9840e02c23b7035d37b0ebfd8 (patch) | |
tree | 2bae184f525b15187b2bd938fca662cdab0f5aec | |
parent | b35978fb83d205435b6278c0f8c8891be99bc40a (diff) | |
parent | c3d8a7db185dc588191bd3c1b9d2257ac19b4d1f (diff) | |
download | arctica-greeter-b54bc7252b2587f9840e02c23b7035d37b0ebfd8.tar.gz arctica-greeter-b54bc7252b2587f9840e02c23b7035d37b0ebfd8.tar.bz2 arctica-greeter-b54bc7252b2587f9840e02c23b7035d37b0ebfd8.zip |
Merge branch 'sunweaver-pr/fix-multiseat-support-with-systemd'
Attributes GH PR #59: https://github.com/ArcticaProject/arctica-greeter/pull/59
-rw-r--r-- | data/50-arctica-greeter.conf.in | 1 | ||||
-rw-r--r-- | debian/control | 1 | ||||
-rwxr-xr-x | lightdm-arctica-greeter-session | 4 | ||||
-rw-r--r-- | src/arctica-greeter.vala | 84 |
4 files changed, 38 insertions, 52 deletions
diff --git a/data/50-arctica-greeter.conf.in b/data/50-arctica-greeter.conf.in index d19ed15..cac4c59 100644 --- a/data/50-arctica-greeter.conf.in +++ b/data/50-arctica-greeter.conf.in @@ -1,2 +1,3 @@ [Seat:*] greeter-session=arctica-greeter +greeter-wrapper=@pkglibexecdir@/lightdm-arctica-greeter-session diff --git a/debian/control b/debian/control index 9fe25eb..0f80e04 100644 --- a/debian/control +++ b/debian/control @@ -5,7 +5,6 @@ Maintainer: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Standards-Version: 4.1.1 Build-Depends: adwaita-icon-theme, at-spi2-core, - dbus-x11, debhelper (>= 9), dh-autoreconf, fonts-droid-fallback | fonts-droid, diff --git a/lightdm-arctica-greeter-session b/lightdm-arctica-greeter-session index 536e0ae..6b34ff0 100755 --- a/lightdm-arctica-greeter-session +++ b/lightdm-arctica-greeter-session @@ -28,9 +28,7 @@ cleanup() exit 0 } -eval `dbus-launch --sh-syntax` - -exec $@ & +exec dbus-run-session $@ & CMD_PID=$! wait $CMD_PID CMD_PID= diff --git a/src/arctica-greeter.vala b/src/arctica-greeter.vala index 94e58d9..2ede4c5 100644 --- a/src/arctica-greeter.vala +++ b/src/arctica-greeter.vala @@ -1083,9 +1083,6 @@ public class ArcticaGreeter : Object var greeter = new ArcticaGreeter (do_test_mode, do_test_highcontrast, do_test_bigfont); greeter.go(); - string systemd_stderr; - int systemd_exitcode = 0; - Pid nmapplet_pid = 0; var indicator_list = AGSettings.get_strv(AGSettings.KEY_INDICATORS); @@ -1103,7 +1100,7 @@ public class ArcticaGreeter : Object if (update_indicator_list) AGSettings.set_strv(AGSettings.KEY_INDICATORS, indicator_list); - var launched_indicator_services = new List<string>(); + var launched_indicator_service_pids = new List<Pid>(); if (!do_test_mode) { @@ -1118,6 +1115,8 @@ public class ArcticaGreeter : Object var indicator_service = ""; foreach (unowned string indicator in indicator_list) { + Pid indicator_service_pid = 0; + if ("ug-" in indicator && ! ("." in indicator)) continue; @@ -1132,28 +1131,27 @@ public class ArcticaGreeter : Object /* Start the indicator service */ string[] argv; - Shell.parse_argv ("systemctl --user start %s".printf(indicator_service), out argv); - Process.spawn_sync (null, - argv, - null, - SpawnFlags.SEARCH_PATH, - null, - null, - out systemd_stderr, - out systemd_exitcode); - - if (systemd_exitcode == 0) - { - launched_indicator_services.append(indicator_service); - debug ("Successfully started Indicator Service '%s'", indicator_service); - } - else { - warning ("Systemd failed to start Indicator Service '%s': %s", indicator_service, systemd_stderr); - } + /* FIXME: This path is rather hard-coded here. + * If it pops up, we need to handle this in + * some path detection fashion similar to + * how we find at-spi-bus-launcher on the file + * system. + */ + Shell.parse_argv ("/usr/libexec/%s/%s-service".printf(indicator_service, indicator_service), out argv); + Process.spawn_async (null, + argv, + null, + SpawnFlags.SEARCH_PATH, + null, + out indicator_service_pid); + launched_indicator_service_pids.append(indicator_service_pid); + debug ("Successfully started Ayatana Indicator Service '%s' [%d]", indicator_service, indicator_service_pid); } - catch (Error e) { + catch (Error e) + { warning ("Error starting Indicator Service '%s': %s", indicator_service, e.message); } + } /* Make nm-applet hide items the user does not have permissions to interact with */ @@ -1196,33 +1194,23 @@ public class ArcticaGreeter : Object if (!do_test_mode) { - foreach (unowned string indicator_service in launched_indicator_services) + foreach (unowned Pid indicator_service_pid in launched_indicator_service_pids) { + if (indicator_service_pid != 0) + { +#if VALA_0_40 + Posix.kill (indicator_service_pid, Posix.Signal.TERM); +#else + Posix.kill (indicator_service_pid, Posix.SIGTERM); +#endif - try { - /* Stop this indicator service */ - string[] argv; - - Shell.parse_argv ("systemctl --user stop %s".printf(indicator_service), out argv); - Process.spawn_sync (null, - argv, - null, - SpawnFlags.SEARCH_PATH, - null, - null, - out systemd_stderr, - out systemd_exitcode); - - if (systemd_exitcode == 0) - { - debug ("Successfully stopped Indicator Service '%s' via systemd", indicator_service); - } - else { - warning ("Systemd failed to stop Indicator Service '%s': %s", indicator_service, systemd_stderr); - } - } - catch (Error e) { - warning ("Error stopping Indicator Service '%s': %s", indicator_service, e.message); + int status; + Posix.waitpid (indicator_service_pid, out status, 0); + if (Process.if_exited (status)) + debug ("Indicator Service process [%d] exited with return value %d", indicator_service_pid, Process.exit_status (status)); + else + debug ("Indicator Service process [%d] terminated with signal %d", indicator_service_pid, Process.term_sig (status)); + indicator_service_pid = 0; } } |