diff --git a/.tmux.conf b/.tmux.conf index 1456ca9..53a8f4f 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -35,10 +35,10 @@ set -g status-style fg=#9d7cd8,bg=#16161e set-window-option -g window-status-current-style bg=#3e3158 set -g status-position top set -g status-interval 10 +set -g status-left "#( ~/tmux_left.sh )" set -g status-left-length 60 -set -g status-left ' Remember tmux layer' set -g status-justify centre -set -g status-right "#( ~/tmux.sh )" +set -g status-right "#( ~/tmux_right.sh )" set -g status-right-length 60 # Get good colors diff --git a/spotify.applescript b/spotify.applescript new file mode 100755 index 0000000..1593abb --- /dev/null +++ b/spotify.applescript @@ -0,0 +1,21 @@ +#!/usr/bin/env osascript +# Returns the current playing song in Spotify for OSX + +tell application "Spotify" + if it is running then + if player state is playing then + set track_name to name of current track + set artist_name to artist of current track + + if artist_name > 0 + # If the track has an artist set and is therefore most likely a song rather than an advert + "♫ " & artist_name & " - " & track_name + else + # If the track doesn't have an artist set and is therefore most likely an advert rather than a song + "~ " & track_name + end if + else + "⏸︎ Spotify is paused" + end if + end if +end tell diff --git a/tmux_left.sh b/tmux_left.sh new file mode 100755 index 0000000..aa85373 --- /dev/null +++ b/tmux_left.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +# Trigger Applescript when on macOS +if [[ "$OSTYPE" == "darwin"* ]]; then + ~/git/dotfiles/spotify.applescript +fi diff --git a/tmux.sh b/tmux_right.sh similarity index 100% rename from tmux.sh rename to tmux_right.sh