feat: add custom traffic light inset for macos

This commit is contained in:
2024-03-29 13:26:35 +07:00
parent a02e496b29
commit 7271e9ea87
4 changed files with 362 additions and 0 deletions

View File

@@ -5,12 +5,21 @@
pub mod commands;
pub mod nostr;
pub mod traffic_light;
pub mod tray;
#[cfg(target_os = "macos")]
extern crate cocoa;
#[cfg(target_os = "macos")]
#[macro_use]
extern crate objc;
use nostr_sdk::prelude::*;
use std::fs;
use tauri::Manager;
use tauri_plugin_autostart::MacosLauncher;
use traffic_light::setup_traffic_light_positioner;
pub struct Nostr {
client: Client,
@@ -22,6 +31,9 @@ fn main() {
#[cfg(target_os = "macos")]
app.set_activation_policy(tauri::ActivationPolicy::Regular);
#[cfg(target_os = "macos")]
setup_traffic_light_positioner(app.get_window("main").unwrap());
let _tray = tray::create_tray(app.handle()).unwrap();
let handle = app.handle().clone();
let home_dir = handle.path().home_dir().unwrap();