aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsalmonik <raisersoft@proton.me>2026-05-15 16:55:50 +0200
committersalmonik <raisersoft@proton.me>2026-05-15 16:55:50 +0200
commit071a3ad4cd588843e73ef66a5c44a32beb4ec75e (patch)
tree4abb0a6a75fc0bb9363e407a213aafb8cea9cde2 /src
parentRegenerate shell completions and install script fixes (diff)
downloadrsplayer-071a3ad4cd588843e73ef66a5c44a32beb4ec75e.tar.gz
rsplayer-071a3ad4cd588843e73ef66a5c44a32beb4ec75e.zip
aesthetic changes
Diffstat (limited to '')
-rw-r--r--src/daemon.rs7
-rw-r--r--src/notification.rs16
2 files changed, 19 insertions, 4 deletions
diff --git a/src/daemon.rs b/src/daemon.rs
index acc7729..2b38025 100644
--- a/src/daemon.rs
+++ b/src/daemon.rs
@@ -271,18 +271,22 @@ fn process_command(
271 } 271 }
272 "pause" => { 272 "pause" => {
273 audio.pause(); 273 audio.pause();
274 notification::notify_change("Paused");
274 "Paused\n".to_string() 275 "Paused\n".to_string()
275 } 276 }
276 "resume" => { 277 "resume" => {
277 audio.resume(); 278 audio.resume();
279 notification::notify_change("Resumed");
278 "Resumed\n".to_string() 280 "Resumed\n".to_string()
279 } 281 }
280 "toggle" => { 282 "toggle" => {
281 if audio.is_playing() { 283 if audio.is_playing() {
282 audio.pause(); 284 audio.pause();
285 notification::notify_change("Paused");
283 "Paused\n".to_string() 286 "Paused\n".to_string()
284 } else { 287 } else {
285 audio.resume(); 288 audio.resume();
289 notification::notify_change("Resumed");
286 "Resumed\n".to_string() 290 "Resumed\n".to_string()
287 } 291 }
288 } 292 }
@@ -291,6 +295,7 @@ fn process_command(
291 if let Ok(mut q) = queue.lock() { 295 if let Ok(mut q) = queue.lock() {
292 q.clear(); 296 q.clear();
293 } 297 }
298 notification::notify_change("Stopped");
294 "Stopped\n".to_string() 299 "Stopped\n".to_string()
295 } 300 }
296 "stop_daemon" => { 301 "stop_daemon" => {
@@ -551,6 +556,8 @@ fn process_command(
551 }; 556 };
552 if track_idx == playing_track_idx && is_playing { 557 if track_idx == playing_track_idx && is_playing {
553 output.push_str(&format!("> {} (playing)\n", track_str)); 558 output.push_str(&format!("> {} (playing)\n", track_str));
559 } else if track_idx == playing_track_idx && !is_playing {
560 output.push_str(&format!("> {} (paused)\n", track_str));
554 } else { 561 } else {
555 output.push_str(&format!(" {}\n", track_str)); 562 output.push_str(&format!(" {}\n", track_str));
556 } 563 }
diff --git a/src/notification.rs b/src/notification.rs
index 4947e6f..df9c622 100644
--- a/src/notification.rs
+++ b/src/notification.rs
@@ -18,7 +18,7 @@ pub fn notify_track(track: &Track, format: Option<&str>) {
18 let _ = notify_rust::Notification::new() 18 let _ = notify_rust::Notification::new()
19 .summary("Now Playing") 19 .summary("Now Playing")
20 .body(&body) 20 .body(&body)
21 .appname("rsp") 21 .appname("RSPlayer")
22 .show(); 22 .show();
23} 23}
24 24
@@ -26,14 +26,22 @@ pub fn notify_queue_ended() {
26 let _ = notify_rust::Notification::new() 26 let _ = notify_rust::Notification::new()
27 .summary("Playback Ended") 27 .summary("Playback Ended")
28 .body("The queue is empty") 28 .body("The queue is empty")
29 .appname("rsp") 29 .appname("RSPlayer")
30 .show();
31}
32
33pub fn notify_change(state: &str) {
34 let _ = notify_rust::Notification::new()
35 .summary(state)
36 .body(&format!("Playback {}", state.to_lowercase()))
37 .appname("RSPlayer")
30 .show(); 38 .show();
31} 39}
32 40
33pub fn notify_error(context: &str) { 41pub fn notify_error(context: &str) {
34 let _ = notify_rust::Notification::new() 42 let _ = notify_rust::Notification::new()
35 .summary("rsp Error") 43 .summary("RSPlayer Error")
36 .body(&format!("{} - Check the logs for details", context)) 44 .body(&format!("{} - Check the logs for details", context))
37 .appname("rsp") 45 .appname("RSPlayer")
38 .show(); 46 .show();
39} 47}