Skip to content

Commit 585620e

Browse files
Fix cross-platform build
1 parent f14a06a commit 585620e

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed

src-tauri/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bewcloud-sync"
3-
version = "0.0.4"
3+
version = "0.0.5"
44
description = "Desktop Sync Client for bewCloud"
55
authors = ["Bruno Bernardino"]
66
edition = "2021"
@@ -16,6 +16,8 @@ serde = { version = "1", features = ["derive"] }
1616
serde_json = "1"
1717
async-std = "1.12.0"
1818
chrono = "0.4.19"
19+
20+
[target.'cfg(target_os = "macos")'.dependencies]
1921
cocoa = "0.25.0"
2022

2123
[features]

src-tauri/src/main.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,21 @@ fn show_or_hide_main_window(app: &AppHandle) {
458458
.unwrap();
459459
}
460460

461+
#[cfg(target_os = "macos")]
462+
fn hide_dock_icon() {
463+
use cocoa::appkit::{NSApp, NSApplication, NSApplicationActivationPolicy::*};
464+
465+
unsafe {
466+
let app = NSApp();
467+
app.setActivationPolicy_(NSApplicationActivationPolicyAccessory);
468+
}
469+
}
470+
471+
#[cfg(not(target_os = "macos"))]
472+
fn hide_dock_icon() {
473+
// Do nothing
474+
}
475+
461476
fn main() {
462477
let show_or_hide = CustomMenuItem::new("show_or_hide".to_string(), "Hide");
463478
let force_sync = CustomMenuItem::new("force_sync".to_string(), "Force Sync");
@@ -513,12 +528,7 @@ fn main() {
513528
tauri::RunEvent::ExitRequested { api, .. } => {
514529
api.prevent_exit();
515530

516-
use cocoa::appkit::{NSApp, NSApplication, NSApplicationActivationPolicy::*};
517-
518-
unsafe {
519-
let app = NSApp();
520-
app.setActivationPolicy_(NSApplicationActivationPolicyAccessory);
521-
}
531+
hide_dock_icon();
522532
}
523533

524534
_ => {}

src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
"package": {
99
"productName": "bewCloud Desktop Sync",
10-
"version": "0.0.4"
10+
"version": "0.0.5"
1111
},
1212
"tauri": {
1313
"allowlist": {

0 commit comments

Comments
 (0)