feat: expose layout controls over IPC
This commit is contained in:
1 parent
0a98bead56
commit
d0dc55349c
4 files changed
+18
-4
No files matched your search
@@ -155,7 +155,8 @@ cargo run -p feresectl -- get-workspaces
|
||||
```
|
||||
|
||||
The v0 IPC slice also supports `move`, `resize`, `move-to-workspace`,
|
||||
`toggle-floating`, `toggle-fullscreen`, `close`, `get-focused-window`, and
|
||||
`toggle-floating`, `toggle-fullscreen`, `toggle-layout`, `cycle-column-width`,
|
||||
`center-column`, `consume`, `expel`, `close`, `get-focused-window`, and
|
||||
`get-outputs`. Requests use versioned, 1 MiB-limited length-prefixed JSON. The
|
||||
runtime directory and socket are restricted to modes `0700` and `0600`, and the
|
||||
server rejects peers whose effective UID differs from the compositor's.
|
||||
|
||||
@@ -172,6 +172,11 @@ impl Ferese {
|
||||
"move-to-workspace" => self.move_focused_to_workspace(workspace_arg(args)?),
|
||||
"toggle-floating" => self.toggle_focused_floating(),
|
||||
"toggle-fullscreen" => self.toggle_focused_fullscreen(),
|
||||
"toggle-layout" => self.toggle_layout_mode(),
|
||||
"cycle-column-width" => self.cycle_focused_column_width(),
|
||||
"center-column" => self.center_focused_column(),
|
||||
"consume" => self.consume_focused_window(),
|
||||
"expel" => self.expel_focused_window(),
|
||||
"close" => self.close_focused_window(),
|
||||
"get-focused-window" => return Ok(self.focused_window_json()),
|
||||
"get-workspaces" => return Ok(self.workspaces_json()),
|
||||
|
||||
@@ -1311,7 +1311,10 @@ User-control commands are:
|
||||
focus move
|
||||
resize workspace
|
||||
move-to-workspace toggle-floating
|
||||
toggle-fullscreen close
|
||||
toggle-fullscreen toggle-layout
|
||||
cycle-column-width center-column
|
||||
consume expel
|
||||
close
|
||||
reload-config get-focused-window
|
||||
get-workspaces get-outputs
|
||||
get-config set-config
|
||||
|
||||
@@ -47,7 +47,8 @@ fn parse_args(args: impl IntoIterator<Item = String>) -> Result<(String, Value),
|
||||
.map_err(|_| format!("{} requires a positive workspace index", command))?;
|
||||
json!({ "index": index })
|
||||
}
|
||||
"toggle-floating" | "toggle-fullscreen" | "close" | "get-focused-window"
|
||||
"toggle-floating" | "toggle-fullscreen" | "toggle-layout" | "cycle-column-width"
|
||||
| "center-column" | "consume" | "expel" | "close" | "get-focused-window"
|
||||
| "get-workspaces" | "get-outputs" => {
|
||||
if !positional.is_empty() {
|
||||
return Err(format!("{command} does not accept arguments"));
|
||||
@@ -77,7 +78,7 @@ fn socket_path() -> Result<PathBuf, io::Error> {
|
||||
}
|
||||
|
||||
fn usage() -> String {
|
||||
"usage: feresectl <focus|move|resize> <direction>\n feresectl <workspace|move-to-workspace> <index>\n feresectl <toggle-floating|toggle-fullscreen|close|get-focused-window|get-workspaces|get-outputs>".to_owned()
|
||||
"usage: feresectl <focus|move|resize> <direction>\n feresectl <workspace|move-to-workspace> <index>\n feresectl <toggle-floating|toggle-fullscreen|toggle-layout>\n feresectl <cycle-column-width|center-column|consume|expel|close>\n feresectl <get-focused-window|get-workspaces|get-outputs>".to_owned()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -98,6 +99,10 @@ mod tests {
|
||||
.1,
|
||||
json!({ "index": 7 })
|
||||
);
|
||||
assert_eq!(
|
||||
parse_args(["cycle-column-width".to_owned()]).unwrap(),
|
||||
("cycle-column-width".to_owned(), json!({}))
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user