Skip to content

Commit

Permalink
refactor(core): drop ayatana-tray and gtk-tray Cargo features (#4247
Browse files Browse the repository at this point in the history
)
  • Loading branch information
lucasfernog committed Jun 2, 2022
1 parent 5c20c84 commit 6216eb4
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 40 deletions.
6 changes: 6 additions & 0 deletions .changes/remove-tray-features.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"tauri": patch
"tauri-runtime-wry": patch
---

**Breaking change**: Removed the `gtk-tray` and `ayatana-tray` Cargo features.
6 changes: 6 additions & 0 deletions .changes/tauri-tray-env-var.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"cli.rs": patch
"cli.js": patch
---

Use the `TAURI_TRAY` environment variable to determine which package should be added to the Debian `depends` section. Possible values are `ayatana` and `gtk`.
6 changes: 1 addition & 5 deletions .github/workflows/lint-fmt-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,9 @@ jobs:
clippy:
- { args: '', key: 'empty' }
- {
args: '--features compression,wry,isolation,custom-protocol,api-all,cli,updater,system-tray,ayatana-tray,http-multipart',
args: '--features compression,wry,isolation,custom-protocol,api-all,cli,updater,system-tray,http-multipart',
key: 'all'
}
- {
args: '--no-default-features --features ayatana-tray',
key: 'no-default'
}
- { args: '--features custom-protocol', key: 'custom-protocol' }
- { args: '--features api-all', key: 'api-all' }

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@ jobs:
run: |
cargo test
cargo test --features api-all
cargo test --features compression,wry,isolation,custom-protocol,api-all,cli,updater,system-tray,ayatana-tray,http-multipart
cargo test --features compression,wry,isolation,custom-protocol,api-all,cli,updater,system-tray,http-multipart
4 changes: 2 additions & 2 deletions .github/workflows/udeps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ jobs:
clippy:
- {
path: './core/tauri/Cargo.toml',
args: '--features compression,wry,isolation,custom-protocol,api-all,cli,updater,system-tray,ayatana-tray,http-multipart'
args: '--features compression,wry,isolation,custom-protocol,api-all,cli,updater,system-tray,http-multipart'
}
- { path: './core/tauri-build/Cargo.toml', args: '--all-features' }
- { path: './core/tauri-codegen/Cargo.toml', args: '--all-features' }
- { path: './core/tauri-macros/Cargo.toml', args: '--all-features' }
- { path: './core/tauri-runtime/Cargo.toml', args: '--all-features' }
- {
path: './core/tauri-runtime-wry/Cargo.toml',
args: '--features devtools,system-tray,macos-private-api,objc-exception,ayatana-tray'
args: '--features devtools,system-tray,macos-private-api,objc-exception'
}
- { path: './core/tauri-utils/Cargo.toml', args: '--all-features' }
- { path: './tooling/bundler/Cargo.toml', args: '--all-features' }
Expand Down
4 changes: 1 addition & 3 deletions core/tauri-runtime-wry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ exclude = [ ".license_template", "CHANGELOG.md", "/target" ]
readme = "README.md"

