get app icons for each workspace
This commit is contained in:
32
eww/scripts/get-workspace-icons.sh
Normal file
32
eww/scripts/get-workspace-icons.sh
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user