Skip to content

Commit

Permalink
swapped out spotify for tidal.
Browse files Browse the repository at this point in the history
PS: this uses the private "tidal-hifi" electron app that I am developing and should be released soon.
  • Loading branch information
Mastermindzh committed Oct 30, 2019
1 parent 0bf931d commit 9714b2f
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 17 deletions.
9 changes: 6 additions & 3 deletions i3/config
Original file line number Diff line number Diff line change
Expand Up @@ -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

############################################
Expand Down Expand Up @@ -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 #
Expand Down Expand Up @@ -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
34 changes: 20 additions & 14 deletions i3/i3blocks.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -78,15 +84,15 @@ 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
color=#999999

# Updates
[updates]
label=
label=
command=pacman -Qu | wc -l
interval=60
separator=true
Expand All @@ -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
Expand All @@ -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
Expand All @@ -128,7 +134,7 @@ color=#999999
# Battery indicator
# The battery instance defaults to 0.
# [battery]
# label=
# label=
# #instance=1
# interval=30
# separator=true
Expand All @@ -145,7 +151,7 @@ color=#999999

# Date Time
[time]
label=
label=
command=date '+%Y-%m-%d %H:%M:%S'
interval=1
separator=true
Expand Down
14 changes: 14 additions & 0 deletions i3/scripts/blocks/tidal.sh
Original file line number Diff line number Diff line change
@@ -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 changes: 50 additions & 0 deletions i3/scripts/tidal-cli.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash

TIDAL_HOST="http:https://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

0 comments on commit 9714b2f

Please sign in to comment.