@@ -18,7 +18,7 @@ public class Gala.DaemonManager : GLib.Object {
1818
1919 public Meta . Display display { get ; construct; }
2020
21- private Meta . WaylandClient daemon_client ;
21+ private ManagedClient client ;
2222 private Daemon ? daemon_proxy = null ;
2323
2424 public DaemonManager (Meta .Display display ) {
@@ -28,55 +28,19 @@ public class Gala.DaemonManager : GLib.Object {
2828 construct {
2929 Bus . watch_name (BusType . SESSION , DAEMON_DBUS_NAME , BusNameWatcherFlags . NONE , daemon_appeared, lost_daemon);
3030
31- if ( Meta . Util . is_wayland_compositor ()) {
32- start_wayland . begin ( );
31+ string [] args = { Meta . Util . is_wayland_compositor () ? " gala-daemon " : " gala-daemon-gtk3 " };
32+ client = new ManagedClient (display, args );
3333
34- display. window_created. connect ((window) = > {
35- if (daemon_client. owns_window (window)) {
36- window. shown. connect (handle_daemon_window);
37- }
38- });
39- } else {
40- start_x. begin ();
41- }
34+ client. window_created. connect ((window) = > {
35+ window. shown. connect (handle_daemon_window);
36+ });
4237 }
4338
44- private async void start_wayland () {
45- var subprocess_launcher = new GLib .SubprocessLauncher (NONE );
46- try {
47- daemon_client = new Meta .WaylandClient (display. get_context (), subprocess_launcher);
48- string [] args = {" gala-daemon" };
49- var subprocess = daemon_client. spawnv (display, args);
50-
51- yield subprocess. wait_async ();
52-
53- // Restart the daemon if it crashes
54- Timeout . add_seconds (1 , () = > {
55- start_wayland. begin ();
56- return Source . REMOVE ;
57- });
58- } catch (Error e) {
59- warning (" Failed to create dock client: %s " , e. message);
39+ private void handle_daemon_window (Meta .Window window ) {
40+ if (window. title == null ) {
6041 return ;
6142 }
62- }
63-
64- private async void start_x () {
65- try {
66- var subprocess = new Subprocess (NONE , " gala-daemon-gtk3" );
67- yield subprocess. wait_async ();
6843
69- // Restart the daemon if it crashes
70- Timeout . add_seconds (1 , () = > {
71- start_x. begin ();
72- return Source . REMOVE ;
73- });
74- } catch (Error e) {
75- warning (" Failed to create daemon subprocess with x: %s " , e. message);
76- }
77- }
78-
79- private void handle_daemon_window (Meta .Window window ) {
8044 var info = window. title. split (" -" );
8145
8246 if (info. length == 0 ) {
@@ -99,10 +63,11 @@ public class Gala.DaemonManager : GLib.Object {
9963
10064 case " MODAL" :
10165#if HAS_MUTTER46
102- daemon_client . make_dock (window);
66+ client . wayland_client . make_dock (window);
10367#endif
10468 window. move_frame (false , 0 , 0 );
10569 window. make_above ();
70+ window. stick ();
10671 break ;
10772 }
10873 }
0 commit comments