From 54ae84cfaf19a287ba5e64ef97fe08b850810537 Mon Sep 17 00:00:00 2001 From: Uyanide Date: Tue, 24 Jun 2025 03:51:59 +0200 Subject: [PATCH] eww: better lyrics --- .scripts/lyrics-widgets.sh | 24 +++++++++++++++++++++ eww/.gitignore | 1 + eww/Lyrics/eww.scss | 34 ++++++++++++++++++++++++++---- eww/Lyrics/eww.yuck | 31 +++++++++++++++++++++++++-- eww/Lyrics/scripts/lyric-clear.sh | 2 +- eww/Lyrics/scripts/lyric-lines.sh | 13 ------------ eww/Lyrics/scripts/lyric-offset.py | 2 +- eww/Main/eww.scss | 9 +++++++- eww/eww.scss | 2 +- hypr/hyprland/keybinds.conf | 5 +++-- hypr/hyprpaper.conf | 2 +- waybar/config.jsonc | 2 +- 12 files changed, 100 insertions(+), 27 deletions(-) create mode 100755 .scripts/lyrics-widgets.sh create mode 100644 eww/.gitignore delete mode 100755 eww/Lyrics/scripts/lyric-lines.sh diff --git a/.scripts/lyrics-widgets.sh b/.scripts/lyrics-widgets.sh new file mode 100755 index 0000000..061ee05 --- /dev/null +++ b/.scripts/lyrics-widgets.sh @@ -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 \ No newline at end of file diff --git a/eww/.gitignore b/eww/.gitignore new file mode 100644 index 0000000..bf0824e --- /dev/null +++ b/eww/.gitignore @@ -0,0 +1 @@ +*.log \ No newline at end of file diff --git a/eww/Lyrics/eww.scss b/eww/Lyrics/eww.scss index 31f489c..36c592a 100644 --- a/eww/Lyrics/eww.scss +++ b/eww/Lyrics/eww.scss @@ -14,17 +14,32 @@ min-width: 500px; } +.lyrics-box-single { + margin: 10px; + min-width: 300px; +} + .lyrics-text { color: $fg; - font-size: 16px; + font-size: 15px; 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 { - margin: 10px; + padding: 6px; min-height: 90px; } +.control-box-single { + min-height: 40px; +} + .offset-minus, .offset-reset, .offset-plus, @@ -32,15 +47,26 @@ padding: 0px 6px; margin: 0px 4px 0px 4px; 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; min-width: 16px; } -.offset-minus { +.offset-minus, +.offset-minus-single { color: $blue; } -.offset-plus { +.offset-plus, +.offset-plus-single { color: $yellow; } diff --git a/eww/Lyrics/eww.yuck b/eww/Lyrics/eww.yuck index f7c1b8b..9b67bdd 100644 --- a/eww/Lyrics/eww.yuck +++ b/eww/Lyrics/eww.yuck @@ -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 [] (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 :windowtype "normal" - :wm-ignore false + :wm-ignore true :monitor 0 :geometry (geometry :anchor "top center") (lyrics) +) + +(defwindow lyrics-single + :windowtype "normal" + :wm-ignore true + :monitor 0 + :geometry (geometry :anchor "top right") + (lyrics-single) ) \ No newline at end of file diff --git a/eww/Lyrics/scripts/lyric-clear.sh b/eww/Lyrics/scripts/lyric-clear.sh index f1494ba..c91782c 100755 --- a/eww/Lyrics/scripts/lyric-clear.sh +++ b/eww/Lyrics/scripts/lyric-clear.sh @@ -2,5 +2,5 @@ killall spotify-lyrics sleep 0.1 -spotify-lyrics clear +"$HOME/.local/bin/spotify-lyrics" clear notify-send -a "spotify-lyrics" "Lyrics Cleared" "The lyrics have been cleared." \ No newline at end of file diff --git a/eww/Lyrics/scripts/lyric-lines.sh b/eww/Lyrics/scripts/lyric-lines.sh deleted file mode 100755 index 147fa88..0000000 --- a/eww/Lyrics/scripts/lyric-lines.sh +++ /dev/null @@ -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") \ No newline at end of file diff --git a/eww/Lyrics/scripts/lyric-offset.py b/eww/Lyrics/scripts/lyric-offset.py index b546174..de4dad6 100755 --- a/eww/Lyrics/scripts/lyric-offset.py +++ b/eww/Lyrics/scripts/lyric-offset.py @@ -7,7 +7,7 @@ STATE_FILE_NAME = "offset" def notify_send(title, message): 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(): diff --git a/eww/Main/eww.scss b/eww/Main/eww.scss index e99c60c..a8641e0 100644 --- a/eww/Main/eww.scss +++ b/eww/Main/eww.scss @@ -17,6 +17,7 @@ padding: 20px 10px 20px 10px; border-radius: 15px; color: $fg; + box-shadow: 5px 5px 8px rgba(0, 0, 0, 0.5); } .time { @@ -36,6 +37,7 @@ margin: 20px 20px 0px 0px; padding: 20px 10px 10px 20px; border-radius: 15px; + box-shadow: 5px 5px 8px rgba(0, 0, 0, 0.5); } .weather-desc { @@ -67,6 +69,7 @@ margin: 20px 20px 0px 20px; padding: 20px 35px 20px 25px; border-radius: 15px; + box-shadow: 5px 5px 8px rgba(0, 0, 0, 0.5); } .stats-header { @@ -119,6 +122,7 @@ margin: 20px 20px 0px 0px; padding: 20px 35px 20px 25px; border-radius: 15px; + box-shadow: 5px 5px 8px rgba(0, 0, 0, 0.5); } .fortune-header { @@ -142,6 +146,7 @@ border-radius: 17px; background-position: center; margin: 20px 0px 0px 20px; + box-shadow: 5px 5px 8px rgba(0, 0, 0, 0.5); } .music-title { @@ -217,6 +222,7 @@ padding: 0px 23px 0px 23px; border-radius: 15px; text-shadow: 0px 0px 10px rgba(0, 0, 0, 1); + box-shadow: 5px 5px 8px rgba(0, 0, 0, 0.5); } .music-next, @@ -240,6 +246,7 @@ background-color: $gray-alt; border-radius: 15px; padding: 15px 20px 15px 20px; + box-shadow: 5px 5px 8px rgba(0, 0, 0, 0.5); } .profile-img { @@ -248,7 +255,7 @@ background-size: cover; background-position: center; 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 { diff --git a/eww/eww.scss b/eww/eww.scss index ea2c208..c071e6e 100644 --- a/eww/eww.scss +++ b/eww/eww.scss @@ -11,7 +11,7 @@ $blue: #89b4fa; $purple: #cba6f7; $cyan: #89dceb; $gray: #585b70; -$gray-alt: #313244; +$gray-alt: #292a3c; $lavender: #b4befe; $sapphire: #74c7ec; $teal: #94e2d5; diff --git a/hypr/hyprland/keybinds.conf b/hypr/hyprland/keybinds.conf index 91c4f1a..5ee04ef 100755 --- a/hypr/hyprland/keybinds.conf +++ b/hypr/hyprland/keybinds.conf @@ -19,7 +19,7 @@ bind = Super+Shift, Return, exec, ghostty # [hidden] 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 = , 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 # Screenshot, Record, OCR, Color picker, Clipboard history @@ -43,7 +43,7 @@ bind = Super+Shift, W, exec, fish ~/.scripts/change-wallpaper.fish # Change wall ##! Session # bind = Ctrl+Super, L, exec, ags run-js 'lock.lock()' # [hidden] 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 #! @@ -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+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, L, exec, ~/.scripts/lyrics-widgets.sh # Toggle waybar visibility diff --git a/hypr/hyprpaper.conf b/hypr/hyprpaper.conf index 5d6cb19..3baeaa9 100644 --- a/hypr/hyprpaper.conf +++ b/hypr/hyprpaper.conf @@ -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 diff --git a/waybar/config.jsonc b/waybar/config.jsonc index a2c0cbd..ffbf82e 100644 --- a/waybar/config.jsonc +++ b/waybar/config.jsonc @@ -282,7 +282,7 @@ "escape": true, "exec": "$HOME/.config/waybar/modules/mediaplayer.py 2> /dev/null", "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-down": "playerctl previous" },