Skip to content

Commit e8680ff

Browse files
authored
Merge pull request #10573 from nshcr/fix-traffic-lights-inset
fix: move traffic lights inset setup to window creation
2 parents 5669fed + 5357fa8 commit e8680ff

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

crates/gitbutler-tauri/src/main.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -177,20 +177,6 @@ fn main() {
177177
menu::handle_event(handle, &window.clone(), &event)
178178
});
179179

180-
#[cfg(target_os = "macos")]
181-
use tauri::LogicalPosition;
182-
#[cfg(target_os = "macos")]
183-
use tauri_plugin_trafficlights_positioner::WindowExt;
184-
#[cfg(target_os = "macos")]
185-
// NOTE: Make sure you only call this ONCE per window.
186-
{
187-
if let Some(window) = tauri_app.get_window("main") {
188-
#[cfg(target_os = "macos")]
189-
// NOTE: Make sure you only call this ONCE per window.
190-
window.setup_traffic_lights_inset(LogicalPosition::new(16.0, 25.0))?;
191-
};
192-
}
193-
194180
Ok(())
195181
})
196182
.plugin(tauri_plugin_http::init())

crates/gitbutler-tauri/src/window.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,5 +320,15 @@ pub fn create(
320320
.disable_drag_drop_handler()
321321
.title_bar_style(tauri::TitleBarStyle::Overlay)
322322
.build()?;
323+
324+
use tauri::LogicalPosition;
325+
use tauri::Manager;
326+
use tauri_plugin_trafficlights_positioner::WindowExt;
327+
if let Some(window) = window.get_window(label) {
328+
// Note that these lights get reset when the Window label is changed!
329+
// See https://github.com/tauri-apps/tauri/issues/13044 .
330+
window.setup_traffic_lights_inset(LogicalPosition::new(16.0, 28.0))?;
331+
}
332+
323333
Ok(window)
324334
}

0 commit comments

Comments
 (0)