Skip to content

Instantly share code, notes, and snippets.

@SmartFinn
Created August 15, 2018 11:57
Show Gist options
  • Save SmartFinn/99c98be4915e26d7c6b544d42b500f76 to your computer and use it in GitHub Desktop.
Save SmartFinn/99c98be4915e26d7c6b544d42b500f76 to your computer and use it in GitHub Desktop.
creates desktop-files for each Qemu binaries to allow changing icons
#!/usr/bin/env bash
IFS=: read -ra BIN_DIRS <<< "${PATH:-/usr/local/bin:/usr/bin:/bin}"
APPS_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/applications"
for bin_dir in "${BIN_DIRS[@]}"; do
for bin_path in "$bin_dir"/qemu-system-*; do
[ -x "$bin_path" ] || continue
bin_name="$(basename "$bin_path")"
cat > "${APPS_HOME}/${bin_name}.desktop" <<-EOF
[Desktop Entry]
Version=1.0
Terminal=false
Type=Application
Name=${bin_name}
Exec=${bin_name}
Icon=qemu
StartupWMClass=${bin_name}
NoDisplay=true
EOF
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment