mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-03-23 18:01:12 +01:00
fix(bar): read mouse follows focus from state
This commit is contained in:
@@ -117,7 +117,6 @@ impl BarWidget for Date {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: make spacing configurable
|
||||
ui.add_space(WIDGET_SPACING);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,6 +66,7 @@ impl From<KomorebiConfig> for Komorebi {
|
||||
layout: String::new(),
|
||||
workspaces: vec![],
|
||||
hide_empty_workspaces: value.workspaces.hide_empty_workspaces,
|
||||
mouse_follows_focus: true,
|
||||
})),
|
||||
workspaces: value.workspaces,
|
||||
layout: value.layout,
|
||||
@@ -101,8 +102,12 @@ impl BarWidget for Komorebi {
|
||||
komorebi_client::send_message(&SocketMessage::MouseFollowsFocus(false))
|
||||
.unwrap();
|
||||
komorebi_client::send_message(&SocketMessage::FocusWorkspaceNumber(i)).unwrap();
|
||||
// TODO: store MFF value from state and restore that here instead of "true"
|
||||
komorebi_client::send_message(&SocketMessage::MouseFollowsFocus(true)).unwrap();
|
||||
komorebi_client::send_message(&SocketMessage::MouseFollowsFocus(
|
||||
self.komorebi_notification_state
|
||||
.borrow()
|
||||
.mouse_follows_focus,
|
||||
))
|
||||
.unwrap();
|
||||
komorebi_client::send_message(&SocketMessage::Retile).unwrap();
|
||||
}
|
||||
}
|
||||
@@ -164,6 +169,7 @@ pub struct KomorebiNotificationState {
|
||||
pub focused_window_icon: Option<RgbaImage>,
|
||||
pub layout: String,
|
||||
pub hide_empty_workspaces: bool,
|
||||
pub mouse_follows_focus: bool,
|
||||
}
|
||||
|
||||
impl KomorebiNotificationState {
|
||||
@@ -190,6 +196,8 @@ impl KomorebiNotificationState {
|
||||
}
|
||||
}
|
||||
|
||||
self.mouse_follows_focus = notification.state.mouse_follows_focus;
|
||||
|
||||
let monitor = ¬ification.state.monitors.elements()[monitor_index];
|
||||
let focused_workspace_idx = monitor.focused_workspace_idx();
|
||||
|
||||
|
||||
@@ -132,16 +132,16 @@ fn main() -> color_eyre::Result<()> {
|
||||
|
||||
let config_path = config_path.unwrap();
|
||||
|
||||
let state = serde_json::from_str::<komorebi_client::State>(
|
||||
&komorebi_client::send_query(&SocketMessage::State).unwrap(),
|
||||
)?;
|
||||
|
||||
let mut viewport_builder = ViewportBuilder::default()
|
||||
.with_decorations(false)
|
||||
// .with_transparent(config.transparent)
|
||||
.with_taskbar(false)
|
||||
.with_position(Position { x: 0.0, y: 0.0 })
|
||||
.with_inner_size({
|
||||
let state = serde_json::from_str::<komorebi_client::State>(
|
||||
&komorebi_client::send_query(&SocketMessage::State).unwrap(),
|
||||
)?;
|
||||
|
||||
Position {
|
||||
x: state.monitors.elements()[config.monitor.index].size().right as f32,
|
||||
y: 20.0,
|
||||
|
||||
@@ -108,7 +108,6 @@ impl BarWidget for Time {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: make spacing configurable
|
||||
ui.add_space(WIDGET_SPACING);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user