Skip to content

Instantly share code, notes, and snippets.

@ldante86
Created November 22, 2016 07:15
Show Gist options
  • Save ldante86/eb2f969fa487b9de080c876efd0c85b9 to your computer and use it in GitHub Desktop.
Save ldante86/eb2f969fa487b9de080c876efd0c85b9 to your computer and use it in GitHub Desktop.
desktop launcher tool
#!/bin/bash -
printf "\n%s\n\n" "Create a .desktop launcher"
# because Unity doesn't have a launcher tool...
read -p "Name the launcher: " name
[ -z "$name" ] && exit 1
read -p "Code to execute: " execute
[ -z "$execute" ] && exit 1
read -p "Does it need a terminal (t/f): " terminal
case $terminal in
t) terminal=true ;;
f) terminal=false ;;
*) exit 1 ;;
esac
read -p "Icon?: " icon
file=~/Desktop/${name}.desktop
echo "[Desktop Entry]
Type=Application
Terminal=$terminal
Exec="$execute"
Name=$name
Icon=$icon" > "$file"
chmod +x "$file"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment