aboutsummaryrefslogtreecommitdiffstats
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
parentRegenerate shell completions and install script fixes (diff)
downloadrsplayer-071a3ad4cd588843e73ef66a5c44a32beb4ec75e.tar.gz
rsplayer-071a3ad4cd588843e73ef66a5c44a32beb4ec75e.zip
aesthetic changes
-rw-r--r--.zed/tasks.json12
-rw-r--r--Cargo.lock2
-rw-r--r--Cargo.toml2
-rwxr-xr-xinstall.sh5
-rw-r--r--src/daemon.rs7
-rw-r--r--src/notification.rs16
6 files changed, 33 insertions, 11 deletions
diff --git a/.zed/tasks.json b/.zed/tasks.json
index 40c9f3d..9bae85b 100644
--- a/.zed/tasks.json
+++ b/.zed/tasks.json
@@ -3,12 +3,18 @@
3 "label": "code coverage", 3 "label": "code coverage",
4 "command": "cargo tarpaulin", 4 "command": "cargo tarpaulin",
5 "show_command": false, 5 "show_command": false,
6 "show_summary": false 6 "show_summary": false,
7 }, 7 },
8 { 8 {
9 "label": "run tests", 9 "label": "run tests",
10 "command": "cargo test", 10 "command": "cargo test",
11 "show_command": false, 11 "show_command": false,
12 "show_summary": false 12 "show_summary": false,
13 } 13 },
14 {
15 "label": "install",
16 "command": "./install.sh",
17 "show_command": false,
18 "show_summary": false,
19 },
14] 20]
diff --git a/Cargo.lock b/Cargo.lock
index 4d6bee2..d4a7870 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1971,7 +1971,7 @@ dependencies = [
1971 1971
1972[[package]] 1972[[package]]
1973name = "rsp" 1973name = "rsp"
1974version = "0.1.0" 1974version = "0.5.0"
1975dependencies = [ 1975dependencies = [
1976 "chrono", 1976 "chrono",
1977 "clap", 1977 "clap",
diff --git a/Cargo.toml b/Cargo.toml
index 33b6b24..afcc9cf 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
1[package] 1[package]
2name = "rsp" 2name = "rsp"
3version = "0.1.0" 3version = "0.5.0"
4edition = "2024" 4edition = "2024"
5description = "Rust music player daemon with Unix socket IPC" 5description = "Rust music player daemon with Unix socket IPC"
6license = "GPL-3.0 or later" 6license = "GPL-3.0 or later"
diff --git a/install.sh b/install.sh
index a7317e9..3133601 100755
--- a/install.sh
+++ b/install.sh
@@ -19,7 +19,8 @@ cp rsplayer.service ~/.config/systemd/user/
19 19
20if systemctl --user is-active default.target &>/dev/null; then 20if systemctl --user is-active default.target &>/dev/null; then
21 systemctl --user daemon-reload 21 systemctl --user daemon-reload
22 echo "To enable auto-start: systemctl --user enable rsplayer" 22 echo "Activating the daemon…"
23 systemctl --user restart --now rsplayer.service
23else 24else
24 echo "Service installed but not enabled (no user session running)" 25 echo "Service installed but not enabled (no user session running)"
25 echo "To enable later when logged in: systemctl --user enable rsplayer" 26 echo "To enable later when logged in: systemctl --user enable rsplayer"
@@ -62,4 +63,4 @@ case "$shell_name" in
62esac 63esac
63 64
64echo "" 65echo ""
65echo "Done! Run 'rsp start-daemon' to start the daemon." 66echo "Done!"
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}