srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/crates/ctl/src
diff options
context:
space:
mode:
authorsrdusr <[email protected]>2024-08-21 20:03:00 +0200
committersrdusr <[email protected]>2024-08-21 20:03:00 +0200
commit8d94ca5d77d6e2a189d299b8b88a461ba2e621c6 (patch)
tree0f9d22415dc741b111882072ace9a533f882d29a /crates/ctl/src
parentbb59ecfa2f1329d978fcfa8b7455db649f019f85 (diff)
downloadsrdwm-8d94ca5d77d6e2a189d299b8b88a461ba2e621c6.tar.gz
srdwm-8d94ca5d77d6e2a189d299b8b88a461ba2e621c6.zip
Add toggle_maximize/toggle_fullscreen IPC dispatch actions
Same shape as the existing toggle_visibility/focus/close dispatch actions - lets an external script (or a live diagnostic check) drive either without a keybinding already existing to trigger it. Immediately useful for verifying the maximize/fullscreen contract on a live session without synthesizing any input at all.
Diffstat (limited to 'crates/ctl/src')
-rw-r--r--crates/ctl/src/main.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/crates/ctl/src/main.rs b/crates/ctl/src/main.rs
index 2c3c3db..a82fe4a 100644
--- a/crates/ctl/src/main.rs
+++ b/crates/ctl/src/main.rs
@@ -12,6 +12,8 @@
//! srd dispatch toggle_visibility ID hide/show a window
//! srd dispatch focus ID
//! srd dispatch close ID
+//! srd dispatch toggle_maximize ID
+//! srd dispatch toggle_fullscreen ID
//!
//! The socket is Unix-domain; on platforms without one this always fails
//! cleanly rather than not building at all, since it's one binary in a
@@ -48,8 +50,8 @@ fn build_request(args: &[String]) -> Result<String, String> {
Some("monitors") => Ok(r#"{"cmd":"monitors"}"#.to_string()),
Some("subscribe") => Ok(r#"{"cmd":"subscribe"}"#.to_string()),
Some("dispatch") => {
- let action = args.get(1).ok_or("dispatch needs an action (toggle_visibility/focus/close)")?;
- if !matches!(action.as_str(), "toggle_visibility" | "focus" | "close") {
+ let action = args.get(1).ok_or("dispatch needs an action (toggle_visibility/focus/close/toggle_maximize/toggle_fullscreen)")?;
+ if !matches!(action.as_str(), "toggle_visibility" | "focus" | "close" | "toggle_maximize" | "toggle_fullscreen") {
return Err(format!("unknown dispatch action '{action}'"));
}
let id: u64 = args.get(2).ok_or("dispatch needs a window id")?.parse().map_err(|_| "window id must be a number".to_string())?;
@@ -67,6 +69,8 @@ fn print_usage() {
eprintln!(" srd dispatch toggle_visibility <id>");
eprintln!(" srd dispatch focus <id>");
eprintln!(" srd dispatch close <id>");
+ eprintln!(" srd dispatch toggle_maximize <id>");
+ eprintln!(" srd dispatch toggle_fullscreen <id>");
}
#[cfg(unix)]