From 3618beb366031bb382d6f53962dbb0781e0e0e2d Mon Sep 17 00:00:00 2001 From: Csaba Date: Thu, 13 Mar 2025 19:04:37 +0100 Subject: [PATCH] fix(bar): add focus-monitor-at-cursor msg to buttons This commit adds the FocusMonitorAtCursor SocketMessage on all the toggle buttons as the monitor idx is not sent as a parameter and the monitor needs to be focused when these buttons are clicked on the bar (especially for multiple bars). --- komorebi-bar/src/komorebi.rs | 1 + komorebi-bar/src/komorebi_layout.rs | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/komorebi-bar/src/komorebi.rs b/komorebi-bar/src/komorebi.rs index 858a518c..58cadbaa 100644 --- a/komorebi-bar/src/komorebi.rs +++ b/komorebi-bar/src/komorebi.rs @@ -403,6 +403,7 @@ impl BarWidget for Komorebi { if layer_frame.clicked() && komorebi_client::send_batch([ + SocketMessage::FocusMonitorAtCursor, SocketMessage::MouseFollowsFocus(false), SocketMessage::ToggleWorkspaceLayer, SocketMessage::MouseFollowsFocus( diff --git a/komorebi-bar/src/komorebi_layout.rs b/komorebi-bar/src/komorebi_layout.rs index 9e75f15b..8dab2c69 100644 --- a/komorebi-bar/src/komorebi_layout.rs +++ b/komorebi-bar/src/komorebi_layout.rs @@ -105,12 +105,22 @@ impl KomorebiLayout { } } KomorebiLayout::Monocle => { - if komorebi_client::send_message(&SocketMessage::ToggleMonocle).is_err() { + if komorebi_client::send_batch([ + SocketMessage::FocusMonitorAtCursor, + SocketMessage::ToggleMonocle, + ]) + .is_err() + { tracing::error!("could not send message to komorebi: ToggleMonocle"); } } KomorebiLayout::Floating => { - if komorebi_client::send_message(&SocketMessage::ToggleTiling).is_err() { + if komorebi_client::send_batch([ + SocketMessage::FocusMonitorAtCursor, + SocketMessage::ToggleTiling, + ]) + .is_err() + { tracing::error!("could not send message to komorebi: ToggleTiling"); } }