Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jomarinb/fd21ea7c55f8c0691aaf0de52945bf04 to your computer and use it in GitHub Desktop.
Save jomarinb/fd21ea7c55f8c0691aaf0de52945bf04 to your computer and use it in GitHub Desktop.
This script is setting the right icon for all installed chrome apps in KDE's app panel (Icons-only Task Manager). By default it's only showing the chrome icon which is very confusing.
#!/bin/bash
set -e
DIR="$HOME/.local/share/applications"
PATTERN="chrome-*.desktop"
if ! command -v xdotool > /dev/null; then
echo "installing xdotool..."
yes | sudo pacman -S xdotool
fi
for file in $(ls $DIR/$PATTERN)
do
echo "$file:"
ID=$(grep -m 1 Exec $file | sed -E 's/^(.*)--app-id=(\w*).*$/\2/g')
CMD=" \&\& xdotool search --sync --classname $ID set_window --class $ID"
if grep -q "$CMD" $file; then
echo " skip file"
continue
fi
echo " changing file"
sed -E -i 's!^(Exec=)(.*)$!\1\2'"${CMD}"'!g' $file
done
echo "updating desktop database"
update-desktop-database $DIR
echo "done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment