updated hyprlock

This commit is contained in:
2026-04-02 13:46:16 +02:00
parent eadaaa5d52
commit 74945d45e9
4 changed files with 140 additions and 47 deletions
+11
View File
@@ -0,0 +1,11 @@
#!/bin/bash
url=$(playerctl metadata mpris:artUrl 2>/dev/null)
if [[ "$url" == file://* ]]; then
cp "${url#file://}" /tmp/hyprlock_art.png
echo "/tmp/hyprlock_art.png"
elif [[ "$url" == http* ]]; then
curl -s "$url" -o /tmp/hyprlock_art.png
echo "/tmp/hyprlock_art.png"
else
echo "$HOME/.config/hypr/catppuccin-hyprland/assets/mocha.webp"
fi
+13
View File
@@ -0,0 +1,13 @@
#!/bin/bash
status=$(playerctl status 2>/dev/null)
if [ "$status" = "Playing" ] || [ "$status" = "Paused" ]; then
title=$(playerctl metadata title | sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g')
artist=$(playerctl metadata artist | sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g')
if [ ${#title} -gt 25 ]; then title="${title:0:22}..."; fi
if [ ${#artist} -gt 25 ]; then artist="${artist:0:22}..."; fi
echo "<span weight='bold' foreground='#cba6f7'>$title</span>"
echo "<span foreground='#bac2de' size='small'>$artist</span>"
else
echo "<span weight='bold' foreground='#cdd6f4'>No Media</span>"
echo "<span size='small' foreground='#a6adc8'>Idling</span>"
fi
+14
View File
@@ -0,0 +1,14 @@
#!/bin/bash
# 1. Network
net=$(nmcli -t -f active,ssid dev wifi | grep '^yes' | cut -d: -f2 || echo 'Offline')
if [ ${#net} -gt 15 ]; then net="${net:0:12}..."; fi
# 2. Battery
bat_cap=$(cat /sys/class/power_supply/BAT0/capacity)
bat_stat=$(cat /sys/class/power_supply/BAT0/status)
if [ "$bat_stat" = "Charging" ]; then icon="󰂄"; else icon="󰁹"; fi
# 3. Load
cpu=$(top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1}' | cut -d. -f1)
# Output 3 lines for the vertical stack
echo "󰖩 $net"
echo "$icon $bat_cap% ($bat_stat)"
echo "󰍛 Load: $cpu%"