eww: fix: music-art

This commit is contained in:
2025-08-10 16:15:58 +02:00
parent f28222614e
commit f1d5c8aba6
5 changed files with 70 additions and 43 deletions

View File

@@ -1 +1,2 @@
temp*
temp*
cache.conf

View File

@@ -3,44 +3,66 @@
tmp_dir="$HOME/.config/eww/Main/images"
tmp_temp_path=$tmp_dir/temp.png
tmp_blur_path="$tmp_dir/temp-blur.png"
cache_path="$tmp_dir/temp.txt"
cache_path="$tmp_dir/cache.conf"
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
fi
mkdir -p "$tmp_dir"
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)
artlink="$(playerctl metadata mpris:artUrl)"
[ -f "$cache_path" ] && . "$cache_path"
if [ $(playerctl -p spotify,%any,firefox,chromium,brave,mpd metadata mpris:artUrl) ]; then
# 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
# if [[ "$artlink" =~ ^https?:// ]]; then
# # avoid unnecessary downloads
# if [[ "$cached" != "$artlink" ]]; then
# echo "$artlink" > "$cache_path"
# curl -s "$artlink" --output "$tmp_temp_path" || exit 1
# outputUrl="$tmp_temp_path"
# magick "$tmp_temp_path" -blur 0x8 "$tmp_blur_path"
# else
# outputUrl="$cached"
# fi
# elif [[ "$artlink" =~ ^file:// ]]; then
# if [[ §cached != "$artlink" ]]; then
# echo "$artlink" > "$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
# outputUrl="$default_path"
# tmp_blur_path="$default_blur_path"
# fi
# avoid unnecessary downloads
if [ -z "$artlink" ]; then
# No art URL, use default
outputUrl="$default_path"
tmp_blur_path="$default_blur_path"
echo "$outputUrl" > "$cache_path"
elif [[ "$cachedlink" != "$artlink" ]]; then
echo "cachedlink=$artlink" > "$cache_path"
if [[ "$artlink" == "file://"* ]]; then
# Handle local file URLs
local_file_path="${artlink#file://}"
if [[ -f "$local_file_path" ]]; then
magick "$local_file_path" "$tmp_temp_path" || exit 1
fi
elif [[ "$artlink" =~ ^https?:// ]]; then
# Handle HTTP/HTTPS URLs
curl -s "$artlink" --output "$tmp_temp_path"_orig || exit 1
magick "$tmp_temp_path"_orig "$tmp_temp_path" || exit 1
fi
elif [[ -n $artFromBrowser ]]; then
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
outputUrl=$default_path
tmp_blur_path=$default_blur_path
outputUrl="$tmp_temp_path"
magick "$tmp_temp_path" -blur 0x8 "$tmp_blur_path"
fi
if [[ $1 == "--blur" ]]; then
echo $tmp_blur_path
echo "$tmp_blur_path"
else
echo $outputUrl
echo "$tmp_temp_path"
fi

View File

@@ -9,7 +9,7 @@ env = INPUT_METHOD, fcitx
# ############ Themes #############
env = QT_QPA_PLATFORM, wayland
env = QT_QPA_PLATFORMTHEME, qt6ct
env = QT_QPA_PLATFORMTHEME, kde
env = QT_STYLE_OVERRIDE, kvantum
# env = WLR_NO_HARDWARE_CURSORS, 1

View File

@@ -37,6 +37,7 @@ gestures {
workspace_swipe = true
workspace_swipe_distance = 700
workspace_swipe_fingers = 4
workspace_swipe_min_fingers = true
workspace_swipe_cancel_ratio = 0.2
workspace_swipe_min_speed_to_force = 5
workspace_swipe_direction_lock = true
@@ -57,17 +58,20 @@ general {
#focus_to_other_workspaces = true # ahhhh i still haven't properly implemented this
allow_tearing = true # This just allows the `immediate` window rule to work
snap {
enabled = true
}
}
dwindle {
preserve_split = true
# no_gaps_when_only = 1
smart_split = false
smart_resizing = false
}
decoration {
rounding = 20
rounding = 14
blur {
enabled = true
@@ -81,6 +85,8 @@ decoration {
contrast = 1
popups = true
popups_ignorealpha = 0.6
input_methods = true
input_methods_ignorealpha = 0.8
}
# Shadow
@@ -93,10 +99,6 @@ decoration {
color = rgba(0000002A)
}
# Shader
# screen_shader = ~/.config/hypr/shaders/nothing.frag
# screen_shader = ~/.config/hypr/shaders/vibrance.frag
# Dim
dim_inactive = false
dim_strength = 0.1
@@ -143,7 +145,9 @@ animations {
}
misc {
vfr = 1
vfr = true
mouse_move_enables_dpms = true
key_press_enables_dpms = true
animate_manual_resizes = false
animate_mouse_windowdragging = false
enable_swallow = false
@@ -155,20 +159,20 @@ misc {
allow_session_lock_restore = true
initial_workspace_tracking = false
# focus_on_activate = true
middle_click_paste = false
}
# Overview
plugin {
hyprexpo {
columns = 3
gap_size = 5
bg_col = rgb(000000)
bg_col = rgb(181825)
workspace_method = first 1 # [center/first] [workspace] e.g. first 1 or center m+1
enable_gesture = true # laptop touchpad, 4 fingers
gesture_distance = 300 # how far is the "max"
gesture_distance = 200 # how far is the "max"
gesture_positive = false
}
}

View File

@@ -4,7 +4,7 @@
#!
##! Apps
bind = Super, C, exec, code --password-store=gnome-libsecret # Launch VSCode (editor)
bind = Super, E, exec, nautilus --new-window # Launch file manager
bind = Super, E, exec, dolphin --new-window # Launch file manager
bind = Super, W, exec, zen --new-window # Launch Browser
bind = Super, X, exec, gnome-text-editor # Launch Text Editor
bind = Super, B, exec, killall btop || ghostty -e btop # Launch btop (system monitor)