@@ -27,6 +27,8 @@ enum Commands { |
| 27 | 27 | Windows, |
| 28 | 28 | /// Ping the compositor. |
| 29 | 29 | Ping, |
| 30 | + /// Get compositor status. |
| 31 | + Status, |
| 30 | 32 | } |
| 31 | 33 | |
| 32 | 34 | fn main() -> Result<()> { |
@@ -45,6 +47,7 @@ fn main() -> Result<()> { |
| 45 | 47 | Commands::Blur { strength } => Request::SetBlurStrength { strength }, |
| 46 | 48 | Commands::Windows => Request::ListWindows, |
| 47 | 49 | Commands::Ping => Request::Ping, |
| 50 | + Commands::Status => Request::Status, |
| 48 | 51 | }; |
| 49 | 52 | |
| 50 | 53 | let response = send_request(&request)?; |
@@ -56,13 +59,30 @@ fn main() -> Result<()> { |
| 56 | 59 | eprintln!("Error: {}", message); |
| 57 | 60 | std::process::exit(1); |
| 58 | 61 | } |
| 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 | + } |
| 59 | 77 | Response::WindowInfo(info) => { |
| 60 | 78 | println!("{}", serde_json::to_string_pretty(&info)?); |
| 61 | 79 | } |
| 62 | 80 | Response::WindowList { windows } => { |
| 63 | 81 | for win in windows { |
| 82 | + let focus_marker = if win.focused { "*" } else { " " }; |
| 64 | 83 | println!( |
| 65 | | - "{:#010x} {}x{}+{}+{} {}", |
| 84 | + "{}{:#010x} {}x{}+{}+{} {}", |
| 85 | + focus_marker, |
| 66 | 86 | win.id, |
| 67 | 87 | win.width, |
| 68 | 88 | win.height, |