Skip to content

Commit

Permalink
feat: update tao to 0.8, refactor tray features (#541)
Browse files Browse the repository at this point in the history
* feat: update tao to 0.8, refactor tray features

* feat: install libayatana-appindicator3-dev

* fix: set default feature

* update tao

* update CI, doc
  • Loading branch information
lucasfernog committed Apr 7, 2022
1 parent 36b985e commit 1c540b0
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 21 deletions.
8 changes: 5 additions & 3 deletions .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",
Expand Down Expand Up @@ -83,4 +85,4 @@
"manager": "rust"
}
}
}
}
5 changes: 5 additions & 0 deletions .changes/tao-0.8.md
@@ -0,0 +1,5 @@
---
"wry": minor
---

Update tao to v0.8.0.
5 changes: 5 additions & 0 deletions .changes/tray-default-features.md
@@ -0,0 +1,5 @@
---
"wry": minor
---

The `tray` and `ayatana-tray` Cargo features are not enabled by default.
5 changes: 5 additions & 0 deletions .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`.
2 changes: 1 addition & 1 deletion .github/workflows/bench.yml
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Expand Up @@ -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')
Expand Down
9 changes: 5 additions & 4 deletions Cargo.toml
Expand Up @@ -14,21 +14,22 @@ 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",
"x86_64-apple-darwin"
]

[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 = [ ]
Expand All @@ -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]
Expand Down
10 changes: 8 additions & 2 deletions README.md
Expand Up @@ -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
Expand All @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions examples/system_tray.rs
Expand Up @@ -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")]
Expand Down Expand Up @@ -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.");
}
4 changes: 2 additions & 2 deletions examples/system_tray_no_menu.rs
Expand Up @@ -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")]
Expand Down Expand Up @@ -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.");
}
12 changes: 6 additions & 6 deletions src/lib.rs
Expand Up @@ -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.
Expand Down

0 comments on commit 1c540b0

Please sign in to comment.