diff --git a/Cargo.lock b/Cargo.lock index b3db51c5..6981d0f2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2887,6 +2887,8 @@ dependencies = [ "num", "num-derive", "num-traits", + "objc2 0.6.2", + "objc2-app-kit 0.3.1", "parking_lot", "random_word", "reqwest", @@ -5073,9 +5075,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.103.6" +version = "0.103.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8572f3c2cb9934231157b45499fc41e1f58c589fdfb81a844ba873265e80f8eb" +checksum = "e10b3f4191e8a80e6b43eebabfac91e5dcecebb27a71f04e820c47ec41d314bf" dependencies = [ "ring", "rustls-pki-types", diff --git a/dependencies.json b/dependencies.json index 46ce0fbb..2a273982 100644 --- a/dependencies.json +++ b/dependencies.json @@ -524,6 +524,7 @@ "hyper-tls 0.6.0 registry+https://github.com/rust-lang/crates.io-index", "hyper-util 0.1.17 registry+https://github.com/rust-lang/crates.io-index", "iana-time-zone 0.1.64 registry+https://github.com/rust-lang/crates.io-index", + "icns 0.3.1 registry+https://github.com/rust-lang/crates.io-index", "ident_case 1.0.1 registry+https://github.com/rust-lang/crates.io-index", "idna 1.1.0 registry+https://github.com/rust-lang/crates.io-index", "idna_adapter 1.2.1 registry+https://github.com/rust-lang/crates.io-index", diff --git a/komorebi-bar/Cargo.toml b/komorebi-bar/Cargo.toml index 3236ab41..1d9361d7 100644 --- a/komorebi-bar/Cargo.toml +++ b/komorebi-bar/Cargo.toml @@ -27,6 +27,8 @@ netdev = "0.36" num = "0.4" num-derive = "0.4" num-traits = "0.2" +objc2 = "0.6" +objc2-app-kit = "0.3" parking_lot = { workspace = true } random_word = { version = "0.5", features = ["en"] } reqwest = { version = "0.12", features = ["blocking"] } diff --git a/komorebi-bar/src/main.rs b/komorebi-bar/src/main.rs index 6ea376e8..c0b83ce7 100644 --- a/komorebi-bar/src/main.rs +++ b/komorebi-bar/src/main.rs @@ -20,6 +20,9 @@ use komorebi_client::PathExt; use komorebi_client::SocketMessage; use komorebi_client::SubscribeOptions; use komorebi_client::replace_env_in_path; +use objc2::MainThreadMarker; +use objc2_app_kit::NSApplication; +use objc2_app_kit::NSApplicationActivationPolicy; use std::io::BufReader; use std::io::Read; use std::path::PathBuf; @@ -288,6 +291,11 @@ fn main() -> eyre::Result<()> { "komorebi-bar", native_options, Box::new(|cc| { + unsafe { + let app = NSApplication::sharedApplication(MainThreadMarker::new_unchecked()); + app.setActivationPolicy(NSApplicationActivationPolicy::Accessory); + } + let ctx_repainter = cc.egui_ctx.clone(); std::thread::spawn(move || loop { std::thread::sleep(Duration::from_secs(1));