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
@ -54,12 +60,12 @@ color=#999999
# see the script for details. # see the script for details.
[temperature] [temperature]
command=bash ~/.config/i3/scripts/blocks/temp.sh command=bash ~/.config/i3/scripts/blocks/temp.sh
label= label=
interval=1 interval=1
color=#999999 color=#999999
[load_average] [load_average]
label= label=
interval=10 interval=10
separator=true separator=true
color=#999999 color=#999999
@ -68,7 +74,7 @@ color=#999999
# #
# The type defaults to "mem" if the instance is not specified. # The type defaults to "mem" if the instance is not specified.
[memory] [memory]
label= label=
separator=true separator=true
interval=30 interval=30
color=#999999 color=#999999
@ -78,7 +84,7 @@ color=#999999
# The script may be called with a optional argument to set the alert # The script may be called with a optional argument to set the alert
# (defaults to 10 for 10%). # (defaults to 10 for 10%).
[disk] [disk]
label= label=
instance=/ instance=/
interval=5 interval=5
separator=true separator=true
@ -86,7 +92,7 @@ color=#999999
# Updates # Updates
[updates] [updates]
label= label=
command=pacman -Qu | wc -l command=pacman -Qu | wc -l
interval=60 interval=60
separator=true separator=true
@ -98,15 +104,15 @@ color=#999999
# The address can be forced to IPv4 or IPv6 with -4 or -6 switches. # The address can be forced to IPv4 or IPv6 with -4 or -6 switches.
[iface] [iface]
#instance=wlan0 #instance=wlan0
label= label=
color=#0fad3c color=#0fad3c
interval=10 interval=10
separator=true 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
@ -117,7 +123,7 @@ color=#999999
# The second parameter overrides the mixer selection # The second parameter overrides the mixer selection
# See the script for details. # See the script for details.
[volume] [volume]
label= label=
instance=Master instance=Master
interval=1 interval=1
command=/usr/lib/i3blocks/volume/volume 5 pulse command=/usr/lib/i3blocks/volume/volume 5 pulse
@ -128,7 +134,7 @@ color=#999999
# Battery indicator # Battery indicator
# The battery instance defaults to 0. # The battery instance defaults to 0.
# [battery] # [battery]
# label= # label=
# #instance=1 # #instance=1
# interval=30 # interval=30
# separator=true # separator=true
@ -145,7 +151,7 @@ color=#999999
# Date Time # Date Time
[time] [time]
label= label=
command=date '+%Y-%m-%d %H:%M:%S' command=date '+%Y-%m-%d %H:%M:%S'
interval=1 interval=1
separator=true 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