swapped out spotify for tidal.

PS: this uses the private "tidal-hifi" electron app that I am developing and should be released soon.
This commit is contained in:
Rick van Lieshout 2019-10-30 23:37:49 +01:00
parent 0bf931d78f
commit 9714b2fa1d
4 changed files with 90 additions and 17 deletions

View File

@ -40,6 +40,7 @@ set $workspace12 " Enpass"
# scripts # scripts
set $spotify ~/.config/i3/scripts/spotify-cli.sh set $spotify ~/.config/i3/scripts/spotify-cli.sh
set $tidal ~/.config/i3/scripts/tidal-cli.sh
set $vpnmanager ~/.config/i3/scripts/vpn-manager.sh set $vpnmanager ~/.config/i3/scripts/vpn-manager.sh
############################################ ############################################
@ -147,9 +148,9 @@ bindsym XF86AudioPlay exec playerctl play
bindsym XF86AudioPause exec playerctl pause bindsym XF86AudioPause exec playerctl pause
bindsym XF86AudioNext exec playerctl next bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous bindsym XF86AudioPrev exec playerctl previous
bindsym $mod+Next exec $spotify next bindsym $mod+Next exec $tidal next
bindsym $mod+End exec $spotify prev bindsym $mod+End exec $tidal previous
bindsym $mod+Delete exec $spotify play bindsym $mod+Delete exec $tidal playpause
############################################ ############################################
# Workspaces # # Workspaces #
@ -309,3 +310,5 @@ exec --no-startup-id nm-applet
exec_always feh --bg-scale ~/Pictures/Wallpapers/wallpaper.jpg exec_always feh --bg-scale ~/Pictures/Wallpapers/wallpaper.jpg
exec /usr/bin/compton exec /usr/bin/compton
exec /bin/bash ~/.config/i3/scripts/startup.sh exec /bin/bash ~/.config/i3/scripts/startup.sh
bindsym $mod+Shift+a border normal

View File

@ -35,11 +35,17 @@ separator_block_width=13
interval=1 interval=1
color=#e29e0b color=#e29e0b
[spotify] [tidal]
command=bash ~/.config/i3/scripts/blocks/spotify.sh command=bash ~/.config/i3/scripts/blocks/tidal.sh
separator_block_width=13 separator_block_width=13
interval=1 interval=1
color=#1DB954 color=#4293f5
# [spotify]
# command=bash ~/.config/i3/scripts/blocks/spotify.sh
# separator_block_width=13
# interval=1
# color=#1DB954
[weather] [weather]
command=curl wttr.in?format=1 command=curl wttr.in?format=1
@ -106,7 +112,7 @@ separator=true
# ping # ping
[ping] [ping]
label= label=
command=ping -c 2 8.8.8.8 | tail -1| awk '{print $4}' | cut -d '/' -f 2 | cut -f1 -d"." command=ping -c 2 8.8.8.8 | tail -1 | awk '{print $4}' | cut -d '/' -f 2 | cut -f1 -d"."
interval=60 interval=60
separator=true separator=true
color=#999999 color=#999999

View File

@ -0,0 +1,14 @@
#!/bin/bash
case $BLOCK_BUTTON in
1) ~/.config/i3/scripts/tidal-cli.sh playpause ;; # left click
4) ~/.config/i3/scripts/tidal-cli.sh next ;; # scroll up
5) ~/.config/i3/scripts/tidal-cli.sh previous ;; # scroll down
esac
if ~/.config/i3/scripts/tidal-cli.sh status | grep 'paused' >/dev/null; then
printf ' ' # fa-pause
else
printf ' ' # fa-play
fi
~/.config/i3/scripts/tidal-cli.sh info

50
i3/scripts/tidal-cli.sh Executable file
View File

@ -0,0 +1,50 @@
#!/bin/bash
TIDAL_HOST="http://localhost:47836"
function httpGet() {
curl -s "$TIDAL_HOST/$1"
}
function httpSilentGet() {
curl -s -o /dev/null "$TIDAL_HOST/$1"
}
case $1 in
"play")
httpSilentGet play
;;
"pause")
httpSilentGet pause
;;
"playpause")
httpSilentGet playpause
;;
"next")
httpSilentGet next
;;
"previous")
httpSilentGet previous
;;
"info")
JSON=$(httpGet current)
TITLE=$(echo "$JSON" | jq -r '.title')
ARTISTS=$(echo "$JSON" | jq -r '.artist')
INFO=$(echo "$TITLE - $ARTISTS")
if [ ${#INFO} -le 3 ]; then
echo "No music info available"
else
echo "$INFO"
fi
;;
"status")
if httpGet current | grep "paused" >/dev/null; then
echo "paused"
else
echo "playing"
fi
;;
*)
echo "tidal-cli doesn't know this command"
;;
esac