diff options
Diffstat (limited to 'bin/player')
-rwxr-xr-x | bin/player | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -83,24 +83,24 @@ CURRENT_PLAYER="$(cat "$CURRENT_PLAYER_PATH" ||:)" AVAILABLE_PLAYERS="$(playerctl --list-all | LANG=POSIX.UTF-8 sort)" pick_first() { - echo "$AVAILABLE_PLAYERS" | head -n1 + printf '%s\n' "$AVAILABLE_PLAYERS" | head -n1 } next_player() { if [ -z "$CURRENT_PLAYER" ]; then pick_first - elif ! echo "$AVAILABLE_PLAYERS" | grep -q "$CURRENT_PLAYER"; then + elif ! printf '%s\n' "$AVAILABLE_PLAYERS" | grep -q "$CURRENT_PLAYER"; then # Unknown $CURRENT_PLAYER, pick anyone pick_first else - INDEX="$(echo "$AVAILABLE_PLAYERS" | grep -n "$CURRENT_PLAYER" | cut -d: -f1)" - LENGTH="$(echo "$AVAILABLE_PLAYERS" | wc -l)" + INDEX="$(printf '%s\n' "$AVAILABLE_PLAYERS" | grep -n "$CURRENT_PLAYER" | cut -d: -f1)" + LENGTH="$(printf '%s\n' "$AVAILABLE_PLAYERS" | wc -l)" if [ "$INDEX" = "$LENGTH" ]; then # Reached the end of the $AVAILABLE_PLAYERS list, wrapping pick_first else # Get the next player instead - echo "$AVAILABLE_PLAYERS" | awk -v idx="$INDEX" 'NR == idx+1 {print}' + printf '%s\n' "$AVAILABLE_PLAYERS" | awk -v idx="$INDEX" 'NR == idx+1 {print}' fi fi } @@ -146,14 +146,14 @@ case "$ACTION" in ;; rotate) PLAYER="$(next_player)" - echo "$PLAYER" > "$CURRENT_PLAYER_PATH" + printf '%s\n' "$PLAYER" > "$CURRENT_PLAYER_PATH" notify-send -t 1000 -- \ "$(printf '%s' "$PLAYER" | format_player_name)" \ 'current MPRIS target' ;; synopsis) printf '%s: %s\n' \ - "$(echo "$CURRENT_PLAYER" | format_player_name)" \ + "$(printf '%s\n' "$CURRENT_PLAYER" | format_player_name)" \ "$(formatted_player_title)" ;; *) |