From 8ea653467131cd6df4a0c4378dd0e73a497b2947 Mon Sep 17 00:00:00 2001 From: Tovi Jaeschke-Rogers Date: Thu, 19 Jun 2025 10:23:36 +0930 Subject: [PATCH] feat: add ncspot configs --- .local/bin/spotify-next | 3 ++- .local/bin/spotify-prev | 3 ++- .local/bin/spotify-toggle | 3 ++- .local/bin/status-music | 11 +++++++++++ .local/bin/tmux-music | 5 +++++ .tmux.conf | 2 ++ 6 files changed, 24 insertions(+), 3 deletions(-) create mode 100755 .local/bin/status-music create mode 100755 .local/bin/tmux-music diff --git a/.local/bin/spotify-next b/.local/bin/spotify-next index 7f0af7a..c3e5986 100755 --- a/.local/bin/spotify-next +++ b/.local/bin/spotify-next @@ -1,3 +1,4 @@ #!/bin/sh -dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next +#dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next +playerctl -p ncspot next diff --git a/.local/bin/spotify-prev b/.local/bin/spotify-prev index bc53e27..ed43747 100755 --- a/.local/bin/spotify-prev +++ b/.local/bin/spotify-prev @@ -1,3 +1,4 @@ #!/bin/sh -dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous +# dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous +playerctl -p ncspot previous diff --git a/.local/bin/spotify-toggle b/.local/bin/spotify-toggle index 22ae554..16c61fc 100755 --- a/.local/bin/spotify-toggle +++ b/.local/bin/spotify-toggle @@ -1,3 +1,4 @@ #!/bin/sh -dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause +# dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause +playerctl -p ncspot play-pause diff --git a/.local/bin/status-music b/.local/bin/status-music new file mode 100755 index 0000000..85a270c --- /dev/null +++ b/.local/bin/status-music @@ -0,0 +1,11 @@ +#!/bin/bash + +# Check if ncspot is playing +status=$(playerctl -p ncspot status 2>/dev/null) + +# Only output song info if ncspot is playing +if [ "$status" = "Playing" ]; then + playerctl -p ncspot metadata --format "{{ artist }} - {{ title }}" 2>/dev/null +else + echo "-" +fi diff --git a/.local/bin/tmux-music b/.local/bin/tmux-music new file mode 100755 index 0000000..11a3e2d --- /dev/null +++ b/.local/bin/tmux-music @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +if ! tmux has-session -t="music" 2> /dev/null; then + tmux new-session -ds "music" -c "$HOME" ncspot +fi +tmux switch-client -t "music" diff --git a/.tmux.conf b/.tmux.conf index 7f4ee92..3299c54 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -70,6 +70,8 @@ bind S command-prompt -p "New Session:" "new-session -A -s '%%'" bind-key -r f run-shell "tmux neww ~/.local/bin/tmux-sessionizer" +bind-key -r m run-shell "~/.local/bin/tmux-music" + # List of plugins set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-sensible'