[GH-ISSUE #9] Maybe we can start using zvarient like cosmic does? #4

Closed
opened 2026-05-22 22:04:46 +01:00 by JakeStanger · 3 comments
Owner

Originally created by @ogios on GitHub (Jan 31, 2025).
Original GitHub issue: https://github.com/JakeStanger/system-tray/issues/9

Like this(from cosmic):

#[derive(Clone, Debug, zvariant::DeserializeDict)]
pub struct LayoutProps {
    #[zvariant(rename = "accessible-desc")]
    accessible_desc: Option<String>,
    #[zvariant(rename = "children-display")]
    children_display: Option<String>,
    label: Option<String>,
    enabled: Option<bool>,
    visible: Option<bool>,
    #[zvariant(rename = "type")]
    type_: Option<String>,
    #[zvariant(rename = "toggle-type")]
    toggle_type: Option<String>,
    #[zvariant(rename = "toggle-state")]
    toggle_state: Option<i32>,
    #[zvariant(rename = "icon-data")]
    icon_data: Option<Vec<u8>>,
    #[zvariant(rename = "icon-name")]
    icon_name: Option<String>,
    disposition: Option<String>,
    // If this field has a different type, this causes the whole type to fail
    // to parse, due to a zvariant bug.
    // https://github.com/dbus2/zbus/issues/856
    // shortcut: Option<String>,
}

impl zvariant::Type for LayoutProps {
    fn signature() -> zvariant::Signature<'static> {
        zvariant::Signature::try_from("a{sv}").unwrap()
    }
}
Originally created by @ogios on GitHub (Jan 31, 2025). Original GitHub issue: https://github.com/JakeStanger/system-tray/issues/9 Like this(from cosmic): ```rust #[derive(Clone, Debug, zvariant::DeserializeDict)] pub struct LayoutProps { #[zvariant(rename = "accessible-desc")] accessible_desc: Option<String>, #[zvariant(rename = "children-display")] children_display: Option<String>, label: Option<String>, enabled: Option<bool>, visible: Option<bool>, #[zvariant(rename = "type")] type_: Option<String>, #[zvariant(rename = "toggle-type")] toggle_type: Option<String>, #[zvariant(rename = "toggle-state")] toggle_state: Option<i32>, #[zvariant(rename = "icon-data")] icon_data: Option<Vec<u8>>, #[zvariant(rename = "icon-name")] icon_name: Option<String>, disposition: Option<String>, // If this field has a different type, this causes the whole type to fail // to parse, due to a zvariant bug. // https://github.com/dbus2/zbus/issues/856 // shortcut: Option<String>, } impl zvariant::Type for LayoutProps { fn signature() -> zvariant::Signature<'static> { zvariant::Signature::try_from("a{sv}").unwrap() } } ```
Author
Owner

@JakeStanger commented on GitHub (Jan 31, 2025):

I'm struggling to understand this. What are the advantages of going this route?

<!-- gh-comment-id:2626769575 --> @JakeStanger commented on GitHub (Jan 31, 2025): I'm struggling to understand this. What are the advantages of going this route?
Author
Owner

@ogios commented on GitHub (Jan 31, 2025):

i just thinks it may introduce less code for us to maintain.
we're fine with what we do currently, this is not necessary

<!-- gh-comment-id:2626813242 --> @ogios commented on GitHub (Jan 31, 2025): i just thinks it may introduce less code for us to maintain. we're fine with what we do currently, this is not necessary
Author
Owner

@JakeStanger commented on GitHub (Jan 31, 2025):

i just thinks it may introduce less code for us to maintain.

Always a plus in my books - if you're happy to take it on, go for it. I won't be able to take it on any time soon unfortunately though.

<!-- gh-comment-id:2627030734 --> @JakeStanger commented on GitHub (Jan 31, 2025): > i just thinks it may introduce less code for us to maintain. Always a plus in my books - if you're happy to take it on, go for it. I won't be able to take it on any time soon unfortunately though.
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
JakeStanger/system-tray#4
No description provided.