Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ All configuration files should be placed inside the application's configuration
| `playback_metadata_fields` | list of ordered metadata fields to display in the playback UI's `{metadata}` section. Possible values: `"repeat"`, `"shuffle"`, `"volume"`, `"device"` | `["repeat", "shuffle", "volume", "device"]` |
| `notify_format` | the format of a notification (`notify` feature only) | `{ summary = "{track} • {artists}", body = "{album}" }` |
| `notify_timeout_in_secs` | the timeout (in seconds) of a notification (`notify` feature only) | `0` (no timeout) |
| `notify_transient` | notify sends a transient notification that doesn't stay in history (`notify` feature only) | `false` |
| `player_event_hook_command` | the hook command executed when there is a new player event | `None` |
| `ap_port` | the application's Spotify session connection port | `None` |
| `proxy` | the application's Spotify session connection proxy | `None` |
Expand Down
1 change: 1 addition & 0 deletions examples/app.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ playback_format = "{status} {track} • {artists}\n{album} • {genres}\n{metada
playback_metadata_fields = ["repeat", "shuffle", "volume", "device"]
notify_format = { summary = "{track} • {artists}", body = "{album}" }
notify_timeout_in_secs = 0
notify_transient = false
app_refresh_duration_in_ms = 32
playback_refresh_duration_in_ms = 0
page_size_in_rows = 20
Expand Down
4 changes: 4 additions & 0 deletions spotify_player/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1789,6 +1789,7 @@ impl AppClient {
cover_img_path: &std::path::Path,
) -> Result<()> {
let mut n = notify_rust::Notification::new();
use notify_rust::Hint;

let re = regex::Regex::new(r"\{.*?\}").unwrap();
// Generate a text described a track from a format string.
Expand Down Expand Up @@ -1856,6 +1857,9 @@ impl AppClient {
configs.app_config.notify_timeout_in_secs,
));
}
if configs.app_config.notify_transient {
n.hint(Hint::Transient(true));
}
n.show()?;

Ok(())
Expand Down
2 changes: 2 additions & 0 deletions spotify_player/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ pub struct AppConfig {
pub notify_format: NotifyFormat,
#[cfg(feature = "notify")]
pub notify_timeout_in_secs: u64,
pub notify_transient: bool,

pub tracks_playback_limit: usize,

Expand Down Expand Up @@ -298,6 +299,7 @@ impl Default for AppConfig {
},
#[cfg(feature = "notify")]
notify_timeout_in_secs: 0,
notify_transient: false,

player_event_hook_command: None,

Expand Down