diff options
| author | Donald Williams <129223418+dwilliam62@users.noreply.github.com> | 2025-10-13 20:31:53 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-13 20:31:53 -0400 |
| commit | e4be12e23fa8d6f8a73dde974ea6adf242885bc1 (patch) | |
| tree | b879abcf54989120a0931443bfb8203c885c2b20 /config/hypr/scripts/MediaCtrl.sh | |
| parent | 0e52d19b894e3cfd2c87cfbcc35ae087d48f5485 (diff) | |
| parent | 9d26c191c1071a542e816d1bc2b0b3f96ebfa74d (diff) | |
Merge pull request #841 from JaKooLit/ddubs-hyprsunset
Merge ddubs-hyprsunset into main fixes for wallust, sddm and weather
Diffstat (limited to 'config/hypr/scripts/MediaCtrl.sh')
| -rwxr-xr-x | config/hypr/scripts/MediaCtrl.sh | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/config/hypr/scripts/MediaCtrl.sh b/config/hypr/scripts/MediaCtrl.sh index 2cbeccf3..000c3ade 100755 --- a/config/hypr/scripts/MediaCtrl.sh +++ b/config/hypr/scripts/MediaCtrl.sh @@ -6,56 +6,57 @@ music_icon="$HOME/.config/swaync/icons/music.png" # Play the next track play_next() { - playerctl next - show_music_notification + playerctl next + show_music_notification } # Play the previous track play_previous() { - playerctl previous - show_music_notification + playerctl previous + show_music_notification } # Toggle play/pause toggle_play_pause() { - playerctl play-pause - show_music_notification + playerctl play-pause + sleep 0.1 + show_music_notification } # Stop playback stop_playback() { - playerctl stop - notify-send -e -u low -i $music_icon " Playback:" " Stopped" + playerctl stop + notify-send -e -u low -i $music_icon " Playback:" " Stopped" } # Display notification with song information show_music_notification() { - status=$(playerctl status) - if [[ "$status" == "Playing" ]]; then - song_title=$(playerctl metadata title) - song_artist=$(playerctl metadata artist) - notify-send -e -u low -i $music_icon "Now Playing:" "$song_title by $song_artist" - elif [[ "$status" == "Paused" ]]; then - notify-send -e -u low -i $music_icon " Playback:" " Paused" - fi + status=$(playerctl status) + if [[ "$status" == "Playing" ]]; then + song_title=$(playerctl metadata title) + song_artist=$(playerctl metadata artist) + notify-send -e -u low -i $music_icon "Now Playing:" "$song_title by $song_artist" + elif [[ "$status" == "Paused" ]]; then + notify-send -e -u low -i $music_icon " Playback:" " Paused" + fi } # Get media control action from command line argument case "$1" in - "--nxt") - play_next - ;; - "--prv") - play_previous - ;; - "--pause") - toggle_play_pause - ;; - "--stop") - stop_playback - ;; - *) - echo "Usage: $0 [--nxt|--prv|--pause|--stop]" - exit 1 - ;; +"--nxt") + play_next + ;; +"--prv") + play_previous + ;; +"--pause") + toggle_play_pause + ;; +"--stop") + stop_playback + ;; +*) + echo "Usage: $0 [--nxt|--prv|--pause|--stop]" + exit 1 + ;; esac |
