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
set $spotify ~/.config/i3/scripts/spotify-cli.sh
set $tidal ~/.config/i3/scripts/tidal-cli.sh
set $vpnmanager ~/.config/i3/scripts/vpn-manager.sh
############################################
@ -147,9 +148,9 @@ bindsym XF86AudioPlay exec playerctl play
bindsym XF86AudioPause exec playerctl pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
bindsym $mod+Next exec $spotify next
bindsym $mod+End exec $spotify prev
bindsym $mod+Delete exec $spotify play
bindsym $mod+Next exec $tidal next
bindsym $mod+End exec $tidal previous
bindsym $mod+Delete exec $tidal playpause
############################################
# Workspaces #
@ -309,3 +310,5 @@ exec --no-startup-id nm-applet
exec_always feh --bg-scale ~/Pictures/Wallpapers/wallpaper.jpg
exec /usr/bin/compton
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
color=#e29e0b
[spotify]
command=bash ~/.config/i3/scripts/blocks/spotify.sh
[tidal]
command=bash ~/.config/i3/scripts/blocks/tidal.sh
separator_block_width=13
interval=1
color=#1DB954
color=#4293f5
# [spotify]
# command=bash ~/.config/i3/scripts/blocks/spotify.sh
# separator_block_width=13
# interval=1
# color=#1DB954
[weather]
command=curl wttr.in?format=1
@ -54,12 +60,12 @@ color=#999999
# see the script for details.
[temperature]
command=bash ~/.config/i3/scripts/blocks/temp.sh
label=
label=
interval=1
color=#999999
[load_average]
label=
label=
interval=10
separator=true
color=#999999
@ -68,7 +74,7 @@ color=#999999
#
# The type defaults to "mem" if the instance is not specified.
[memory]
label=
label=
separator=true
interval=30
color=#999999
@ -78,7 +84,7 @@ color=#999999
# The script may be called with a optional argument to set the alert
# (defaults to 10 for 10%).
[disk]
label=
label=
instance=/
interval=5
separator=true
@ -86,7 +92,7 @@ color=#999999
# Updates
[updates]
label=
label=
command=pacman -Qu | wc -l
interval=60
separator=true
@ -98,15 +104,15 @@ color=#999999
# The address can be forced to IPv4 or IPv6 with -4 or -6 switches.
[iface]
#instance=wlan0
label=
label=
color=#0fad3c
interval=10
separator=true
# ping
[ping]
label=
command=ping -c 2 8.8.8.8 | tail -1| awk '{print $4}' | cut -d '/' -f 2 | cut -f1 -d"."
label=
command=ping -c 2 8.8.8.8 | tail -1 | awk '{print $4}' | cut -d '/' -f 2 | cut -f1 -d"."
interval=60
separator=true
color=#999999
@ -117,7 +123,7 @@ color=#999999
# The second parameter overrides the mixer selection
# See the script for details.
[volume]
label=
label=
instance=Master
interval=1
command=/usr/lib/i3blocks/volume/volume 5 pulse
@ -128,7 +134,7 @@ color=#999999
# Battery indicator
# The battery instance defaults to 0.
# [battery]
# label=
# label=
# #instance=1
# interval=30
# separator=true
@ -145,7 +151,7 @@ color=#999999
# Date Time
[time]
label=
label=
command=date '+%Y-%m-%d %H:%M:%S'
interval=1
separator=true

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