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: update tao to 0.8, refactor tray features #541

Merged
merged 5 commits into from Apr 7, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .changes/config.json
Expand Up @@ -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",
Expand Down
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 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
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 libappindicator3-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
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -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
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