Update Polybar
This commit is contained in:
@@ -31,7 +31,6 @@
|
|||||||
+ light
|
+ light
|
||||||
+ pactl
|
+ pactl
|
||||||
+ playerctl
|
+ playerctl
|
||||||
+ spicetify-cli
|
|
||||||
|
|
||||||
### Nvim LSP
|
### Nvim LSP
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ fixed-center = true
|
|||||||
|
|
||||||
line-size = 3
|
line-size = 3
|
||||||
|
|
||||||
module-margin= 2
|
module-margin = 2
|
||||||
|
|
||||||
font-0 = "Product Sans:pixelsize=9:weight=regular;2"
|
font-0 = "Product Sans:pixelsize=9:weight=regular;2"
|
||||||
font-1 = "Product Sans:pixelsize=9:weight=bold;2"
|
font-1 = "Product Sans:pixelsize=9:weight=bold;2"
|
||||||
@@ -68,8 +68,8 @@ modules-left = i3
|
|||||||
[bar/info]
|
[bar/info]
|
||||||
inherit = bar/main
|
inherit = bar/main
|
||||||
|
|
||||||
width = 16%
|
width = 17%
|
||||||
offset-x = 84%:-133px
|
offset-x = 83%:-133px
|
||||||
|
|
||||||
modules-center = cpu memory volume date
|
modules-center = cpu memory volume date
|
||||||
|
|
||||||
@@ -96,8 +96,6 @@ tray-padding = 1
|
|||||||
[bar/music]
|
[bar/music]
|
||||||
inherit = bar/main
|
inherit = bar/main
|
||||||
|
|
||||||
background = ${colors.background}
|
|
||||||
|
|
||||||
width = 18%
|
width = 18%
|
||||||
offset-x = 41%
|
offset-x = 41%
|
||||||
|
|
||||||
@@ -237,10 +235,12 @@ format-underline = ${colors.accent}
|
|||||||
|
|
||||||
[module/spotify]
|
[module/spotify]
|
||||||
type = custom/script
|
type = custom/script
|
||||||
exec = python ~/.config/polybar/scripts/spotify_status.py -f '{artist}: {song}'
|
#exec = python ~/.config/polybar/scripts/spotify_status.py -f '{artist}: {song} '
|
||||||
|
exec = ~/.config/polybar/scripts/song.sh 2>/dev/null || echo "No player found"
|
||||||
interval = 1
|
interval = 1
|
||||||
|
tail = true
|
||||||
|
|
||||||
format-prefix = " "
|
format-prefix = " "
|
||||||
format-underline = ${colors.accent}
|
format-underline = ${colors.accent}
|
||||||
|
|
||||||
[module/cpu]
|
[module/cpu]
|
||||||
|
|||||||
37
files/.config/polybar/scripts/song.sh
Executable file
37
files/.config/polybar/scripts/song.sh
Executable file
@@ -0,0 +1,37 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
function scroll () {
|
||||||
|
prefix="$1"
|
||||||
|
scrolling="$2"
|
||||||
|
temp="$(echo "$scrolling"| sed "s/^\(.\{20\}\)\(.*\)$/\1[\2]/"| sed "s/\[ *\]$//"| sed "s/\[.*\]$//")"
|
||||||
|
suffix="$3"
|
||||||
|
if [ "$(echo -n $scrolling |wc -c)" -gt 20 ]; then
|
||||||
|
echo "$prefix%{T7}$temp%{T-}$suffix"
|
||||||
|
sleep 0.5
|
||||||
|
|
||||||
|
zscroll -l 20 \
|
||||||
|
--delay 0.2 \
|
||||||
|
--before-text "$prefix%{T7}" \
|
||||||
|
--after-text "%{T-}$suffix" \
|
||||||
|
--scroll-padding " " \
|
||||||
|
--update-check true "echo '$(get_title)'" &
|
||||||
|
|
||||||
|
wait
|
||||||
|
else
|
||||||
|
echo "$prefix%{T8} $temp %{T-}$suffix"
|
||||||
|
fi
|
||||||
|
} #
|
||||||
|
|
||||||
|
function get_artist () {
|
||||||
|
echo "$(playerctl -p spotify metadata --format "{{ artist }}"| sed -e "s/[[(]....*[])]*//g" | sed "s/ *$//"| sed "s/^\(.\{20\}[^ ]*\)\(.*\)$/\1[\2]/"| sed "s/\[ *\]$//"| sed "s/\[.*\]$/.../")"
|
||||||
|
} #
|
||||||
|
|
||||||
|
function get_title () {
|
||||||
|
echo "$(playerctl -p spotify metadata --format "{{title}}" | sed 's/'\''/\\'\''/g')"
|
||||||
|
} #
|
||||||
|
|
||||||
|
[ ! -z "$(playerctl -p spotify status 2>/dev/null)" ] \
|
||||||
|
&& artist=$(get_artist) \
|
||||||
|
&& title=$(get_title) \
|
||||||
|
&& ([ -z "$artist$title" ] && scroll "" "Spotify is not connected on this pc" "" || scroll "%{F#79e6f3}$artist%{F#FFF} [" "$title" "]%{F-}" ) \
|
||||||
|
|| exit 1
|
||||||
Reference in New Issue
Block a user