eww: better lyrics

This commit is contained in:
2025-06-24 03:51:59 +02:00
parent 8f6795bc29
commit 54ae84cfaf
12 changed files with 100 additions and 27 deletions

24
.scripts/lyrics-widgets.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/sh
LYRICS=$(eww active-windows | grep "lyrics:")
LYRICS_SINGLE=$(eww active-windows | grep "lyrics-single:")
# both are closed
if [ -z "$LYRICS" ] && [ -z "$LYRICS_SINGLE" ]; then
eww open lyrics
# only lyrics is open
elif [ -n "$LYRICS" ] && [ -z "$LYRICS_SINGLE" ]; then
eww close lyrics
sleep 0.5
eww open lyrics-single
# only lyrics-single is open
elif [ -z "$LYRICS" ] && [ -n "$LYRICS_SINGLE" ]; then
eww close lyrics-single
# both are open
elif [ -n "$LYRICS" ] && [ -n "$LYRICS_SINGLE" ]; then
eww close lyrics
eww close lyrics-single
fi

1
eww/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*.log

View File

@@ -14,17 +14,32 @@
min-width: 500px; min-width: 500px;
} }
.lyrics-box-single {
margin: 10px;
min-width: 300px;
}
.lyrics-text { .lyrics-text {
color: $fg; color: $fg;
font-size: 16px; font-size: 15px;
font-family: 'Maple Mono Normal NF CN', 'Maple Mono CN', monospace; font-family: 'Maple Mono Normal NF CN', 'Maple Mono CN', monospace;
} }
.lyrics-text-single {
color: $fg;
font-size: 14px;
font-family: 'Noto Sans', sans-serif;
}
.control-box { .control-box {
margin: 10px; padding: 6px;
min-height: 90px; min-height: 90px;
} }
.control-box-single {
min-height: 40px;
}
.offset-minus, .offset-minus,
.offset-reset, .offset-reset,
.offset-plus, .offset-plus,
@@ -32,15 +47,26 @@
padding: 0px 6px; padding: 0px 6px;
margin: 0px 4px 0px 4px; margin: 0px 4px 0px 4px;
font-family: 'MesloLGM Nerd Font Mono'; font-family: 'MesloLGM Nerd Font Mono';
font-size: 25px;
min-width: 16px;
}
.offset-minus-single,
.offset-plus-single {
padding: 0px 6px;
margin: 0;
font-family: 'MesloLGM Nerd Font Mono';
font-size: 20px; font-size: 20px;
min-width: 16px; min-width: 16px;
} }
.offset-minus { .offset-minus,
.offset-minus-single {
color: $blue; color: $blue;
} }
.offset-plus { .offset-plus,
.offset-plus-single {
color: $yellow; color: $yellow;
} }

View File

@@ -1,4 +1,5 @@
(defpoll lyriclines :interval "500ms" "Lyrics/scripts/lyric-lines.sh") (defpoll lyriclines :interval "500ms" "~/.local/bin/spotify-lyrics print -l 3 -f \"$HOME/.local/state/eww/lyrics/offset\" 2> temp.log")
(deflisten lyricline "~/.local/bin/spotify-lyrics listen -l 1 -f \"$HOME/.local/state/eww/lyrics/offset\" 2> temp.log")
(defwidget lyrics [] (defwidget lyrics []
(box :class "lyrics-window" :space-evenly "false" :orientation "h" (box :class "lyrics-window" :space-evenly "false" :orientation "h"
@@ -22,10 +23,36 @@
) )
) )
(defwidget lyrics-single []
(box :class "lyrics-window" :space-evenly "false" :orientation "h"
(box :class "lyrics-box-single" :vexpand "false" :hexpand "false" :valign "center" :space-evenly "false" :orientation "v"
(label :class "lyrics-text-single"
:vexpand "false" :hexpand "false" :space-evenly "false"
:halign "start"
:text lyricline
)
)
(box :class "control-box-single" :vexpand "false" :hexpand "false" :space-evenly "true" :orientation "v"
(box :class "control-row-1-single" :space-evenly "false" :orientation "h"
(button :class "offset-minus-single" :onclick "Lyrics/scripts/lyric-offset.py -500" "󰓅")
(button :class "offset-plus-single" :onclick "Lyrics/scripts/lyric-offset.py +500" "󰾆")
)
)
)
)
(defwindow lyrics (defwindow lyrics
:windowtype "normal" :windowtype "normal"
:wm-ignore false :wm-ignore true
:monitor 0 :monitor 0
:geometry (geometry :anchor "top center") :geometry (geometry :anchor "top center")
(lyrics) (lyrics)
)
(defwindow lyrics-single
:windowtype "normal"
:wm-ignore true
:monitor 0
:geometry (geometry :anchor "top right")
(lyrics-single)
) )

