eww: better lyrics

This commit is contained in:
2025-06-26 03:37:36 +02:00
parent 5517c99370
commit e2e150c95c
18 changed files with 134 additions and 56 deletions

View File

@@ -27,7 +27,7 @@
.lyrics-box-single {
margin: 5px 0px 5px 10px;
min-width: 634px;
min-width: 740px;
}
.lyrics-text {

View File

@@ -3,7 +3,8 @@
(defpoll position :interval "1s" "~/.local/bin/spotify-lyrics position")
(defpoll length :interval "1s" "~/.local/bin/spotify-lyrics length")
(defpoll offset :interval "1s" "cat $HOME/.local/state/eww/lyrics/offset")
(defpoll play-button :interval "1s" "if ~/.local/bin/spotify-lyrics status; then echo \"󰏤\"; else echo \"󰐊\"; fi")(defvar hover false)
(defpoll play-button :interval "1s" "if ~/.local/bin/spotify-lyrics status; then echo \"󰏤\"; else echo \"󰐊\"; fi")
(defvar hover false)
(defwidget lyrics []
(box :class "lyrics-window" :space-evenly "false" :orientation "v"
@@ -22,7 +23,7 @@
)
(box :class "control-row-1" :space-evenly "false" :orientation "h"
(button :class "offset-reset" :onclick "Lyrics/scripts/lyric-offset.py" "󰾅")
(button :class "offset-clear" :onclick "Lyrics/scripts/lyric-clear.sh" "󰑙")
(button :class "offset-clear" :onclick "Lyrics/scripts/lyric-clear.sh $(~/.local/bin/spotify-lyrics trackid)" "󰑙")
)
)
)

View File

@@ -1,6 +1,9 @@
#!/bin/sh
killall spotify-lyrics
sleep 0.1
"$HOME/.local/bin/spotify-lyrics" clear
notify-send -a "spotify-lyrics" "Cache Cleared" "The lyrics cache have been cleared."
if [ -z $1 ]; then
"$HOME/.local/bin/spotify-lyrics" clear
notify-send -a "spotify-lyrics" "Cache Cleared" "Lyrics cache have been cleared."
else
"$HOME/.local/bin/spotify-lyrics" clear "$1"
notify-send -a "spotify-lyrics" "Cache Cleared" "Lyrics cache for track $1 have been cleared."
fi

View File

