Skip to content

freethinkel/tauri-nspopover-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tauri Plugin NSpopover

Only for MacOS

implementation for tauri v2 can be found here

How to use?

Cargo.toml

[dependencies]
tauri-plugin-nspopover = { git = "https://github.com/freethinkel/tauri-nspopover-plugin.git" }

main.rs

use tauri::{ActivationPolicy, Manager};
#[cfg(target_os = "macos")]
use tauri_plugin_nspopover::WindowExt;

fn main() {
    tauri::Builder::default()
        .setup(|app| {
            app.set_activation_policy(ActivationPolicy::Accessory);
            let window = app.app_handle().get_window("main").unwrap();
            #[cfg(target_os = "macos")]
            window.to_popover();

            Ok(())
        })
        .system_tray(tray)
        .plugin(tauri_plugin_nspopover::init())
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

tauri.config.json

  "systemTray": {
    "iconPath": "icons/statusbar-icon.png",
    "iconAsTemplate": true
  },
  ...
  "windows": [
    {
      "fullscreen": false,
      "resizable": true,
      "title": "inboxion",
      "width": 300,
      "height": 450,
      "visible": false,
      "transparent": true
    }
  ]

Example

git clone https://github.com/freethinkel/tauri-nspopover-plugin
cd tauri-nspopover-plugin/example
npm install
npm run tauri dev