diff --git a/Cargo.toml b/Cargo.toml index be4a6b4..17fae85 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ categories = ["gui"] default = [] serde = ["muda/serde", "dep:serde"] common-controls-v6 = ["muda/common-controls-v6"] -linux-ksni = ["muda/linux-ksni"] +linux-ksni = ["dep:ksni", "dep:arc-swap", "muda/linux-ksni"] [dependencies] muda = { version = "0.15", default-features = false } @@ -32,14 +32,10 @@ features = [ ] [target."cfg(target_os = \"linux\")".dependencies] -dirs = "5" - -[target."cfg(all(target_os = \"linux\", not(feature = \"linux-ksni\")))".dependencies] libappindicator = "0.9" - -[target."cfg(all(target_os = \"linux\", feature = \"linux-ksni\"))".dependencies] -arc-swap = "1.7.1" -ksni = "0.2.2" +arc-swap = { version = "1.7.1", optional = true } +ksni = { version = "0.2.2", optional = true } +dirs = "5" [target."cfg(target_os = \"linux\")".dev-dependencies] gtk = "0.18" diff --git a/README.md b/README.md index 5c89d3f..b054ccb 100644 --- a/README.md +++ b/README.md @@ -19,22 +19,18 @@ tray-icon lets you create tray icons for desktop applications. ## Dependencies (Linux Only) -On Linux, `gtk` is required. `libappindicator` or `libayatana-appindicator` are used to create the tray icon. Alternatively `libdbus-1-dev` is used to communicate with the desktop environment to manage the tray icon, if the `linux-ksni` feature is enabled. So make sure to install these packages on your system. +On Linux, `gtk`, `libappindicator` or `libayatana-appindicator` are used to create the tray icon. When using the `linux-ksni` feature, `libdbus-1-dev` is needed as well. So make sure to install these packages on your system. #### Arch Linux / Manjaro: ```sh -pacman -S gtk3 libappindicator-gtk3 # or libayatana-appindicator -# or -pacman -S gtk3 dbus +pacman -S gtk3 libappindicator-gtk3 # or `libayatana-appindicator` and optionally `dbus` ``` #### Debian / Ubuntu: ```sh -sudo apt install libgtk-3-dev libappindicator3-dev # or libayatana-appindicator3-dev -# or -sudo apt install libgtk-3-dev libdbus-1-dev +sudo apt install libgtk-3-dev libappindicator3-dev # or `libayatana-appindicator3-dev` and optionally `libdbus-1-dev` ``` ## Examples diff --git a/src/lib.rs b/src/lib.rs index 29fd893..1b6703d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -18,29 +18,25 @@ //! - On macOS, an event loop must be running on the main thread so you also need to create the tray icon on the main thread. You must make sure that the event loop is already running and not just created before creating a TrayIcon to prevent issues with fullscreen apps. In Winit for example the earliest you can create icons is on [`StartCause::Init`](https://docs.rs/winit/latest/winit/event/enum.StartCause.html#variant.Init). //! //! # Cargo Features -//! +//! //! - `common-controls-v6`: Use `TaskDialogIndirect` API from `ComCtl32.dll` v6 on Windows for showing the predefined `About` menu item dialog. //! - `serde`: Enables de/serializing derives. //! - `linux-ksni`: Use ksni and the xdg standard to create and manage tray icons on Linux. (experimental) -//! +//! //! # Dependencies (Linux Only) //! -//! On Linux, `gtk` is required. `libappindicator` or `libayatana-appindicator` are used to create the tray icon. Alternatively `libdbus-1-dev` is used to communicate with the desktop environment to manage the tray icon, if the `linux-ksni` feature is enabled. So make sure to install these packages on your system. +//! On Linux, `gtk`, `libappindicator` or `libayatana-appindicator` are used to create the tray icon. When using the `linux-ksni` feature, `libdbus-1-dev` is needed as well. So make sure to install these packages on your system. //! //! #### Arch Linux / Manjaro: //! //! ```sh -//! pacman -S gtk3 libappindicator-gtk3 # or libayatana-appindicator -//! # or -//! pacman -S gtk3 dbus +//! pacman -S gtk3 libappindicator-gtk3 # or `libayatana-appindicator` and optionally `dbus` //! ``` //! //! #### Debian / Ubuntu: //! //! ```sh -//! sudo apt install libgtk-3-dev libappindicator3-dev # or libayatana-appindicator3-dev -//! # or -//! sudo apt install libgtk-3-dev libdbus-1-dev +//! sudo apt install libgtk-3-dev libappindicator3-dev # or `libayatana-appindicator3-dev` and optionally `libdbus-1-dev` //! ``` //! //! # Examples @@ -288,7 +284,7 @@ impl TrayIconBuilder { } /// Set tray icon temp dir path. **Linux only**. - /// + /// /// Not availabe with feature `linux-ksni`. /// /// On Linux, we need to write the icon to the disk and usually it will @@ -403,7 +399,7 @@ impl TrayIcon { } /// Sets the tray icon temp dir path. **Linux only**. - /// + /// /// Not availabe with feature `linux-ksni`. /// /// On Linux, we need to write the icon to the disk and usually it will