From 47aa0ed2f759ecc918214ee2dd98e543452e2860 Mon Sep 17 00:00:00 2001 From: iovxw Date: Sat, 7 Dec 2024 11:29:24 +0800 Subject: [PATCH] Make `Orientation` compatible with both org.freedesktop.StatusNotifierItem and org.kde.StatusNotifierItem --- src/tray.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/tray.rs b/src/tray.rs index 68c0d98..250b9d4 100644 --- a/src/tray.rs +++ b/src/tray.rs @@ -3,11 +3,18 @@ use std::fmt; use zbus::zvariant::{Type, Value}; /// Represent the horizontal or vertical orientation of the scroll request +// In org.freedesktop.StatusNotifierItem it's "horizontal" and "vertical" +// In org.kde.StatusNotifierItem it's "Horizontal" and "Vertical" +// GNOME: +// https://github.com/ubuntu/gnome-shell-extension-appindicator/blob/557dbddc8d469d1aaa302e6cf70600855dd767d1/appIndicator.js#L840-L861 +// KDE: +// https://github.com/KDE/plasma-workspace/blob/4a98130f76bcae4211d3f9b10e4a7b760613ffc6/applets/systemtray/package/contents/ui/items/StatusNotifierItem.qml#L99-L115 #[derive(Copy, Clone, Debug, Eq, PartialEq, Type, Deserialize)] #[zvariant(signature = "s")] -#[serde(rename_all = "lowercase")] pub enum Orientation { + #[serde(alias = "horizontal")] Horizontal, + #[serde(alias = "vertical")] Vertical, }