mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-05-17 17:26:54 +02:00
refactor(rust): remove getset dependency
This commit is contained in:
@@ -937,9 +937,9 @@ impl eframe::App for Komobar {
|
||||
) {
|
||||
let monitor_index = self.monitor_index.expect("should have a monitor index");
|
||||
|
||||
let monitor_size = state.monitors.elements()[monitor_index].size();
|
||||
let monitor_size = state.monitors.elements()[monitor_index].size;
|
||||
|
||||
self.update_monitor_coordinates(monitor_size);
|
||||
self.update_monitor_coordinates(&monitor_size);
|
||||
|
||||
should_apply_config = true;
|
||||
}
|
||||
@@ -950,7 +950,7 @@ impl eframe::App for Komobar {
|
||||
|
||||
// Check if monitor coordinates/size has changed
|
||||
if let Some(monitor_index) = self.monitor_index {
|
||||
let monitor_size = state.monitors.elements()[monitor_index].size();
|
||||
let monitor_size = state.monitors.elements()[monitor_index].size;
|
||||
let top = MONITOR_TOP.load(Ordering::SeqCst);
|
||||
let left = MONITOR_LEFT.load(Ordering::SeqCst);
|
||||
let right = MONITOR_RIGHT.load(Ordering::SeqCst);
|
||||
@@ -960,13 +960,13 @@ impl eframe::App for Komobar {
|
||||
bottom: monitor_size.bottom,
|
||||
right,
|
||||
};
|
||||
if *monitor_size != rect {
|
||||
if monitor_size != rect {
|
||||
tracing::info!(
|
||||
"Monitor coordinates/size has changed, storing new coordinates: {:#?}",
|
||||
monitor_size
|
||||
);
|
||||
|
||||
self.update_monitor_coordinates(monitor_size);
|
||||
self.update_monitor_coordinates(&monitor_size);
|
||||
|
||||
should_apply_config = true;
|
||||
}
|
||||
|
||||
@@ -230,17 +230,17 @@ fn main() -> color_eyre::Result<()> {
|
||||
.map_or(usr_monitor_index, |i| *i);
|
||||
|
||||
MONITOR_RIGHT.store(
|
||||
state.monitors.elements()[monitor_index].size().right,
|
||||
state.monitors.elements()[monitor_index].size.right,
|
||||
Ordering::SeqCst,
|
||||
);
|
||||
|
||||
MONITOR_TOP.store(
|
||||
state.monitors.elements()[monitor_index].size().top,
|
||||
state.monitors.elements()[monitor_index].size.top,
|
||||
Ordering::SeqCst,
|
||||
);
|
||||
|
||||
MONITOR_LEFT.store(
|
||||
state.monitors.elements()[monitor_index].size().left,
|
||||
state.monitors.elements()[monitor_index].size.left,
|
||||
Ordering::SeqCst,
|
||||
);
|
||||
|
||||
@@ -250,11 +250,11 @@ fn main() -> color_eyre::Result<()> {
|
||||
None => {
|
||||
config.position = Some(PositionConfig {
|
||||
start: Some(Position {
|
||||
x: state.monitors.elements()[monitor_index].size().left as f32,
|
||||
y: state.monitors.elements()[monitor_index].size().top as f32,
|
||||
x: state.monitors.elements()[monitor_index].size.left as f32,
|
||||
y: state.monitors.elements()[monitor_index].size.top as f32,
|
||||
}),
|
||||
end: Some(Position {
|
||||
x: state.monitors.elements()[monitor_index].size().right as f32,
|
||||
x: state.monitors.elements()[monitor_index].size.right as f32,
|
||||
y: 50.0,
|
||||
}),
|
||||
})
|
||||
@@ -262,14 +262,14 @@ fn main() -> color_eyre::Result<()> {
|
||||
Some(ref mut position) => {
|
||||
if position.start.is_none() {
|
||||
position.start = Some(Position {
|
||||
x: state.monitors.elements()[monitor_index].size().left as f32,
|
||||
y: state.monitors.elements()[monitor_index].size().top as f32,
|
||||
x: state.monitors.elements()[monitor_index].size.left as f32,
|
||||
y: state.monitors.elements()[monitor_index].size.top as f32,
|
||||
});
|
||||
}
|
||||
|
||||
if position.end.is_none() {
|
||||
position.end = Some(Position {
|
||||
x: state.monitors.elements()[monitor_index].size().right as f32,
|
||||
x: state.monitors.elements()[monitor_index].size.right as f32,
|
||||
y: 50.0,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -817,7 +817,7 @@ impl MonitorInfo {
|
||||
self.mouse_follows_focus = state.mouse_follows_focus;
|
||||
|
||||
let monitor = &state.monitors.elements()[self.monitor_index];
|
||||
self.work_area_offset = monitor.work_area_offset();
|
||||
self.work_area_offset = monitor.work_area_offset;
|
||||
self.focused_workspace_idx = Some(monitor.focused_workspace_idx());
|
||||
|
||||
// Layout
|
||||
@@ -856,7 +856,7 @@ impl MonitorInfo {
|
||||
let containers = fn_containers_from(ws);
|
||||
WorkspaceInfo {
|
||||
name: ws
|
||||
.name()
|
||||
.name
|
||||
.to_owned()
|
||||
.unwrap_or_else(|| format!("{}", index + 1)),
|
||||
focused_container_idx: containers.iter().position(|c| c.is_focused),
|
||||
@@ -864,7 +864,7 @@ impl MonitorInfo {
|
||||
.iter()
|
||||
.any(|container| container.windows.iter().any(|window| window.icon.is_some())),
|
||||
containers,
|
||||
layer: *ws.layer(),
|
||||
layer: ws.layer,
|
||||
should_show: !hide_empty_ws || focused_ws_idx == Some(index) || !ws.is_empty(),
|
||||
is_selected: focused_ws_idx == Some(index),
|
||||
}
|
||||
@@ -873,15 +873,15 @@ impl MonitorInfo {
|
||||
|
||||
/// Determines the current layout of the focused workspace
|
||||
fn resolve_layout(focused_ws: &Workspace, is_paused: bool) -> KomorebiLayout {
|
||||
if focused_ws.monocle_container().is_some() {
|
||||
if focused_ws.monocle_container.is_some() {
|
||||
KomorebiLayout::Monocle
|
||||
} else if !focused_ws.tile() {
|
||||
} else if !focused_ws.tile {
|
||||
KomorebiLayout::Floating
|
||||
} else if is_paused {
|
||||
KomorebiLayout::Paused
|
||||
} else {
|
||||
match focused_ws.layout() {
|
||||
komorebi_client::Layout::Default(layout) => KomorebiLayout::Default(*layout),
|
||||
match focused_ws.layout {
|
||||
komorebi_client::Layout::Default(layout) => KomorebiLayout::Default(layout),
|
||||
komorebi_client::Layout::Custom(_) => KomorebiLayout::Custom,
|
||||
}
|
||||
}
|
||||
@@ -938,7 +938,7 @@ impl ContainerInfo {
|
||||
|
||||
// Monocle container first if present
|
||||
let monocle = ws
|
||||
.monocle_container()
|
||||
.monocle_container
|
||||
.as_ref()
|
||||
.map(|c| Self::from_container(c, !has_focused_float));
|
||||
|
||||
@@ -965,7 +965,7 @@ impl ContainerInfo {
|
||||
if let Some(window) = ws.floating_windows().iter().find(|w| w.is_focused()) {
|
||||
return Some(Self::from_window(window));
|
||||
}
|
||||
if let Some(container) = ws.monocle_container() {
|
||||
if let Some(container) = &ws.monocle_container {
|
||||
Some(Self::from_container(container, true))
|
||||
} else {
|
||||
ws.focused_container()
|
||||
@@ -979,7 +979,7 @@ impl ContainerInfo {
|
||||
windows: container.windows().iter().map(WindowInfo::from).collect(),
|
||||
focused_window_idx: container.focused_window_idx(),
|
||||
is_focused,
|
||||
is_locked: container.locked(),
|
||||
is_locked: container.locked,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user