diff --git a/docs/modules/Music.md b/docs/modules/Music.md index 148804d..2e4d16f 100644 --- a/docs/modules/Music.md +++ b/docs/modules/Music.md @@ -11,27 +11,39 @@ in MPRIS mode, the widget will listen to all players and automatically detect/di > Type: `music` -| | Type | Default | Description | -|-----------------------|------------------------------------------------------|----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------| -| `player_type` | `'mpris'` or `'mpd'` | `mpris` | Whether to connect to MPRIS players or an MPD server. | -| `format` | `string` | `{title} / {artist}` | Format string for the widget. More info below. | -| `truncate` | `'start'` or `'middle'` or `'end'` or `off` or `Map` | `off` | The location of the ellipses and where to truncate text from. Leave null to avoid truncating. Use the long-hand `Map` version if specifying a length. | -| `truncate.mode` | `'start'` or `'middle'` or `'end'` or `off` | `off` | The location of the ellipses and where to truncate text from. Leave null to avoid truncating. | -| `truncate.length` | `integer` | `null` | The fixed width (in chars) of the widget. Leave blank to let GTK automatically handle. | -| `truncate.max_length` | `integer` | `null` | The maximum number of characters before truncating. Leave blank to let GTK automatically handle. | -| `icons.play` | `string` or [image](images) | `` | Icon to show when playing. | -| `icons.pause` | `string` or [image](images) | `` | Icon to show when paused. | -| `icons.prev` | `string` or [image](images) | `󰒮` | Icon to show on previous button. | -| `icons.next` | `string` or [image](images) | `󰒭` | Icon to show on next button. | -| `icons.volume` | `string` or [image](images) | `󰕾` | Icon to show under popup volume slider. | -| `icons.track` | `string` or [image](images) | `󰎈` | Icon to show next to track title. | -| `icons.album` | `string` or [image](images) | `󰀥` | Icon to show next to album name. | -| `icons.artist` | `string` or [image](images) | `󰠃` | Icon to show next to artist name. | -| `show_status_icon` | `boolean` | `true` | Whether to show the play/pause icon on the widget. | -| `icon_size` | `integer` | `32` | Size to render icon at (image icons only). | -| `cover_image_size` | `integer` | `128` | Size to render album art image at inside popup. | -| `host` | `string` | `localhost:6600` | [MPD Only] TCP or Unix socket for the MPD server. | -| `music_dir` | `string` | `$HOME/Music` | [MPD Only] Path to MPD server's music directory on disc. Required for album art. | +| | Type | Default | Description | +|------------------------------------|------------------------------------------------------|----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------| +| `player_type` | `'mpris'` or `'mpd'` | `mpris` | Whether to connect to MPRIS players or an MPD server. | +| `format` | `string` | `{title} / {artist}` | Format string for the widget. More info below. | +| `truncate` | `'start'` or `'middle'` or `'end'` or `off` or `Map` | `off` | The location of the ellipses and where to truncate text from. Leave null to avoid truncating. Use the long-hand `Map` version if specifying a length. | +| `truncate.mode` | `'start'` or `'middle'` or `'end'` or `off` | `off` | The location of the ellipses and where to truncate text from. Leave null to avoid truncating. | +| `truncate.length` | `integer` | `null` | The fixed width (in chars) of the widget. Leave blank to let GTK automatically handle. | +| `truncate.max_length` | `integer` | `null` | The maximum number of characters before truncating. Leave blank to let GTK automatically handle. | +| `truncate_popup_artist` | `'start'` or `'middle'` or `'end'` or `off` or `Map` | `off` | The location of the ellipses and where to truncate text from. Leave null to avoid truncating. Use the long-hand `Map` version if specifying a length. | +| `truncate_popup_artist.mode` | `'start'` or `'middle'` or `'end'` or `off` | `off` | The location of the ellipses and where to truncate text from. Leave null to avoid truncating. | +| `truncate_popup_artist.length` | `integer` | `null` | The fixed width (in chars) of the widget. Leave blank to let GTK automatically handle. | +| `truncate_popup_artist.max_length` | `integer` | `null` | The maximum number of characters before truncating. Leave blank to let GTK automatically handle. | +| `truncate_popup_album` | `'start'` or `'middle'` or `'end'` or `off` or `Map` | `off` | The location of the ellipses and where to truncate text from. Leave null to avoid truncating. Use the long-hand `Map` version if specifying a length. | +| `truncate_popup_album.mode` | `'start'` or `'middle'` or `'end'` or `off` | `off` | The location of the ellipses and where to truncate text from. Leave null to avoid truncating. | +| `truncate_popup_album.length` | `integer` | `null` | The fixed width (in chars) of the widget. Leave blank to let GTK automatically handle. | +| `truncate_popup_album.max_length` | `integer` | `null` | The maximum number of characters before truncating. Leave blank to let GTK automatically handle. | +| `truncate_popup_title` | `'start'` or `'middle'` or `'end'` or `off` or `Map` | `off` | The location of the ellipses and where to truncate text from. Leave null to avoid truncating. Use the long-hand `Map` version if specifying a length. | +| `truncate_popup_title.mode` | `'start'` or `'middle'` or `'end'` or `off` | `off` | The location of the ellipses and where to truncate text from. Leave null to avoid truncating. | +| `truncate_popup_title.length` | `integer` | `null` | The fixed width (in chars) of the widget. Leave blank to let GTK automatically handle. | +| `truncate_popup_title.max_length` | `integer` | `null` | The maximum number of characters before truncating. Leave blank to let GTK automatically handle. | +| `icons.play` | `string` or [image](images) | `` | Icon to show when playing. | +| `icons.pause` | `string` or [image](images) | `` | Icon to show when paused. | +| `icons.prev` | `string` or [image](images) | `󰒮` | Icon to show on previous button. | +| `icons.next` | `string` or [image](images) | `󰒭` | Icon to show on next button. | +| `icons.volume` | `string` or [image](images) | `󰕾` | Icon to show under popup volume slider. | +| `icons.track` | `string` or [image](images) | `󰎈` | Icon to show next to track title. | +| `icons.album` | `string` or [image](images) | `󰀥` | Icon to show next to album name. | +| `icons.artist` | `string` or [image](images) | `󰠃` | Icon to show next to artist name. | +| `show_status_icon` | `boolean` | `true` | Whether to show the play/pause icon on the widget. | +| `icon_size` | `integer` | `32` | Size to render icon at (image icons only). | +| `cover_image_size` | `integer` | `128` | Size to render album art image at inside popup. | +| `host` | `string` | `localhost:6600` | [MPD Only] TCP or Unix socket for the MPD server. | +| `music_dir` | `string` | `$HOME/Music` | [MPD Only] Path to MPD server's music directory on disc. Required for album art. |
JSON @@ -168,4 +180,4 @@ and will be replaced with values from the currently playing track: | `.popup-music .progress .slider` | Slider inside progress container | | `.popup-music .progress .label` | Duration label inside progress container | -For more information on styling, please see the [styling guide](styling-guide). \ No newline at end of file +For more information on styling, please see the [styling guide](styling-guide). diff --git a/src/modules/music/config.rs b/src/modules/music/config.rs index d19e0bc..d567a00 100644 --- a/src/modules/music/config.rs +++ b/src/modules/music/config.rs @@ -157,6 +157,21 @@ pub struct MusicModule { /// **Default**: `null` pub(crate) truncate: Option, + /// See [truncate options](module-level-options#truncate-mode). + /// + /// **Default**: `null` + pub(crate) truncate_popup_artist: Option, + + /// See [truncate options](module-level-options#truncate-mode). + /// + /// **Default**: `null` + pub(crate) truncate_popup_album: Option, + + /// See [truncate options](module-level-options#truncate-mode). + /// + /// **Default**: `null` + pub(crate) truncate_popup_title: Option, + /// See [layout options](module-level-options#layout) #[serde(default, flatten)] pub(crate) layout: LayoutConfig, diff --git a/src/modules/music/mod.rs b/src/modules/music/mod.rs index f55b2e4..b1121a0 100644 --- a/src/modules/music/mod.rs +++ b/src/modules/music/mod.rs @@ -280,9 +280,21 @@ impl Module