@@ -142,7 +142,7 @@
background-size: cover;
background-repeat: no-repeat;
min-width: 455px;
min-height: 200px;
min-height: 240px;
border-radius: 17px;
background-position: center;
margin: 20px 0px 0px 20px;
@@ -170,9 +170,9 @@
}
.music-stuff-box {
min-height: 200px;
border-radius: 15px;
background: linear-gradient(to right, $bg-alt, transparent);
min-height: 240px;
}
.player-cover-box {
@@ -213,7 +213,7 @@
.cavabar {
font-size: 14px;
color: $lavender;
color: $blue;
}
.music-controls-box {

View File

@@ -1,6 +1,6 @@
;; variables
(defvar window false)
(defpoll time :interval "1s" "date '+%I %M'")
(defpoll time :interval "1s" "date '+%H %M'")
(defpoll date :interval "1s" "date '+%A, %B %d'")
(deflisten notifications-cards "Main/scripts/logger.zsh subscribe")
(defpoll notifications-crits :interval "1s" "Main/scripts/logger.zsh crits")
@@ -24,6 +24,7 @@
(defpoll music-pp :interval "1s" "Main/scripts/music-title --icon")
(defpoll music-artist :interval "1s" "Main/scripts/music-artist")
(defpoll music-art :interval "1s" "Main/scripts/music-art")
(defpoll music-art-blur :interval "1s" "Main/scripts/music-art --blur")
(defpoll volume :interval "1s" "Main/scripts/system --vol")
(defpoll brightness :interval "1s" "Main/scripts/system --bri")
(defpoll fortune :interval "1h" "Main/scripts/fortune-split 32 9")
@@ -32,7 +33,8 @@
(defpoll artist :interval "1s" "Main/scripts/player --artist")
(defpoll album :interval "1s" "Main/scripts/player --album")
(defpoll length-info :interval "1s" "Main/scripts/player --length-info")
(defpoll art :interval "1s" "Main/scripts/player --cover")
(defvar volume-hover false)
(defvar brightness-hover false)
;; widgets
(defwidget main []
@@ -51,10 +53,27 @@
(label :class "stats-header" :halign "start" :text "Stats")
(box :class "volume-stats" :hexpand "false" :vexpand "false" :space-evenly "false"
(label :tooltip "${volume}%" :class "volume-icon" :text "󰕾")
(scale :min 0 :max 101 :active false :value {volume == "" ? 0 : volume} :class "volume-scale" :width 150))
(eventbox :class "volume-eventbox"
:onhover "eww update volume-hover=true"
:onhoverlost "eww update volume-hover=false"
:cursor "pointer"
:space-evenly "false"
(scale :min 0 :max 101 :class "volume-scale" :width 150
:value {volume == "" ? 0 : volume}
:round-digits 0
:onchange { volume-hover ? "wpctl set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ {}%" : "" }
)))
(box :class "brightness-stats" :hexpand "false" :vexpand "false" :space-evenly "false"
(label :tooltip "${brightness}%" :class "brightness-icon" :text "󰃠")
(scale :min 0 :max 101 :active false :value {brightness == "" ? 0 : brightness} :class "brightness-scale" :width 150))
(eventbox :class "brightness-eventbox"
:onhover "eww update brightness-hover=true"
:onhoverlost "eww update brightness-hover=false"
:cursor "pointer"
:space-evenly "false"
(scale :min 0 :max 101 :class "brightness-scale" :width 150
:value {brightness == "" ? 0 : brightness}
:round-digits 0
:onchange { brightness-hover ? "brightnessctl set {}\% -d $DISPLAY_DEVICE" : "" })))
(box :class "cpu-stats" :hexpand "false" :vexpand "false" :space-evenly "false"
(label :tooltip "${cpu}%" :class "cpu-icon" :text "󰘚")
(scale :min 0 :max 101 :active false :value {cpu == "" ? 0 : cpu} :class "cpu-scale" :width 150))
@@ -65,7 +84,7 @@
(label :class "fortune-header" :halign "start" :text "Fortune")
(label :class "fortune-text" :halign "start" :text fortune :show-truncated true :wrap true)))
(box :class "third-row" :orientation "h" :space-evenly "false"
(box :class "music-art-box" :space-evenly "false" :orientation "v" :hexpand "false" :vexpand "false" :style "background-image: url(\"${music-art}\");"
(box :class "music-art-box" :space-evenly "false" :orientation "v" :hexpand "false" :vexpand "false" :style "background-image: url(\"${music-art-blur}\");"
(box :class "music-stuff-box" :space-evenly "false" :hexpand "false" :vexpand "false" :orientation "v"
(box :class "player-box" :hexpand "false" :vexpand "false" :space-evenly "true"
(box :class "player-info-box" :hexpand "false" :vexpand "false" :space-evenly "false" :orientation "v" :spacing 15
@@ -73,12 +92,10 @@
(label :class "player-info-artist" :text "󰠃 Artist: ${artist}" :halign "start" :limit-width 30 :tooltip "${artist}")
(label :class "player-info-album" :text "󰀥 Album: ${album}" :halign "start" :limit-width 30 :tooltip "${album}")
(label :class "player-info-length" :text "󰦚 Length: ${length-info}" :halign "start" :tooltip "${length-info}"))
(box :class "player-cover-box" :hexpand "false" :halign "end" :vexpand "false" :space-evenly "false" :style "background-image: url('${art}');"))
(box :class "cava-box" :hexpand "false" :vexpand "false"
(label :vexpand "false" :hexpand "false" :space-evenly "false"
:class "cavabar"
:text cava
))))
(box :class "player-cover-box" :hexpand "false" :halign "end" :vexpand "false" :space-evenly "false" :style "background-image: url(\"${music-art}\");"))
(label :vexpand "true" :hexpand "false" :space-evenly "false" :valign "end"
:class "cavabar"
:text cava)))
(box :class "music-controls-box" :space-evenly "true" :hexpand "true" :vexpand "false" :orientation "v"
(button :class "music-previous" :halign "center" :onclick "playerctl previous" "󰒮")
(button :class "music-pp" :halign "center" :onclick "playerctl play-pause" "${music-pp}")

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 919 KiB

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:svgjs="http://svgjs.com/svgjs" xmlns:xlink="http://www.w3.org/1999/xlink" id="SvgjsSvg1016" width="288" height="288" version="1.1"><g id="SvgjsG1018"><svg xmlns="http://www.w3.org/2000/svg" width="288" height="288" viewBox="0 0 512 512"><path fill="none" d="M416,512H96A96,96,0,0,1,0,416V96A96,96,0,0,1,96,0H416a96,96,0,0,1,96,96V416A96,96,0,0,1,416,512Zm0,0" data-name="Path 144"/><path fill="#7aa2f7" d="M234.672,384a40.052,40.052,0,0,0,39.184-32H195.473A40.069,40.069,0,0,0,234.672,384Zm0,0" class="colorffe777 svgShape" data-name="Path 145"/><path fill="#7aa2f7" d="M312,266.672H264a8.024,8.024,0,0,1-7.09-4.289,7.944,7.944,0,0,1,.516-8.254l39.293-56.785H264a8,8,0,1,1,0-16h48a8.024,8.024,0,0,1,7.09,4.289,7.944,7.944,0,0,1-.516,8.254l-39.293,56.785H312a8,8,0,0,1,0,16Zm0,0" class="colorffe777 svgShape" data-name="Path 146"/><g fill="#e0af68" class="color000 svgShape" data-name="Group 14"><path fill="#e0af68" d="M376,192H349.328a7.989,7.989,0,0,1-6.512-12.641l17.633-24.687H349.328a8,8,0,0,1,0-16H376a7.989,7.989,0,0,1,6.512,12.641L364.879,176H376a8,8,0,0,1,0,16Zm0,0" class="colorffd200 svgShape" data-name="Path 147"/><path fill="#e0af68" d="M334.7,308.4a71.3,71.3,0,0,1-19.344-26.078,23.138,23.138,0,0,1-3.359.336H264a23.993,23.993,0,0,1-19.711-37.664l21.918-31.664H264a24,24,0,0,1,0-48h16.656a74.56,74.56,0,0,0-35.312-15.152v-11.52a10.672,10.672,0,0,0-21.344.016v11.52A74.708,74.708,0,0,0,160,224v29.742A71.54,71.54,0,0,1,134.527,308.5a18.667,18.667,0,0,0,12.145,32.848h176A18.668,18.668,0,0,0,334.7,308.4Zm0,0" class="colorffd200 svgShape" data-name="Path 148"/></g></svg></g></svg>

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -23,7 +23,7 @@ mkfifo $pipe
config_file="/tmp/waybar_cava_config"
echo "
[general]
bars = 33
bars = 31
[output]
method = raw
raw_target = $pipe

View File

@@ -1,8 +1,11 @@
#!/bin/bash
tmp_dir="$HOME/.config/eww/Main/images"
tmp_cover_path=$tmp_dir/cover.png
tmp_temp_path=$tmp_dir/temp.png
tmp_blur_path="$tmp_dir/temp-blur.png"
cache_path="$tmp_dir/temp.txt"
default_path="$tmp_dir/default-music.svg"
default_blur_path="$tmp_dir/default-music-blur.png"
if [ ! -d $tmp_dir ]; then
mkdir -p $tmp_dir
@@ -10,13 +13,34 @@ fi
artlink="$(playerctl -p spotify,$any,mpd,firefox,chromium,brave metadata mpris:artUrl | sed -e 's/open.spotify.com/i.scdn.co/g')"
artFromBrowser=$(playerctl metadata mpris:artUrl | sed 's/file:\/\///g')
cached=$(cat $cache_path 2>/dev/null)
if [ $(playerctl -p spotify,%any,firefox,chromium,brave,mpd metadata mpris:artUrl) ]; then
curl -s "$artlink" --output $tmp_temp_path
echo $tmp_temp_path
# avoid unnecessary downloads
if [[ $cached != $artlink ]]; then
echo $artlink > $cache_path
curl -s "$artlink" --output $tmp_temp_path
outputUrl=$tmp_temp_path
magick $tmp_temp_path -blur 0x8 $tmp_blur_path
else
outputUrl=$cached
fi
elif [[ -n $artFromBrowser ]]; then
cp $artFromBrowser $tmp_temp_path
echo $tmp_temp_path
if [[ §cached != $artFromBrowser ]]; then
echo $artFromBrowser > $cache_path
cp $artFromBrowser $tmp_temp_path
magick $tmp_temp_path -blur 0x8 $tmp_blur_path
outputUrl=$tmp_temp_path
else
outputUrl=$cached
fi
else
echo Main/images/default-music.svg
outputUrl=$default_path
tmp_blur_path=$default_blur_path
fi
if [[ $1 == "--blur" ]]; then
echo $tmp_blur_path
else
echo $outputUrl
fi

View File

@@ -51,7 +51,11 @@ get_vol() {
## Get Brightness
get_brightness() {
brightnessctl i --machine-readable -d intel_backlight | tr ',' ' ' | awk '{print $4}' | tr -d '%'
if [ -z "$DISPLAY_DEVICE" ]; then
brightnessctl i --machine-readable | tr ',' ' ' | awk '{print $4}' | tr -d '%'
else
brightnessctl i -d $DISPLAY_DEVICE --machine-readable | tr ',' ' ' | awk '{print $4}' | tr -d '%'
fi
}
## Execute accordingly