Skip to content

Commit

Permalink
feat: make loop control work
Browse files Browse the repository at this point in the history
  • Loading branch information
Malanius committed Jan 5, 2024
1 parent ab92c08 commit a914dce
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
4 changes: 2 additions & 2 deletions scripts/spotify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ show_menu() {
"Play/Pause" p "run -b '$CURRENT_DIR/play_pause.sh'" \
"Next" n "run -b '$CURRENT_DIR/next_track.sh'" \
"Previous" b "run -b '$CURRENT_DIR/previous_track.sh" \
"$shuffling_label" s "run -b '$CURRENT_DIR/toggle_shuffle.sh $is_shuffle_on" \
"$repeating_label" r "run -b 'source \"$CURRENT_DIR/spotify.sh\" && toggle_repeat $is_repeat_on'" \
"$shuffling_label" s "run -b '$CURRENT_DIR/toggle_shuffle.sh $is_shuffle_on'" \
"$repeating_label" r "run -b '$CURRENT_DIR/toggle_loop.sh $loop_status'" \
"" \
"Close menu" q ""
)
Expand Down
15 changes: 15 additions & 0 deletions scripts/toggle_loop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

current_loop=$1
target=""
if [[ "$current_loop" == "None" ]]; then
target="Playlist"
elif [[ "$current_loop" == "Playlist" ]]; then
target="Track"
else
target="None"
fi

busctl --user set-property org.mpris.MediaPlayer2.spotify \
/org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player \
LoopStatus s "$target"
2 changes: 0 additions & 2 deletions scripts/toggle_shuffle.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env bash

is_on=$1
echo "is_on: $is_on"
target=""
if [[ "$is_on" == "true" ]]; then
target="false"
Expand All @@ -11,7 +10,6 @@ else
echo "Invalid argument: $is_on"
exit 1
fi
echo "target: $target"

busctl --user set-property org.mpris.MediaPlayer2.spotify \
/org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player \
Expand Down

0 comments on commit a914dce

Please sign in to comment.