diff --git a/.changes/config.json b/.changes/config.json index 58464334f..42fa409f1 100644 --- a/.changes/config.json +++ b/.changes/config.json @@ -1,14 +1,16 @@ { "gitSiteUrl": "https://github.com/tauri-apps/wry/", "timeout": 3600000, - "additionalBumpTypes": ["housekeeping"], + "additionalBumpTypes": [ + "housekeeping" + ], "pkgManagers": { "rust": { "version": true, "getPublishedVersion": "cargo search ${ pkg.pkg } --limit 1 | sed -nE 's/^[^\"]*\"//; s/\".*//1p'", "prepublish": [ "sudo apt-get update", - "sudo apt-get install -y libgtk-3-dev libgtksourceview-3.0-dev webkit2gtk-4.0 libappindicator3-dev", + "sudo apt-get install -y libgtk-3-dev libgtksourceview-3.0-dev webkit2gtk-4.0 libayatana-appindicator3-dev", "cargo install cargo-audit --features=fix", { "command": "cargo generate-lockfile", @@ -83,4 +85,4 @@ "manager": "rust" } } -} +} \ No newline at end of file diff --git a/.changes/tao-0.8.md b/.changes/tao-0.8.md new file mode 100644 index 000000000..1e0d45396 --- /dev/null +++ b/.changes/tao-0.8.md @@ -0,0 +1,5 @@ +--- +"wry": minor +--- + +Update tao to v0.8.0. diff --git a/.changes/tray-default-features.md b/.changes/tray-default-features.md new file mode 100644 index 000000000..bea01a125 --- /dev/null +++ b/.changes/tray-default-features.md @@ -0,0 +1,5 @@ +--- +"wry": minor +--- + +The `tray` and `ayatana-tray` Cargo features are not enabled by default. diff --git a/.changes/tray-features.md b/.changes/tray-features.md new file mode 100644 index 000000000..89496f7df --- /dev/null +++ b/.changes/tray-features.md @@ -0,0 +1,5 @@ +--- +"wry": minor +--- + +**Breaking change:** Renamed the `ayatana` Cargo feature to `ayatana-tray` and added the `gtk-tray` feature. The default tray on Linux is now `libayatana-appindicator`. diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index 14d38179c..1bbdb5633 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -37,7 +37,7 @@ jobs: run: | python -m pip install --upgrade pip sudo apt-get update - sudo apt-get install -y webkit2gtk-4.0 libgtksourceview-3.0-dev libappindicator3-dev xvfb + sudo apt-get install -y webkit2gtk-4.0 libgtksourceview-3.0-dev libayatana-appindicator3-dev xvfb wget https://github.com/sharkdp/hyperfine/releases/download/v1.11.0/hyperfine_1.11.0_amd64.deb sudo dpkg -i hyperfine_1.11.0_amd64.deb pip install memory_profiler diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c8ae73cd6..da16d3f7e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,7 +29,7 @@ jobs: if: contains(matrix.platform.target, 'gnu') run: | sudo apt-get update - sudo apt-get install -y webkit2gtk-4.0 libgtksourceview-3.0-dev libappindicator3-dev + sudo apt-get install -y webkit2gtk-4.0 libgtksourceview-3.0-dev libayatana-appindicator3-dev - name: install webview2 (windows only) if: contains(matrix.platform.target, 'windows') diff --git a/Cargo.toml b/Cargo.toml index 25eb5a337..778e1511f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ categories = [ "gui" ] [package.metadata.docs.rs] default-features = false -features = [ "dox", "file-drop", "protocol" ] +features = [ "dox", "file-drop", "protocol", "tray", "ayatana-tray" ] targets = [ "x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc", @@ -22,13 +22,14 @@ targets = [ ] [features] -default = [ "file-drop", "objc-exception", "protocol" ] +default = [ "file-drop", "objc-exception", "protocol", "tray", "ayatana-tray" ] objc-exception = [ "objc/exception" ] file-drop = [ ] protocol = [ ] dox = [ "tao/dox" ] tray = [ "tao/tray" ] -ayatana = [ "tao/ayatana" ] +ayatana-tray = [ "tao/ayatana-tray" ] +gtk-tray = [ "tao/gtk-tray" ] devtools = [ ] transparent = [ ] fullscreen = [ ] @@ -41,7 +42,7 @@ serde = { version = "1.0", features = [ "derive" ] } serde_json = "1.0" thiserror = "1.0" url = "2.2" -tao = { version = "0.7", default-features = false, features = [ "serde" ] } +tao = { version = "0.8.1", default-features = false, features = [ "serde" ] } http = "0.2.6" [dev-dependencies] diff --git a/README.md b/README.md index f769848cd..460b2483f 100644 --- a/README.md +++ b/README.md @@ -75,13 +75,17 @@ Tao uses [gtk-rs](https://gtk-rs.org/) and its related libraries for window crea #### Arch Linux / Manjaro: ```bash -sudo pacman -S webkit2gtk libappindicator-gtk3 +sudo pacman -S webkit2gtk +sudo pacman -S libappindicator-gtk3 # not required ``` +The `libayatana-indicator` package can be installed from the Arch User Repository (AUR). + #### Debian / Ubuntu: ```bash -sudo apt install libwebkit2gtk-4.0-dev libappindicator3-dev +sudo apt install libwebkit2gtk-4.0-dev libayatana-appindicator3-dev +sudo apt install libappindicator3-dev # not required ``` #### Fedora @@ -90,6 +94,8 @@ sudo apt install libwebkit2gtk-4.0-dev libappindicator3-dev sudo dnf install gtk3-devel webkit2gtk3-devel libappindicator-gtk3-devel ``` +Fedora does not have the Ayatana package yet, so you need to use the GTK one, see the [feature flags documentation](https://docs.rs/wry/latest/wry/#feature-flags). + ### macOS WebKit is native on macOS so everything should be fine. diff --git a/examples/system_tray.rs b/examples/system_tray.rs index f8237a3b9..ee44b8290 100644 --- a/examples/system_tray.rs +++ b/examples/system_tray.rs @@ -3,7 +3,7 @@ // SPDX-License-Identifier: MIT #[cfg(any(target_os = "macos", target_os = "windows", target_os = "linux"))] -#[cfg(any(feature = "tray", feature = "ayatana"))] +#[cfg(feature = "tray")] fn main() -> wry::Result<()> { use std::collections::HashMap; #[cfg(target_os = "linux")] @@ -224,7 +224,7 @@ fn main() { // Tray feature flag disabled but can be available. #[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))] -#[cfg(not(any(feature = "tray", feature = "ayatana")))] +#[cfg(not(feature = "tray"))] fn main() { println!("This platform doesn't have the `tray` feature enabled."); } diff --git a/examples/system_tray_no_menu.rs b/examples/system_tray_no_menu.rs index e6b2ede19..97d36c535 100644 --- a/examples/system_tray_no_menu.rs +++ b/examples/system_tray_no_menu.rs @@ -3,7 +3,7 @@ // SPDX-License-Identifier: MIT #[cfg(any(target_os = "macos", target_os = "windows", target_os = "linux"))] -#[cfg(any(feature = "tray", feature = "ayatana"))] +#[cfg(feature = "tray")] fn main() -> wry::Result<()> { use std::collections::HashMap; #[cfg(target_os = "linux")] @@ -192,7 +192,7 @@ fn main() { // Tray feature flag disabled but can be available. #[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))] -#[cfg(not(any(feature = "tray", feature = "ayatana")))] +#[cfg(not(feature = "tray"))] fn main() { println!("This platform doesn't have the `tray` or `ayatana` feature enabled."); } diff --git a/src/lib.rs b/src/lib.rs index 77950dc40..df98ccfcf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -52,12 +52,12 @@ //! interacting with the window. Enabled by default. //! - `protocol`: Enables [`with_custom_protocol`] to define custom URL scheme for handling tasks like //! loading assets. Enabled by default. -//! - `tray`: Enables system tray and more menu item variants on **Linux**. You can still create -//! those types if you disable it. They just don't create the actual objects. We set this flag -//! because some implementations require more installed packages. Disable this if you don't want -//! to install `libappindicator` package. Enabled by default. -//! - `ayatana`: Enable this if you wish to use more update `libayatana-appindicator` since -//! `libappindicator` is no longer maintained. +//! - `tray`: Enables system tray and more menu item variants on **Linux**. This flag is enabled by default. +//! You can still create those types if you disable it. They just don't create the actual objects. We set this flag because some implementations require more installed packages. +//! - `ayatana-tray`: Enable this if you wish to use more update `libayatana-appindicator` since `libappindicator` is no longer maintained. +//! This flag is enabled by default. Disable this if you don't want to install the `libayatana-appindicator` package. +//! - `gtk-tray`: Enable this if you wish ot use `libappindicator` for tray on **Linux**. The package is supported on more Linux distributions, but it is not maintained anymore. +//! Note that `ayatana-tray` and `gtk-tray` cannot be enabled at the same time, so `default-features` must be set to `false`. //! - `devtools`: Enables devtools on release builds. Devtools are always enabled in debug builds. //! On **macOS**, enabling devtools, reuires calling private apis so you should enabling this flag in release //! build if your app needs to publish to App Store.