git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

commit0109f0957b37248e6359ab4345593433024f7e11
parentf9b746064c
authorLucas Galante <[email protected]>
date2026-06-17 14:52
refactor: rename socket files and update logging paths to remove 'client' and 'clear-'

 src/clearctl.rs              | 16 ++++------------
 src/server/ipc_server.rs     |  4 ++--
 src/server/status_server.rs  |  6 +++---
 src/server/window_manager.rs | 24 ++++++++++++++++++++++++
 4 files changed, 33 insertions(+), 17 deletions(-)

diff --git a/src/clearctl.rs b/src/clearctl.rs
index 752989a..d72cea6 100644
--- a/src/clearctl.rs
+++ b/src/clearctl.rs
@@ -8,15 +8,15 @@ use std::process;
  
 fn get_socket_path() -> String {
     match env::var("WAYLAND_DISPLAY") {
-        Ok(display) => format!("/tmp/cce-client-{}.sock", display),
-        Err(_) => "/tmp/cce-client.sock".to_string(),
+        Ok(display) => format!("/tmp/cce-{}.sock", display),
+        Err(_) => "/tmp/cce.sock".to_string(),
     }
 }
  
 fn get_windows_path() -> String {
     match env::var("WAYLAND_DISPLAY") {
-        Ok(display) => format!("/tmp/cce-client-windows-{}", display),
-        Err(_) => "/tmp/cce-client-windows".to_string(),
+        Ok(display) => format!("/tmp/cce-windows-{}", display),
+        Err(_) => "/tmp/cce-windows".to_string(),
     }
 }
  
@@ -77,14 +77,6 @@ pub fn run_clearctl(args: Vec<String>) {
         return;
     }
  
-    // Special case: "windows" reads the status file directly
-    if args[1] == "windows" {
-        match fs::read_to_string(get_windows_path()) {
-            Ok(content) => print!("{}", content),
-            Err(_) => eprintln!("No windows info (cce may not be running)"),
-        }
-        return;
-    }
  
     // Connect to IPC socket
     let stream = match UnixStream::connect(get_socket_path()) {
diff --git a/src/server/ipc_server.rs b/src/server/ipc_server.rs
index f1b3515..db38c71 100644
--- a/src/server/ipc_server.rs
+++ b/src/server/ipc_server.rs
@@ -11,9 +11,9 @@ pub struct IpcRequest {
 
 fn get_ipc_socket_path(display_socket: Option<&str>) -> String {
     if let Some(display) = display_socket {
-        format!("/tmp/cce-client-{}.sock", display)
+        format!("/tmp/cce-{}.sock", display)
     } else {
-        "/tmp/cce-client.sock".to_string()
+        "/tmp/cce.sock".to_string()
     }
 }
 
diff --git a/src/server/status_server.rs b/src/server/status_server.rs
index b59e017..d27df91 100644
--- a/src/server/status_server.rs
+++ b/src/server/status_server.rs
@@ -1,7 +1,7 @@
 // Status socket server for monolithic cce server
 //
 // Runs in a dedicated thread. cce-status-interface connects to
-// /tmp/cce-client-status-{WAYLAND_DISPLAY}.sock, sends a subscription line
+// /tmp/cce-status-{WAYLAND_DISPLAY}.sock, sends a subscription line
 // ("tags", "layout", or "title"), and receives JSON lines whenever the status changes.
 //
 // The main loop sends updates through an mpsc channel. The server thread
@@ -63,9 +63,9 @@ impl StatusSender {
 
 pub fn get_status_socket_path(display_socket: Option<&str>) -> String {
     if let Some(display) = display_socket {
-        format!("/tmp/cce-client-status-{}.sock", display)
+        format!("/tmp/cce-status-{}.sock", display)
     } else {
-        "/tmp/cce-client-status.sock".to_string()
+        "/tmp/cce-status.sock".to_string()
     }
 }
 
diff --git a/src/server/window_manager.rs b/src/server/window_manager.rs
index 7c47de7..c49d87a 100644
--- a/src/server/window_manager.rs
+++ b/src/server/window_manager.rs
@@ -1724,6 +1724,30 @@ impl WindowManager {
                 self.dirty_windowing();
                 "ok\n".to_string()
             }
+            "windows" => {
+                let mut out = String::new();
+                for &w in self.windows.iter() {
+                    if !w.is_null() && !(*w).closed {
+                        let app_id = (*w).get_app_id_string().unwrap_or_default();
+                        let title = (*w).get_title_string().unwrap_or_default();
+                        out.push_str(&format!(
+                            "window id={} app_id={} title=\"{}\" mode={} x={} y={} w={} h={} tags={} minimized={} has_parent={}\n",
+                            (*w).ref_key.index,
+                            app_id,
+                            title,
+                            (*w).tiling_mode.as_str(),
+                            (*w).box_geom.x,
+                            (*w).box_geom.y,
+                            (*w).box_geom.width,
+                            (*w).box_geom.height,
+                            (*w).tags,
+                            (*w).minimized,
+                            (*w).has_parent,
+                        ));
+                    }
+                }
+                out
+            }
             "spawn" => {
                 if parts.len() < 2 { return "error: missing command\n".to_string(); }
                 let cmd = parts[1..].join(" ");