Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ns-panel support #44

Merged
merged 1 commit into from
May 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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