diff --git a/hypr/autostart.conf b/hypr/autostart.conf index 4990ca8..07f796f 100644 --- a/hypr/autostart.conf +++ b/hypr/autostart.conf @@ -13,6 +13,7 @@ exec-once = swww-daemon exec-once = swaync exec-once = sh -c "/home/stereov/.local/share/JetBrains/Toolbox/bin/jetbrains-toolbox %u & sleep 6 && hyprctl dispatch closewindow class:jetbrains-toolbox" exec-once = "/home/stereov/Developer/antistereov/randrwall/randrwall.py reload" +exec-once = ~/.config/hypr/scripts/cover-listener.sh exec-once = gsettings set org.gnome.desktop.interface gtk-theme 'adw-gtk3-dark' exec-once = gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark' diff --git a/hypr/hyprlock.conf b/hypr/hyprlock.conf index 49aa280..286621f 100644 --- a/hypr/hyprlock.conf +++ b/hypr/hyprlock.conf @@ -51,7 +51,7 @@ label { # BATTERY label { monitor = - text = cmd[update:1000] echo "$(~/.config/waybar/scripts/battery.sh)" + text = cmd[update:1000] echo "$(~/.config/hypr/scripts/battery.sh)" font_family = lexend font_size = 14 position = -100, 100 @@ -59,9 +59,10 @@ label { valign = bottom } +# WEATHER label { monitor = - text = cmd[update:600000] echo "$(~/.config/waybar/scripts/weather.sh | jq -r .text)" + text = cmd[update:600000] echo "$(~/.config/hypr/scripts/weather.sh | jq -r .text)" font_family = lexend font_size = 14 position = -200, 100 @@ -69,6 +70,41 @@ label { valign = bottom } +# NOW PLAYING +image { + monitor = + path = ~/.cache/nowplaying-cover.jpg + size = 250 + rounding = 20 + position = 0, -120 + halign = center + valign = center + border_size = 0 + reload_time = 1 +} + +label { + monitor = + text = cmd[update:1000] playerctl metadata artist + color = rgba(242, 243, 244, 0.8) + font_size = 14 + font_family = Lexend Bold + position = 0, -300 + halign = center + valign = center +} + +label { + monitor = + text = cmd[update:1000] playerctl metadata title + color = rgba(242, 243, 244, 0.8) + font_size = 14 + font_family = Lexend + position = 0, -270 + halign = center + valign = center +} + input-field { monitor = size = 300, 50 @@ -88,7 +124,7 @@ input-field { check_color = $check_color fail_text = $FAIL ($ATTEMPTS) - rounding = 60 + rounding = 15 shadow_passes = 0 fade_on_empty = false } diff --git a/waybar/scripts/battery.sh b/hypr/scripts/battery.sh similarity index 100% rename from waybar/scripts/battery.sh rename to hypr/scripts/battery.sh diff --git a/hypr/scripts/cover-listener.sh b/hypr/scripts/cover-listener.sh new file mode 100755 index 0000000..be48edf --- /dev/null +++ b/hypr/scripts/cover-listener.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +playerctl metadata --follow --format "{{mpris:artUrl}}" | while read -r _; do + ~/.config/hypr/scripts/cover.sh +done diff --git a/hypr/scripts/cover.sh b/hypr/scripts/cover.sh new file mode 100755 index 0000000..4368aee --- /dev/null +++ b/hypr/scripts/cover.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +CACHE="$HOME/.cache/nowplaying-cover.jpg" + +url=$(playerctl metadata mpris:artUrl 2>/dev/null) + +# Kein Player aktiv +[ -z "$url" ] && exit 0 + +# file:// prefix entfernen (Spotify lokal) +if [[ "$url" == file://* ]]; then + cp "${url#file://}" "$CACHE" +else + curl -sL "$url" -o "$CACHE" +fi diff --git a/hypr/scripts/nowplaying.sh b/hypr/scripts/nowplaying.sh new file mode 100755 index 0000000..bee9e78 --- /dev/null +++ b/hypr/scripts/nowplaying.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +status=$(playerctl status 2>/dev/null) + +if [ "$status" = "Playing" ]; then + artist=$(playerctl metadata artist) + title=$(playerctl metadata title) + echo "$artist - $title" +else + echo "" +fi diff --git a/waybar/scripts/weather.sh b/hypr/scripts/weather.sh similarity index 100% rename from waybar/scripts/weather.sh rename to hypr/scripts/weather.sh diff --git a/waybar/config.jsonc b/waybar/config.jsonc index e63d100..c342b85 100644 --- a/waybar/config.jsonc +++ b/waybar/config.jsonc @@ -8,7 +8,6 @@ "passthrough": false, "fixed-center": true, "modules-left": ["hyprland/workspaces", "hyprland/window"], - "modules-center": ["mpris"], "modules-right": [ "cpu", "memory", @@ -21,27 +20,12 @@ "battery", "tray", "custom/notification", - "custom/power" + "custom/power", ], - "custom/spotify": { - "format": " {}", - "return-type": "json", - "on-click": "playerctl -p spotify play-pause", - "on-click-right": "spotifatius toggle-liked", - "on-click-middle": "playerctl -p spotify next", - "exec": "spotifatius monitor", - }, "mpris": { - "player": "spotify", - "dynamic-order": ["artist", "title"], - "format": "{player_icon} {dynamic}", - "format-paused": "{status_icon} {dynamic}", - "status-icons": { - "paused": "", - }, - "player-icons": { - "default": "", - }, + "format": "{cover_art} {artist} - {title}", + "icon-size": 20, + "max-length": 40 }, "hyprland/workspaces": { "on-click": "activate", @@ -138,6 +122,12 @@ "on-click": "wlogout -p layer-shell &", "format": "⏻", }, + "custom/nowplaying": { + "exec": "~/.config/waybar/scripts/nowplaying.sh", + "interval": 2, + "return-type": "json", + "on-click": "playerctl play-pause" + }, "custom/notification": { "escape": true, "exec": "swaync-client -swb", @@ -157,7 +147,7 @@ "custom/weather": { "format": "{}", "interval": 600, - "exec": "~/.config/waybar/scripts/weather.sh", // or your dotfiles folder if you use stow + "exec": "~/.config/hypr/scripts/weather.sh", // or your dotfiles folder if you use stow "return-type": "json", "on-click": "gnome-weather" }, diff --git a/waybar/scripts/nowplaying.sh b/waybar/scripts/nowplaying.sh new file mode 100755 index 0000000..5b78c0b --- /dev/null +++ b/waybar/scripts/nowplaying.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +CACHE="$HOME/.cache/waybar-cover.jpg" +TMP="$HOME/.cache/waybar-cover.tmp.jpg" + +status=$(playerctl status 2>/dev/null) + +if [ "$status" = "Playing" ]; then + artist=$(playerctl metadata artist) + title=$(playerctl metadata title) + url=$(playerctl metadata mpris:artUrl) + + if [[ "$url" == file://* ]]; then + cp "${url#file://}" "$TMP" + else + curl -sL "$url" -o "$TMP" + fi + + mv -f "$TMP" "$CACHE" + + echo "{\"text\": \"$artist - $title\", \"tooltip\": \"$artist - $title\", \"class\": \"playing\", \"alt\": \"$CACHE\"}" +else + echo "{\"text\": \"󰐎 \", \"class\": \"stopped\"}" +fi diff --git a/waybar/style.css b/waybar/style.css index 5e3288b..a46b9be 100644 --- a/waybar/style.css +++ b/waybar/style.css @@ -74,6 +74,7 @@ window#waybar { #clock, #pulseaudio, +#custom-nowplaying, #custom-logo, #custom-power, #custom-spotify, @@ -95,6 +96,14 @@ window#waybar { margin-right: 3px; } +#custom-nowplaying { + padding-left: 40px; + background-size: 30px 30px; + background-repeat: no-repeat; + background-position: left center; + background-image: url('/home/stereov/.cache/nowplaying-cover.jpg') +} + #mpris.playing { color: #a6e3a1; }