eww: lyrics highlighting & rofi: adjust size
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
(defpoll lyriclines :interval "500ms" "~/.local/bin/spotify-lyrics print -l 3 -f \"$HOME/.local/state/eww/lyrics/offset\"")
|
||||
(defpoll lyriclines :interval "500ms" "~/.local/bin/spotify-lyrics print -l 3 -a 1 -f \"$HOME/.local/state/eww/lyrics/offset\" | Lyrics/scripts/colorize.sh 2")
|
||||
(deflisten lyricline "~/.local/bin/spotify-lyrics listen -l 1 -f \"$HOME/.local/state/eww/lyrics/offset\"")
|
||||
(defpoll position :interval "1s" "~/.local/bin/spotify-lyrics position")
|
||||
(defpoll length :interval "1s" "~/.local/bin/spotify-lyrics length")
|
||||
@@ -13,7 +13,8 @@
|
||||
(label :class "lyrics-text"
|
||||
:vexpand "false" :hexpand "false" :space-evenly "false"
|
||||
:halign "start"
|
||||
:text lyriclines
|
||||
:unindent "false" :truncate "false" :truncate-left "false"
|
||||
:markup lyriclines
|
||||
)
|
||||
)
|
||||
(box :class "control-box" :vexpand "false" :hexpand "false" :space-evenly "true" :orientation "v"
|
||||
|
||||
24
eww/Lyrics/scripts/colorize.sh
Executable file
24
eww/Lyrics/scripts/colorize.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/env bash
|
||||
|
||||
HIGHLIGHT_COLOR="#cdd6f4" # text
|
||||
NORMAL_COLOR="#7f849c" # overlay1
|
||||
TARGET_LINE=1
|
||||
[ -n $1 ] && TARGET_LINE="$1"
|
||||
|
||||
mapfile -t lines
|
||||
|
||||
output=""
|
||||
for i in "${!lines[@]}"; do
|
||||
line_num=$((i + 1))
|
||||
escaped_line=$(echo "${lines[$i]}" | sed 's/&/\&/g; s/</\</g; s/>/\>/g')
|
||||
|
||||
[[ $i -gt 0 ]] && output+=$'\n' # +="\n" is not properly displayed in eww
|
||||
|
||||
if [[ $line_num -eq $TARGET_LINE ]]; then
|
||||
output+="<span color=\"$HIGHLIGHT_COLOR\">$escaped_line</span>"
|
||||
else
|
||||
output+="<span color=\"$NORMAL_COLOR\">$escaped_line</span>"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "$output"
|
||||
0
eww/Lyrics/scripts/lyric-show.sh
Normal file → Executable file
0
eww/Lyrics/scripts/lyric-show.sh
Normal file → Executable file
Reference in New Issue
Block a user