diff --git a/dotfiles/fonts/Inconsolata Regular Nerd Font Complete.ttf b/dotfiles/fonts/Inconsolata Regular Nerd Font Complete.ttf new file mode 100644 index 0000000..8ca633e Binary files /dev/null and b/dotfiles/fonts/Inconsolata Regular Nerd Font Complete.ttf differ diff --git a/dotfiles/fonts/Inconsolata for Powerline.otf b/dotfiles/fonts/Inconsolata for Powerline.otf deleted file mode 100644 index f22511c..0000000 Binary files a/dotfiles/fonts/Inconsolata for Powerline.otf and /dev/null differ diff --git a/dotfiles/polybar/config b/dotfiles/polybar/config index 4ea64d4..a5a25ab 100644 --- a/dotfiles/polybar/config +++ b/dotfiles/polybar/config @@ -4,7 +4,7 @@ green = #00d3a8 accent = ${self.green} background = #18191E -foreground = #000000 +foreground = #fff ############################################################################### [font] @@ -25,14 +25,14 @@ height = 35 #padding-left = 0.5 padding-right = 1 -foreground = ${colors.background} +foreground = ${colors.foreground} background = ${colors.background} module-margin = 1 modules-left = i3tabs title modules-center = date -modules-right = backlight network volume battery +modules-right = spotify backlight network volume battery separator = dim-value = 1.0 @@ -89,13 +89,15 @@ enable-click = true enable-scroll = false wrapping-scroll = false +format = + foreground = ${colors.accent} background = #383D41 label-focused = %index% label-focused-foreground = ${self.foreground} label-focused-background = ${self.background} -label-focused-underline = #fba922 +label-focused-underline = #fff label-focused-padding = 2 label-unfocused = %index% @@ -214,3 +216,10 @@ bar-width = 10 bar-indicator = | bar-fill = - bar-empty = - + +############################################################################### +[module/spotify] +type = custom/script +exec = ~/.config/polybar/spotify.sh %artist% - %title% +tail = true +interval = 2 diff --git a/dotfiles/polybar/spotify.sh b/dotfiles/polybar/spotify.sh new file mode 100755 index 0000000..79a0cee --- /dev/null +++ b/dotfiles/polybar/spotify.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +main() { + if ! pgrep -x spotify >/dev/null; then + echo ""; exit + fi + + cmd="org.freedesktop.DBus.Properties.Get" + domain="org.mpris.MediaPlayer2" + path="/org/mpris/MediaPlayer2" + + meta=$(dbus-send --print-reply --dest=${domain}.spotify \ + /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:${domain}.Player string:Metadata) + + artist=$(echo "$meta" | sed -nr '/xesam:artist"/,+2s/^ +string "(.*)"$/\1/p' | tail -1 | sed 's/\&/\\&/g' | sed 's#\/#\\/#g') + album=$(echo "$meta" | sed -nr '/xesam:album"/,+2s/^ +variant +string "(.*)"$/\1/p' | tail -1| sed 's/\&/\\&/g'| sed 's#\/#\\/#g') + title=$(echo "$meta" | sed -nr '/xesam:title"/,+2s/^ +variant +string "(.*)"$/\1/p' | tail -1 | sed 's/\&/\\&/g'| sed 's#\/#\\/#g') + + echo "${*:-%artist% - %title%}" | sed "s/%artist%/$artist/g;s/%title%/$title/g;s/%album%/$album/g"i | sed "s/\&/\&/g" | sed "s#\/#\/#g" + +} + +main "$@"