Skip to content

Commit

Permalink
feat: conditionally apply tauri-plugin-traffic-lights in v3 only
Browse files Browse the repository at this point in the history
  • Loading branch information
PavelLaptev authored and gitbutler-client committed Jan 29, 2025
1 parent a6e14ee commit 448b022
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions crates/gitbutler-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,20 @@ fn main() {
)
.expect("Failed to create window");

#[cfg(target_os = "macos")]
use tauri::LogicalPosition;
#[cfg(target_os = "macos")]
use tauri_plugin_traffic_lights::WindowExt;
#[cfg(target_os = "macos")]
// NOTE: Make sure you only call this ONCE per window.
{
if let Some(window) = tauri_app.get_window("main") {
#[cfg(target_os = "macos")]
// NOTE: Make sure you only call this ONCE per window.
window.setup_traffic_lights_inset(LogicalPosition::new(18.0, 22.0))?;
};
}

// TODO(mtsgrd): Is there a better way to disable devtools in E2E tests?
#[cfg(debug_assertions)]
if tauri_app.config().product_name != Some("GitButler Test".to_string()) {
Expand Down Expand Up @@ -106,7 +120,7 @@ fn main() {

app_handle.manage(WindowState::new(app_handle.clone()));

let mut app_settings = AppSettingsWithDiskSync::new(config_dir)?;
let mut app_settings = AppSettingsWithDiskSync::new(config_dir.clone())?;
app_settings.watch_in_background({
let app_handle = app_handle.clone();
move |app_settings| {
Expand All @@ -133,7 +147,15 @@ fn main() {
menu::handle_event(&window.clone(), &event)
});

if app_settings.feature_flags.v3 {
let mut app_settings = AppSettingsWithDiskSync::new(config_dir)?;
app_settings.watch_in_background({
let app_handle = app_handle.clone();
move |app_settings| {
gitbutler_tauri::ChangeForFrontend::from(app_settings).send(&app_handle)
}
})?;

if app_settings.get()?.clone().feature_flags.v3 {
#[cfg(target_os = "macos")]
use tauri::LogicalPosition;
#[cfg(target_os = "macos")]
Expand Down

0 comments on commit 448b022

Please sign in to comment.