Skip to content

Instantly share code, notes, and snippets.

@idling-mind
Created December 10, 2020 10:48
Show Gist options
  • Save idling-mind/772e1442abaf978daea0c556d1598690 to your computer and use it in GitHub Desktop.
Save idling-mind/772e1442abaf978daea0c556d1598690 to your computer and use it in GitHub Desktop.
A Simple GNOME launcher in 20 lines of code
#!/bin/bash
# Config file stores all the commands as csv data
configfile=$HOME/.config/zenlauncher/applist.csv
configdir=$(dirname $configfile)
# Create the config file if it's not existing and add the first command
if [ ! -f $configfile ] ;
then
mkdir -p $configdir
echo "Add to Zen, Add a new entry to zen launcher, addtozen" >> $configfile
fi
# addtozen to append a line to config file
function addtozen {
mkdir -p $configdir
zenity --forms --add-entry="Name" --add-entry="Description" --add-entry="Command" --separator="," >> $configfile
}
app=$(cat $configfile | sed 's/,/\n/g' | sed 's/^ *\(.*\) *$/\1/g' | zenity --list --title="ZenLauncher" --column="Name" --column="Description" --column="Command" --print-column=3 --width=800 --height=300)
eval $app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment