From 2000f70ef4a1c135ac7bbacce02ce3149d67c20a Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Tue, 5 Apr 2022 12:23:41 -0300 Subject: [PATCH 1/5] feat: update tao to 0.8, refactor tray features --- .changes/tao-0.8.md | 5 +++++ .changes/tray-features.md | 5 +++++ Cargo.toml | 5 +++-- examples/system_tray.rs | 4 ++-- examples/system_tray_no_menu.rs | 4 ++-- src/lib.rs | 11 +++++------ 6 files changed, 22 insertions(+), 12 deletions(-) create mode 100644 .changes/tao-0.8.md create mode 100644 .changes/tray-features.md 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-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/Cargo.toml b/Cargo.toml index 25eb5a337..ab109ac5f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,8 @@ 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", default-features = false, features = [ "serde" ] } http = "0.2.6" [dev-dependencies] 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..d7dfa3d47 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -52,12 +52,11 @@ //! 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. +//! - `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. //! - `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. From 5ffefe153aa735d7c3317ea608755a16382a9107 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Tue, 5 Apr 2022 12:27:42 -0300 Subject: [PATCH 2/5] feat: install libayatana-appindicator3-dev --- .changes/config.json | 2 +- .github/workflows/bench.yml | 2 +- .github/workflows/build.yml | 2 +- README.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.changes/config.json b/.changes/config.json index 58464334f..dc86be7e3 100644 --- a/.changes/config.json +++ b/.changes/config.json @@ -8,7 +8,7 @@ "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 libappindicator3-dev libayatana-appindicator3-dev", "cargo install cargo-audit --features=fix", { "command": "cargo generate-lockfile", diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index 14d38179c..3351f6f28 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 libappindicator3-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..a389bed9e 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 libappindicator3-dev libayatana-appindicator3-dev - name: install webview2 (windows only) if: contains(matrix.platform.target, 'windows') diff --git a/README.md b/README.md index f769848cd..8799d3a50 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ sudo pacman -S webkit2gtk libappindicator-gtk3 #### Debian / Ubuntu: ```bash -sudo apt install libwebkit2gtk-4.0-dev libappindicator3-dev +sudo apt install libwebkit2gtk-4.0-dev libappindicator3-dev libayatana-appindicator3-dev ``` #### Fedora From c2bbb04044dc25c19bda4214b1de12d8ef66e611 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Tue, 5 Apr 2022 13:29:30 -0300 Subject: [PATCH 3/5] fix: set default feature --- Cargo.toml | 4 ++-- src/lib.rs | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ab109ac5f..73f5a012d 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,7 +22,7 @@ targets = [ ] [features] -default = [ "file-drop", "objc-exception", "protocol" ] +default = [ "file-drop", "objc-exception", "protocol", "tray", "ayatana-tray" ] objc-exception = [ "objc/exception" ] file-drop = [ ] protocol = [ ] diff --git a/src/lib.rs b/src/lib.rs index d7dfa3d47..df98ccfcf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -55,8 +55,9 @@ //! - `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. +//! 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. From 75835cb8466323b9144e937026555d1e81e03018 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Wed, 6 Apr 2022 09:35:43 -0300 Subject: [PATCH 4/5] update tao --- .changes/tray-default-features.md | 5 +++++ Cargo.toml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changes/tray-default-features.md 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/Cargo.toml b/Cargo.toml index 73f5a012d..778e1511f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,7 +42,7 @@ serde = { version = "1.0", features = [ "derive" ] } serde_json = "1.0" thiserror = "1.0" url = "2.2" -tao = { version = "0.8", default-features = false, features = [ "serde" ] } +tao = { version = "0.8.1", default-features = false, features = [ "serde" ] } http = "0.2.6" [dev-dependencies] From 1c074cf982080dfd76f59d9637fb8ea036952bc6 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Wed, 6 Apr 2022 10:20:56 -0300 Subject: [PATCH 5/5] update CI, doc --- .changes/config.json | 8 +++++--- .github/workflows/bench.yml | 2 +- .github/workflows/build.yml | 2 +- README.md | 10 ++++++++-- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.changes/config.json b/.changes/config.json index dc86be7e3..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 libayatana-appindicator3-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/.github/workflows/bench.yml b/.github/workflows/bench.yml index 3351f6f28..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 libayatana-appindicator3-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 a389bed9e..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 libayatana-appindicator3-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/README.md b/README.md index 8799d3a50..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 libayatana-appindicator3-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 libayatana-appindica 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.