feat(wm): add monocle_focus_behaviour to gate monocle cycling

5f629e1f made directional focus cycle the monocle container in the
underlying ring. Useful on a single monitor, but undesired when focusing
across monitors — the focus stays trapped on the monocle workspace
instead of crossing the boundary.

This commit adds a new top-level monocle_focus_behaviour option with two
variants, Cycle (the post-5f629e1f behaviour) and NoOp (the pre-5f629e1f
behaviour, now the default), along with a ToggleMonocleFocusBehaviour
socket message and corresponding komorebic subcommands to flip between
them at runtime.
This commit is contained in:
LGUG2Z
2026-05-04 18:38:38 -07:00
parent e2e5dbfcae
commit 4e7d0e337c
7 changed files with 71 additions and 6 deletions

View File

@@ -737,6 +737,13 @@ struct BorderStyle {
style: komorebi_client::BorderStyle,
}
#[derive(Parser)]
struct MonocleFocusBehaviour {
/// Desired monocle focus behaviour
#[clap(value_enum)]
behaviour: komorebi_client::MonocleFocusBehaviour,
}
#[derive(Parser)]
struct BorderImplementation {
/// Desired border implementation
@@ -1418,6 +1425,11 @@ enum SubCommand {
CrossMonitorMoveBehaviour(CrossMonitorMoveBehaviour),
/// Toggle the behaviour when moving windows across monitor boundaries
ToggleCrossMonitorMoveBehaviour,
/// Set the behaviour when focusing in a direction while a monocle container is active
#[clap(arg_required_else_help = true)]
MonocleFocusBehaviour(MonocleFocusBehaviour),
/// Toggle the behaviour when focusing in a direction while a monocle container is active
ToggleMonocleFocusBehaviour,
/// Set the operation behaviour when the focused window is not managed
#[clap(arg_required_else_help = true)]
UnmanagedWindowOperationBehaviour(UnmanagedWindowOperationBehaviour),
@@ -3251,6 +3263,12 @@ if (Get-Command Get-CimInstance -ErrorAction SilentlyContinue) {
SubCommand::ToggleCrossMonitorMoveBehaviour => {
send_message(&SocketMessage::ToggleCrossMonitorMoveBehaviour)?;
}
SubCommand::MonocleFocusBehaviour(args) => {
send_message(&SocketMessage::MonocleFocusBehaviour(args.behaviour))?;
}
SubCommand::ToggleMonocleFocusBehaviour => {
send_message(&SocketMessage::ToggleMonocleFocusBehaviour)?;
}
SubCommand::UnmanagedWindowOperationBehaviour(args) => {
send_message(&SocketMessage::UnmanagedWindowOperationBehaviour(
args.operation_behaviour,