View File

@@ -2,5 +2,5 @@
killall spotify-lyrics killall spotify-lyrics
sleep 0.1 sleep 0.1
spotify-lyrics clear "$HOME/.local/bin/spotify-lyrics" clear
notify-send -a "spotify-lyrics" "Lyrics Cleared" "The lyrics have been cleared." notify-send -a "spotify-lyrics" "Lyrics Cleared" "The lyrics have been cleared."

View File

@@ -1,13 +0,0 @@
#!/bin/sh
STATE_DIR="$HOME/.local/state/eww/lyrics"
if [ ! -d $STATE_DIR ]; then
mkdir -p $STATE_DIR
fi
OFFSET_FILE="$STATE_DIR/offset"
if [ ! -f "$OFFSET_FILE" ]; then
echo "0" > "$OFFSET_FILE"
fi
spotify-lyrics print -l 3 -O $(cat "$OFFSET_FILE")

View File

@@ -7,7 +7,7 @@ STATE_FILE_NAME = "offset"
def notify_send(title, message): def notify_send(title, message):
import subprocess import subprocess
subprocess.run(["notify-send", "-a", APP_NAME, title, message], check=True) subprocess.run(["notify-send", "-t", "1000", "-a", APP_NAME, title, message], check=True)
def main(): def main():

View File

