Skip to content

Commit

Permalink
feat: add ns-panel support (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
ParthJadhav authored May 19, 2023
1 parent 8d1352d commit 992ebd8
Show file tree
Hide file tree
Showing 5 changed files with 488 additions and 5 deletions.
41 changes: 41 additions & 0 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,23 @@ smartcalc = { git = "https://github.com/ParthJadhav/smartcalc", branch = "stable
chrono-tz = { version = "0.6.1", default-features = false }
num-format = { version = "0.4", features = ["with-system-locale"] }
localzone = "0.2.0"
sys-locale = "0.2.3"

[target."cfg(target_os = \"macos\")".dependencies]
core-graphics = {version = "0.22.3"}
core-foundation = { version = "0.9.3" }
cocoa = { version = "0.24.1" }
objc = { version = "0.2.7" }
objc_id = {version = "0.1.1" }
objc-foundation = { version = "0.1.1" }

[dependencies.chrono]
version = "0.4"

[features]
# by default Tauri runs in production mode
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
default = [ "custom-protocol" ]
default = ["custom-protocol"]
# this feature is used used for production builds where `devPath` points to the filesystem
# DO NOT remove this
custom-protocol = [ "tauri/custom-protocol" ]
custom-protocol = ["tauri/custom-protocol"]
7 changes: 6 additions & 1 deletion src-tauri/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![warn(clippy::nursery, clippy::pedantic)]

mod util;
mod ns_panel;

use tauri::{
CustomMenuItem, Manager, SystemTray, SystemTrayEvent, SystemTrayMenu, SystemTrayMenuItem,
Expand Down Expand Up @@ -36,7 +37,10 @@ fn main() {
open_command,
get_icon,
handle_input,
launch_on_login
launch_on_login,
ns_panel::init_ns_panel,
ns_panel::show_app,
ns_panel::hide_app
])
.setup(|app| {
app.set_activation_policy(tauri::ActivationPolicy::Accessory);
Expand All @@ -47,6 +51,7 @@ fn main() {
window.hide().unwrap();
Ok(())
})
.manage(ns_panel::State::default())
.system_tray(create_system_tray())
.on_system_tray_event(|app, event| match event {
SystemTrayEvent::MenuItemClick { id, .. } => match id.as_str() {
Expand Down
Loading

0 comments on commit 992ebd8

Please sign in to comment.