[dependencies]
wry = { version = "0.17.0", default-features = false, features = [ "file-drop", "protocol" ] }
wry = { version = "0.18.1", default-features = false, features = [ "file-drop", "protocol" ] }
tauri-runtime = { version = "0.6.0", path = "../tauri-runtime" }
tauri-utils = { version = "1.0.0-rc.8", path = "../tauri-utils" }
uuid = { version = "1", features = [ "v4" ] }
Expand Down Expand Up @@ -44,7 +44,5 @@ macos-private-api = [
"tauri-runtime/macos-private-api"
]
objc-exception = [ "wry/objc-exception" ]
gtk-tray = [ "wry/gtk-tray" ]
ayatana-tray = [ "wry/ayatana-tray" ]
global-shortcut = [ "tauri-runtime/global-shortcut" ]
clipboard = [ "tauri-runtime/clipboard" ]
2 changes: 0 additions & 2 deletions core/tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,6 @@ default = [ "wry", "compression", "objc-exception" ]
compression = [ "tauri-macros/compression", "tauri-utils/compression" ]
wry = [ "tauri-runtime-wry" ]
objc-exception = [ "tauri-runtime-wry/objc-exception" ]
ayatana-tray = [ "tauri-runtime-wry/ayatana-tray" ]
gtk-tray = [ "tauri-runtime-wry/gtk-tray" ]
isolation = [ "tauri-utils/isolation", "tauri-macros/isolation" ]
custom-protocol = [ "tauri-macros/custom-protocol" ]
updater = [
Expand Down
3 changes: 0 additions & 3 deletions core/tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
//! - **fs-extract-api**: Enabled the `tauri::api::file::Extract` API.
//! - **cli**: Enables usage of `clap` for CLI argument parsing. Enabled by default if the `cli` config is defined on the `tauri.conf.json` file.
//! - **system-tray**: Enables application system tray API. Enabled by default if the `systemTray` config is defined on the `tauri.conf.json` file.
//! Note that you must select one of `ayatana-tray` and `gtk-tray` features on Linux.
//! - **ayatana-tray**: Use libayatana-appindicator for system tray on Linux.
//! - **gtk-tray**: Use libappindicator3-1 for system tray on Linux. To enable this, you need to disable the default features.
//! - **macos-private-api**: Enables features only available in **macOS**'s private APIs, currently the `transparent` window functionality and the `fullScreenEnabled` preference setting to `true`. Enabled by default if the `tauri > macosPrivateApi` config flag is set to `true` on the `tauri.conf.json` file.
//! - **window-data-url**: Enables usage of data URLs on the webview.
//! - **compression** *(enabled by default): Enables asset compression. You should only disable this if you want faster compile times in release builds - it produces larger binaries.
Expand Down
21 changes: 4 additions & 17 deletions examples/api/src-tauri/Cargo.lock

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

3 changes: 1 addition & 2 deletions examples/api/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ tauri = { path = "../../../core/tauri", features = ["api-all", "cli", "global-sh
tiny_http = "0.11"

[features]
default = [ "custom-protocol", "tauri/ayatana-tray" ]
default = [ "custom-protocol" ]
custom-protocol = [ "tauri/custom-protocol" ]
gtk-tray = [ "tauri/gtk-tray" ]

# default to small, optimized release binaries
[profile.release]
Expand Down
5 changes: 3 additions & 2 deletions tooling/cli/src/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use serde::Deserialize;

use std::{
collections::HashMap,
fmt::Write,
fs::{read_dir, read_to_string},
panic,
path::{Path, PathBuf},
Expand Down Expand Up @@ -461,9 +462,9 @@ fn crate_version(
is_git = true;
let mut v = format!("git:{}", g);
if let Some(branch) = p.branch {
v.push_str(&format!("&branch={}", branch));
let _ = write!(v, "&branch={}", branch);
} else if let Some(rev) = p.rev {
v.push_str(&format!("#{}", rev));
let _ = write!(v, "#{}", rev);
}
v
} else {
Expand Down
8 changes: 5 additions & 3 deletions tooling/cli/src/interface/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,10 +416,12 @@ fn tauri_config_to_bundle_settings(
let mut icon_path = system_tray_config.icon_path.clone();
icon_path.set_extension("png");
resources.push(icon_path.display().to_string());
if enabled_features.contains(&"tauri/gtk-tray".into()) {
depends.push("libappindicator3-1".into());
} else {
depends.push("pkg-config".to_string());
let tray = std::env::var("TAURI_TRAY").unwrap_or_else(|_| "ayatana".to_string());
if tray == "ayatana" {
depends.push("libayatana-appindicator3-1".into());
} else {
depends.push("libappindicator3-1".into());
}
}

Expand Down

0 comments on commit 6216eb4

Please sign in to comment.