Add 'hide_display_names' config option

This commit is contained in:
James Adam
2022-07-08 16:22:23 +01:00
committed by Henrik Friedrichsen
parent 0cb1aa5d96
commit ed10872ca3
4 changed files with 45 additions and 30 deletions

View File

@@ -325,31 +325,32 @@ runtime use the `reload` command.
Possible configuration values are: Possible configuration values are:
| Name | Description | Possible values | Default | | Name | Description | Possible values | Default |
|---------------------------------|---------------------------------------------------|-----------------------------------------------------------------|-------------| |---------------------------------|-----------------------------------------------------------------|-----------------------------------------------------------------|-------------|
| `command_key` | Key to open command line | Single character | `:` | | `command_key` | Key to open command line | Single character | `:` |
| `initial_screen` | Screen to show after startup | `"library"`, `"search"`, `"queue"`, `"cover"`<sup>[1]</sup> | `"library"` | | `initial_screen` | Screen to show after startup | `"library"`, `"search"`, `"queue"`, `"cover"`<sup>[1]</sup> | `"library"` |
| `use_nerdfont` | Turn nerdfont glyphs on/off | `true`, `false` | `false` | | `use_nerdfont` | Turn nerdfont glyphs on/off | `true`, `false` | `false` |
| `flip_status_indicators` | Reverse play/pause icon meaning<sup>[2]</sup> | `true`, `false` | `false` | | `flip_status_indicators` | Reverse play/pause icon meaning<sup>[2]</sup> | `true`, `false` | `false` |
| `backend` | Audio backend to use | String<sup>[3]</sup> | | | `backend` | Audio backend to use | String<sup>[3]</sup> | |
| `backend_device` | Audio device to configure the backend | String | | | `backend_device` | Audio device to configure the backend | String | |
| `audio_cache` | Enable caching of audio files | `true`, `false` | `true` | | `audio_cache` | Enable caching of audio files | `true`, `false` | `true` |
| `audio_cache_size` | Maximum size of audio cache in MiB | Number | | | `audio_cache_size` | Maximum size of audio cache in MiB | Number | |
| `volnorm` | Enable volume normalization | `true`, `false` | `false` | | `volnorm` | Enable volume normalization | `true`, `false` | `false` |
| `volnorm_pregain` | Normalization pregain to apply in dB (if enabled) | Number | `0.0` | | `volnorm_pregain` | Normalization pregain to apply in dB (if enabled) | Number | `0.0` |
| `default_keybindings` | Enable default keybindings | `true`, `false` | `false` | | `default_keybindings` | Enable default keybindings | `true`, `false` | `false` |
| `notify`<sup>[4]</sup> | Enable desktop notifications | `true`, `false` | `false` | | `notify`<sup>[4]</sup> | Enable desktop notifications | `true`, `false` | `false` |
| `bitrate` | Audio bitrate to use for streaming | `96`, `160`, `320` | `320` | | `bitrate` | Audio bitrate to use for streaming | `96`, `160`, `320` | `320` |
| `album_column` | Show album column for tracks | `true`, `false` | `true` | | `album_column` | Show album column for tracks | `true`, `false` | `true` |
| `gapless` | Enable gapless playback | `true`, `false` | `true` | | `gapless` | Enable gapless playback | `true`, `false` | `true` |
| `shuffle` | Set default shuffle state | `true`, `false` | `false` | | `shuffle` | Set default shuffle state | `true`, `false` | `false` |
| `repeat` | Set default repeat mode | `off`, `track`, `playlist` | `off` | | `repeat` | Set default repeat mode | `off`, `track`, `playlist` | `off` |
| `playback_state` | Set default playback state | `"Stopped"`, `"Paused"`, `"Playing"`, `"Default"` | `"Paused"` | | `playback_state` | Set default playback state | `"Stopped"`, `"Paused"`, `"Playing"`, `"Default"` | `"Paused"` |
| `library_tabs` | Tabs to show in library screen | Array of `tracks`, `albums`, `artists`, `playlists`, `podcasts` | All tabs | | `library_tabs` | Tabs to show in library screen | Array of `tracks`, `albums`, `artists`, `playlists`, `podcasts` | All tabs |
| `cover_max_scale`<sup>[1]</sup> | Set maximum scaling ratio for cover art | Number | `1.0` | | `cover_max_scale`<sup>[1]</sup> | Set maximum scaling ratio for cover art | Number | `1.0` |
| `[track_format]` | Set active fields shown in Library/Queue views | See [track formatting](#track-formatting) | | | `hide_display_names` | Hides spotify usernames in the library header and on playlists | `true`, `false` | `false` |
| `[theme]` | Custom theme | See [custom theme](#theming) | | | `[track_format]` | Set active fields shown in Library/Queue views | See [track formatting](#track-formatting) | |
| `[keybindings]` | Custom keybindings | See [custom keybindings](#custom-keybindings) | | | `[theme]` | Custom theme | See [custom theme](#theming) | |
| `[keybindings]` | Custom keybindings | See [custom keybindings](#custom-keybindings) | |
1. If built with the `cover` feature. 1. If built with the `cover` feature.
2. By default the statusbar will show a play icon when a track is playing and 2. By default the statusbar will show a play icon when a track is playing and

View File

@@ -74,6 +74,7 @@ pub struct ConfigValues {
pub playback_state: Option<PlaybackState>, pub playback_state: Option<PlaybackState>,
pub track_format: Option<TrackFormat>, pub track_format: Option<TrackFormat>,
pub library_tabs: Option<Vec<LibraryTab>>, pub library_tabs: Option<Vec<LibraryTab>>,
pub hide_display_names: Option<bool>,
} }
#[derive(Serialize, Deserialize, Debug, Default, Clone)] #[derive(Serialize, Deserialize, Debug, Default, Clone)]

View File

@@ -191,10 +191,11 @@ impl ListItem for Playlist {
} }
} }
fn display_left(&self, _library: Arc<Library>) -> String { fn display_left(&self, library: Arc<Library>) -> String {
match self.owner_name.as_ref() { let hide_owners = library.cfg.values().hide_display_names.unwrap_or(false);
Some(owner) => format!("{}{}", self.name, owner), match (self.owner_name.as_ref(), hide_owners) {
None => self.name.clone(), (Some(owner), false) => format!("{}{}", self.name, owner),
_ => self.name.clone(),
} }
} }

View File

@@ -61,7 +61,19 @@ impl LibraryView {
Self { Self {
tabs: tabview, tabs: tabview,
display_name: library.display_name.clone(), display_name: {
let hide_username = library
.cfg
.values()
.hide_display_names
.clone()
.unwrap_or(false);
if hide_username {
None
} else {
library.display_name.clone()
}
},
} }
} }
} }