Files
dotfiles/eww/scripts/get-workspace-icons.sh
2026-04-23 05:43:05 +02:00

32 lines
973 B
Bash

#!/usr/bin/env bash
# get-workspace-icons.sh <workspace_id>
WORKSPACE=${1:-1}
# Get app classes on the workspace
CLASSES=$(hyprctl clients -j | jq -r \
"[.[] | select(.workspace.id == $WORKSPACE) | .class] | unique[]")
for class in $CLASSES; do
echo "=== $class ==="
# Find matching .desktop file (case-insensitive)
DESKTOP=$(find /usr/share/applications ~/.local/share/applications \
-name "*.desktop" 2>/dev/null | \
xargs grep -li "^Name.*=$class\|^Exec.*$class\|^\[Desktop Entry\]" 2>/dev/null | \
head -1)
if [[ -n "$DESKTOP" ]]; then
ICON_NAME=$(grep "^Icon=" "$DESKTOP" | cut -d= -f2)
echo " Icon name: $ICON_NAME"
# Find actual icon file
ICON_FILE=$(find /usr/share/icons ~/.local/share/icons /usr/share/pixmaps \
-name "${ICON_NAME}.*" \( -name "*.png" -o -name "*.svg" \) \
2>/dev/null | sort | tail -1)
echo " Icon file: ${ICON_FILE:-not found}"
else
echo " .desktop file not found"
fi
done