Regenerated

This commit is contained in:
2026-04-14 15:22:43 +02:00
parent ba0721f4a0
commit a799e9ab67
4 changed files with 397 additions and 625 deletions
+367 -443
View File
File diff suppressed because it is too large Load Diff
+15 -91
View File
@@ -3323,97 +3323,8 @@ ShellRoot {
** =generated/.config/scripts/media.sh= ** =generated/.config/scripts/media.sh=
Providing an media Providing an media
#+BEGIN_SRC sh :tangle generated/.config/scripts/media.sh :shebang "#!/usr/bin/env bash" :noweb yes :mkdirp yes :eval never #+BEGIN_SRC sh :tangle generated/.config/scripts/media.sh :shebang "#!/usr/bin/env bash" :noweb yes :mkdirp yes :eval never
#!/usr/bin/env bash ./media.sh
{"text":"","tooltip":"","class":"inactive"}
# Player selection — prefer actively playing player
player=$(playerctl -l 2>/dev/null | while read -r p; do
st=$(playerctl --player="$p" status 2>/dev/null)
[ "$st" = "Playing" ] && echo "$p" && break
done)
[ -z "$player" ] && player=$(playerctl -l 2>/dev/null | head -n1)
if [ -z "$player" ]; then
jq -c -n '{text: "", tooltip: "", class: "inactive"}'
exit 0
fi
status=$(playerctl --player="$player" status 2>/dev/null)
if [ "$status" != "Playing" ] && [ "$status" != "Paused" ]; then
jq -c -n '{text: "", tooltip: "", class: "inactive"}'
exit 0
fi
artist=$(playerctl --player="$player" metadata artist 2>/dev/null)
title=$(playerctl --player="$player" metadata title 2>/dev/null)
album=$(playerctl --player="$player" metadata album 2>/dev/null)
art=$(playerctl --player="$player" metadata mpris:artUrl 2>/dev/null)
length=$(playerctl --player="$player" metadata mpris:length 2>/dev/null)
position=$(playerctl --player="$player" position 2>/dev/null)
# Progress percentage — pure bash, no bc needed
if [ -n "$length" ] && [ -n "$position" ] && [ "$length" -gt 0 ] 2>/dev/null; then
pos_us=$(echo "$position" | awk '{printf "%d", $1 * 1000000}')
progress=$(( pos_us * 100 / length ))
else
progress=0
fi
# Spotify device
device=""
if [[ "$player" == *"spotify"* ]]; then
device=$(playerctl --player="$player" metadata xesam:url 2>/dev/null | grep -o 'device=[^&]*' | cut -d= -f2)
fi
# Icon
if [ "$status" = "Paused" ]; then
icon="⏸ "
else
icon="▶ "
fi
# Scrolling ticker
CACHE_FILE="/tmp/waybar_media_scroll_${player//\//_}"
full_text="${artist} — ${title}"
text_len=${#full_text}
display_len=30
# Reset scroll offset when track changes
TRACK_FILE="/tmp/waybar_media_track_${player//\//_}"
last_track=""
[ -f "$TRACK_FILE" ] && last_track=$(cat "$TRACK_FILE")
if [ "$full_text" != "$last_track" ]; then
echo "0" > "$CACHE_FILE"
echo "$full_text" > "$TRACK_FILE"
fi
if [ "$text_len" -le "$display_len" ]; then
text="$full_text"
else
offset=0
[ -f "$CACHE_FILE" ] && offset=$(cat "$CACHE_FILE")
padded="${full_text} ${full_text}"
text="${padded:$offset:$display_len}"
next_offset=$(( (offset + 1) % (text_len + 4) ))
echo "$next_offset" > "$CACHE_FILE"
fi
# Build tooltip
tooltip="Artist: ${artist}
Title: ${title}
Album: ${album}"
if [ -n "$device" ]; then
tooltip="${tooltip}
󰓻 ${device}"
fi
tooltip="${tooltip}"
jq -c -n \
--arg text "${icon}${text}" \
--arg tooltip "$tooltip" \
--arg class "$player" \
--arg art "$art" \
'{text: $text, tooltip: $tooltip, class: $class, alt: $art}'
#+END_SRC #+END_SRC
** =generated/.config/scripts/layout-selector.sh= ** =generated/.config/scripts/layout-selector.sh=
@@ -4398,6 +4309,19 @@ label#custom-windows:not(.active) {
label#custom-media:not(.active) { label#custom-media:not(.active) {
background: transparent; background: transparent;
color: transparent; color: transparent;
opacity: 0;
padding: 0;
margin: 0;
min-width: 0;
}
label#custom-media.inactive {
background: transparent;
color: transparent;
opacity: 0;
padding: 0;
margin: 0;
min-width: 0;
} }
label#custom-media.module { label#custom-media.module {
+2 -91
View File
@@ -1,93 +1,4 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# --- This file has been auto-generated. For permanent changes alter the appropriate block in the README.org. --- # --- This file has been auto-generated. For permanent changes alter the appropriate block in the README.org. ---
#!/usr/bin/env bash ./media.sh
{"text":"","tooltip":"","class":"inactive"}
# Player selection — prefer actively playing player
player=$(playerctl -l 2>/dev/null | while read -r p; do
st=$(playerctl --player="$p" status 2>/dev/null)
[ "$st" = "Playing" ] && echo "$p" && break
done)
[ -z "$player" ] && player=$(playerctl -l 2>/dev/null | head -n1)
if [ -z "$player" ]; then
jq -c -n '{text: "", tooltip: "", class: "inactive"}'
exit 0
fi
status=$(playerctl --player="$player" status 2>/dev/null)
if [ "$status" != "Playing" ] && [ "$status" != "Paused" ]; then
jq -c -n '{text: "", tooltip: "", class: "inactive"}'
exit 0
fi
artist=$(playerctl --player="$player" metadata artist 2>/dev/null)
title=$(playerctl --player="$player" metadata title 2>/dev/null)
album=$(playerctl --player="$player" metadata album 2>/dev/null)
art=$(playerctl --player="$player" metadata mpris:artUrl 2>/dev/null)
length=$(playerctl --player="$player" metadata mpris:length 2>/dev/null)
position=$(playerctl --player="$player" position 2>/dev/null)
# Progress percentage — pure bash, no bc needed
if [ -n "$length" ] && [ -n "$position" ] && [ "$length" -gt 0 ] 2>/dev/null; then
pos_us=$(echo "$position" | awk '{printf "%d", $1 * 1000000}')
progress=$(( pos_us * 100 / length ))
else
progress=0
fi
# Spotify device
device=""
if [[ "$player" == *"spotify"* ]]; then
device=$(playerctl --player="$player" metadata xesam:url 2>/dev/null | grep -o 'device=[^&]*' | cut -d= -f2)
fi
# Icon
if [ "$status" = "Paused" ]; then
icon="⏸ "
else
icon="▶ "
fi
# Scrolling ticker
CACHE_FILE="/tmp/waybar_media_scroll_${player//\//_}"
full_text="${artist}${title}"
text_len=${#full_text}
display_len=30
# Reset scroll offset when track changes
TRACK_FILE="/tmp/waybar_media_track_${player//\//_}"
last_track=""
[ -f "$TRACK_FILE" ] && last_track=$(cat "$TRACK_FILE")
if [ "$full_text" != "$last_track" ]; then
echo "0" > "$CACHE_FILE"
echo "$full_text" > "$TRACK_FILE"
fi
if [ "$text_len" -le "$display_len" ]; then
text="$full_text"
else
offset=0
[ -f "$CACHE_FILE" ] && offset=$(cat "$CACHE_FILE")
padded="${full_text} ${full_text}"
text="${padded:$offset:$display_len}"
next_offset=$(( (offset + 1) % (text_len + 4) ))
echo "$next_offset" > "$CACHE_FILE"
fi
# Build tooltip
tooltip="Artist: ${artist}
Title: ${title}
Album: ${album}"
if [ -n "$device" ]; then
tooltip="${tooltip}
󰓻 ${device}"
fi
tooltip="${tooltip}"
jq -c -n \
--arg text "${icon}${text}" \
--arg tooltip "$tooltip" \
--arg class "$player" \
--arg art "$art" \
'{text: $text, tooltip: $tooltip, class: $class, alt: $art}'
@@ -125,6 +125,19 @@ label#custom-windows:not(.active) {
label#custom-media:not(.active) { label#custom-media:not(.active) {
background: transparent; background: transparent;
color: transparent; color: transparent;
opacity: 0;
padding: 0;
margin: 0;
min-width: 0;
}
label#custom-media.inactive {
background: transparent;
color: transparent;
opacity: 0;
padding: 0;
margin: 0;
min-width: 0;
} }
label#custom-media.module { label#custom-media.module {