feat(wm): lock

Containers can be locked since the model came in, and a locked container keeps
its index while others are inserted, removed or swapped around it; nothing could
lock one. `komorebic toggle-lock` locks the focused container, or unlocks it,
and the `LockMonitorWorkspaceContainer` and `UnlockMonitorWorkspaceContainer`
messages lock and unlock a container by the index of its monitor, its workspace
and itself, for a program such as a status bar.

The vm-commands sweep locks and unlocks a container.
This commit is contained in:
LGUG2Z committed 2026-10-28 07:20:37 -07:00
1 parent 062fe57fac
commit 3cc5dceb7d
11 files changed
+325 -6

No files matched your search

+7 -1
View File
@@ -16,7 +16,8 @@
//! next window and give it up.
//! - `promote`, `promote-swap`, `promote-focus` and `promote-window` bring a window to the largest
//! tile, or the focus to it.
//! - `toggle-float` takes the focused window out of the layout, or puts it back.
//! - `toggle-float` takes the focused window out of the layout, or puts it back, and
//! `toggle-lock` locks the focused container at its index, or unlocks it.
//! - `resize-edge` and `resize-axis` resize the focused window by the `resize-delta`, and
//! `quick-save-resize`, `quick-load-resize`, `save-resize` and `load-resize` save the sizes of
//! the tiles of the focused workspace and load them back.
@@ -307,6 +308,8 @@ enum SubCommand {
ToggleTiling,
/// Toggle floating mode for the focused window
ToggleFloat,
/// Toggle a lock for the focused container, ensuring it will not be displaced by any new windows
ToggleLock,
/// Enable or disable mouse follows focus on all workspaces
#[clap(arg_required_else_help = true)]
MouseFollowsFocus(MouseFollowsFocus),
@@ -483,6 +486,9 @@ fn main() -> eyre::Result<()> {
SubCommand::ToggleTiling => {
send_message(&SocketMessage::ToggleTiling)?;
}
SubCommand::ToggleLock => {
send_message(&SocketMessage::ToggleLock)?;
}
SubCommand::State => {
print_query(&SocketMessage::State);
}
+2
View File
@@ -210,6 +210,7 @@ fn the_layout_subcommands_send_the_layout_axis_or_direction_they_are_given() {
);
sends(&["toggle-tiling"], r#"{"type":"ToggleTiling"}"#);
sends(&["toggle-float"], r#"{"type":"ToggleFloat"}"#);
sends(&["toggle-lock"], r#"{"type":"ToggleLock"}"#);
sends(
&["preselect-direction", "up"],
r#"{"type":"PreselectDirection","content":"Up"}"#,
@@ -385,6 +386,7 @@ fn docgen_writes_the_help_of_every_subcommand_in_a_text_fence() {
"stop.md",
"subscribe-socket.md",
"toggle-float.md",
"toggle-lock.md",
"toggle-mouse-follows-focus.md",
"toggle-tiling.md",
"unsubscribe-socket.md",