@@ -17,6 +17,7 @@
padding: 20px 10px 20px 10px; padding: 20px 10px 20px 10px;
border-radius: 15px; border-radius: 15px;
color: $fg; color: $fg;
box-shadow: 5px 5px 8px rgba(0, 0, 0, 0.5);
} }
.time { .time {
@@ -36,6 +37,7 @@
margin: 20px 20px 0px 0px; margin: 20px 20px 0px 0px;
padding: 20px 10px 10px 20px; padding: 20px 10px 10px 20px;
border-radius: 15px; border-radius: 15px;
box-shadow: 5px 5px 8px rgba(0, 0, 0, 0.5);
} }
.weather-desc { .weather-desc {
@@ -67,6 +69,7 @@
margin: 20px 20px 0px 20px; margin: 20px 20px 0px 20px;
padding: 20px 35px 20px 25px; padding: 20px 35px 20px 25px;
border-radius: 15px; border-radius: 15px;
box-shadow: 5px 5px 8px rgba(0, 0, 0, 0.5);
} }
.stats-header { .stats-header {
@@ -119,6 +122,7 @@
margin: 20px 20px 0px 0px; margin: 20px 20px 0px 0px;
padding: 20px 35px 20px 25px; padding: 20px 35px 20px 25px;
border-radius: 15px; border-radius: 15px;
box-shadow: 5px 5px 8px rgba(0, 0, 0, 0.5);
} }
.fortune-header { .fortune-header {
@@ -142,6 +146,7 @@
border-radius: 17px; border-radius: 17px;
background-position: center; background-position: center;
margin: 20px 0px 0px 20px; margin: 20px 0px 0px 20px;
box-shadow: 5px 5px 8px rgba(0, 0, 0, 0.5);
} }
.music-title { .music-title {
@@ -217,6 +222,7 @@
padding: 0px 23px 0px 23px; padding: 0px 23px 0px 23px;
border-radius: 15px; border-radius: 15px;
text-shadow: 0px 0px 10px rgba(0, 0, 0, 1); text-shadow: 0px 0px 10px rgba(0, 0, 0, 1);
box-shadow: 5px 5px 8px rgba(0, 0, 0, 0.5);
} }
.music-next, .music-next,
@@ -240,6 +246,7 @@
background-color: $gray-alt; background-color: $gray-alt;
border-radius: 15px; border-radius: 15px;
padding: 15px 20px 15px 20px; padding: 15px 20px 15px 20px;
box-shadow: 5px 5px 8px rgba(0, 0, 0, 0.5);
} }
.profile-img { .profile-img {
@@ -248,7 +255,7 @@
background-size: cover; background-size: cover;
background-position: center; background-position: center;
min-width: 90px; min-width: 90px;
box-shadow: 0px 0px 30px rgba(0, 0, 0, 1); box-shadow: 0px 0px 10px rgba(0, 0, 0, 1);
} }
.profile-stuff { .profile-stuff {

View File

@@ -11,7 +11,7 @@ $blue: #89b4fa;
$purple: #cba6f7; $purple: #cba6f7;
$cyan: #89dceb; $cyan: #89dceb;
$gray: #585b70; $gray: #585b70;
$gray-alt: #313244; $gray-alt: #292a3c;
$lavender: #b4befe; $lavender: #b4befe;
$sapphire: #74c7ec; $sapphire: #74c7ec;
$teal: #94e2d5; $teal: #94e2d5;

View File

@@ -19,7 +19,7 @@ bind = Super+Shift, Return, exec, ghostty # [hidden]
bind = Super, Super_L, exec, eww open main --toggle # Launch dashboard (eww) bind = Super, Super_L, exec, eww open main --toggle # Launch dashboard (eww)
bind = Alt, Space, exec, pkill fuzzel || fuzzel # [hidden] Launch fuzzel (app launcher) bind = Alt, Space, exec, pkill fuzzel || fuzzel # [hidden] Launch fuzzel (app launcher)
# bind = , mouse:276, exec, pkill fuzzel || fuzzel # [hidden] Launch fuzzel (app launcher) # bind = , mouse:276, exec, pkill fuzzel || fuzzel # [hidden] Launch fuzzel (app launcher)
bind = Super, Space, exec, pkill fuzzel || fuzzel -d -l 0 | xargs -r -I{} bash -c '{}' # Launch fuzzel (command launcher) bind = Super, R, exec, pkill fuzzel || fuzzel -d -l 0 | xargs -r -I{} bash -c '{}' # Launch fuzzel (command launcher)
##! Actions ##! Actions
# Screenshot, Record, OCR, Color picker, Clipboard history # Screenshot, Record, OCR, Color picker, Clipboard history
@@ -43,7 +43,7 @@ bind = Super+Shift, W, exec, fish ~/.scripts/change-wallpaper.fish # Change wall
##! Session ##! Session
# bind = Ctrl+Super, L, exec, ags run-js 'lock.lock()' # [hidden] # bind = Ctrl+Super, L, exec, ags run-js 'lock.lock()' # [hidden]
bind = Super, L, exec, loginctl lock-session # Lock bind = Super, L, exec, loginctl lock-session # Lock
bindl = Super+Shift, L, exec, sleep 0.1 && systemctl suspend || loginctl suspend # Suspend system bindl = Ctrl+Shift+Alt+Super, L, exec, sleep 0.1 && systemctl suspend || loginctl suspend # Suspend system
bind = Ctrl+Shift+Alt+Super, Delete, exec, systemctl poweroff || loginctl poweroff # [hidden] Power off bind = Ctrl+Shift+Alt+Super, Delete, exec, systemctl poweroff || loginctl poweroff # [hidden] Power off
#! #!
@@ -163,3 +163,4 @@ bind = Alt, Tab, cyclenext
bind = Super, Tab, hyprexpo:expo, toggle # can be: toggle, select, off/disable or on/enable bind = Super, Tab, hyprexpo:expo, toggle # can be: toggle, select, off/disable or on/enable
bind = Super+Ctrl, T, exec, ~/.scripts/workspace-new.sh # Create new workspace bind = Super+Ctrl, T, exec, ~/.scripts/workspace-new.sh # Create new workspace
bind = Super+Shift, K, exec, waybar-toggle.sh close || waybar-toggle.sh open # Toggle waybar visibility bind = Super+Shift, K, exec, waybar-toggle.sh close || waybar-toggle.sh open # Toggle waybar visibility
bind = Super+Shift, L, exec, ~/.scripts/lyrics-widgets.sh # Toggle waybar visibility

View File

@@ -1,2 +1,2 @@
preload = /home/kolkas/.config/backgrounds/arona_desks.jpg preload = /home/kolkas/config/backgrounds/arona_desks.jpg
wallpaper = , /home/kolkas/.config/backgrounds/arona_desks.jpg wallpaper = , /home/kolkas/.config/backgrounds/arona_desks.jpg

View File

@@ -282,7 +282,7 @@
"escape": true, "escape": true,
"exec": "$HOME/.config/waybar/modules/mediaplayer.py 2> /dev/null", "exec": "$HOME/.config/waybar/modules/mediaplayer.py 2> /dev/null",
"on-click": "playerctl play-pause", "on-click": "playerctl play-pause",
"on-click-right": "eww open lyrics --toggle", "on-click-right": "~/.scripts/lyrics-widgets.sh",
"on-scroll-up": "playerctl next", "on-scroll-up": "playerctl next",
"on-scroll-down": "playerctl previous" "on-scroll-down": "playerctl previous"
}, },