gardesk/garchomp / 11738fa

Browse files

add status command to garchompctl

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
11738faa622c620b869dc75b673afcdbf8df8d69
Parents
10847f8
Tree
46e7a41

1 changed file

StatusFile+-
M garchompctl/src/main.rs 21 1
garchompctl/src/main.rsmodified
@@ -27,6 +27,8 @@ enum Commands {
2727
     Windows,
2828
     /// Ping the compositor.
2929
     Ping,
30
+    /// Get compositor status.
31
+    Status,
3032
 }
3133
 
3234
 fn main() -> Result<()> {
@@ -45,6 +47,7 @@ fn main() -> Result<()> {
4547
         Commands::Blur { strength } => Request::SetBlurStrength { strength },
4648
         Commands::Windows => Request::ListWindows,
4749
         Commands::Ping => Request::Ping,
50
+        Commands::Status => Request::Status,
4851
     };
4952
 
5053
     let response = send_request(&request)?;
@@ -56,13 +59,30 @@ fn main() -> Result<()> {
5659
             eprintln!("Error: {}", message);
5760
             std::process::exit(1);
5861
         }
62
+        Response::Version { version, name } => {
63
+            println!("{} v{}", name, version);
64
+        }
65
+        Response::Status(status) => {
66
+            println!("Compositor Status:");
67
+            println!("  Version: {}", status.version);
68
+            println!("  Windows: {}", status.window_count);
69
+            println!("  Workspace: {}", status.current_workspace);
70
+            println!("  Connected to gar: {}", status.connected_to_gar);
71
+            println!("  Effects:");
72
+            println!("    Blur: {} (strength: {})",
73
+                status.effects_enabled.blur, status.effects_enabled.blur_strength);
74
+            println!("    Shadows: {}", status.effects_enabled.shadows);
75
+            println!("    Animations: {}", status.effects_enabled.animations);
76
+        }
5977
         Response::WindowInfo(info) => {
6078
             println!("{}", serde_json::to_string_pretty(&info)?);
6179
         }
6280
         Response::WindowList { windows } => {
6381
             for win in windows {
82
+                let focus_marker = if win.focused { "*" } else { " " };
6483
                 println!(
65
-                    "{:#010x}  {}x{}+{}+{}  {}",
84
+                    "{}{:#010x}  {}x{}+{}+{}  {}",
85
+                    focus_marker,
6686
                     win.id,
6787
                     win.width,
6888
                     win.height,