1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-08-17 23:01:04 +02:00

Merge pull request #1048 from postsolar/feat/music-popup-truncate

feat(music): Add `truncate_popup_{artist,album,title}` to `music`
This commit is contained in:
Jake Stanger 2025-06-16 11:40:42 +01:00 committed by GitHub
commit 923fc4b5af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 61 additions and 22 deletions

View file

@ -157,6 +157,21 @@ pub struct MusicModule {
/// **Default**: `null`
pub(crate) truncate: Option<TruncateMode>,
/// See [truncate options](module-level-options#truncate-mode).
///
/// **Default**: `null`
pub(crate) truncate_popup_artist: Option<TruncateMode>,
/// See [truncate options](module-level-options#truncate-mode).
///
/// **Default**: `null`
pub(crate) truncate_popup_album: Option<TruncateMode>,
/// See [truncate options](module-level-options#truncate-mode).
///
/// **Default**: `null`
pub(crate) truncate_popup_title: Option<TruncateMode>,
/// See [layout options](module-level-options#layout)
#[serde(default, flatten)]
pub(crate) layout: LayoutConfig,

View file

@ -280,9 +280,21 @@ impl Module<Button> for MusicModule {
let icons = self.icons;
let info_box = gtk::Box::new(Orientation::Vertical, 10);
let title_label = IconPrefixedLabel::new(&icons.track, None, &image_provider);
if let Some(truncate) = self.truncate_popup_title {
title_label.label.truncate(truncate);
}
let album_label = IconPrefixedLabel::new(&icons.album, None, &image_provider);
if let Some(truncate) = self.truncate_popup_album {
album_label.label.truncate(truncate);
}
let artist_label = IconPrefixedLabel::new(&icons.artist, None, &image_provider);
if let Some(truncate) = self.truncate_popup_artist {
artist_label.label.truncate(truncate);
}
title_label.container.add_class("title");
album_label.container.add_class("album");