[ prog / sol / mona ]

prog


What are you working on?

194 2023-06-20 12:33

Minimal desktop shortcuts on Ubuntu:

$ cat makelink.sh 
#!/bin/sh
set -e

dofind ()
{
   find /usr/share/applications -iname '*'"$1"'*.desktop'
}

domake_print ()
{
   echo "[Desktop Entry]"
   echo "Version=1.0"
   echo "Type=Link"
   grep -e '^Name=' "$1" | head -n 1
   grep -e '^Icon=' "$1"
   echo "URL=file://$1"
}

domake ()
{
   local appf fname
    appf="$1"
   fname="${appf##*/}"

   domake_print "$appf" > ~/"$fname"
   mv ~/"$fname" ~/Desktop/
}

usage ()
{
   echo "Usage: find <what>"
   echo "       make <appfile>"
}

case "$1" in
   (find) dofind "$2" ;;
   (make) domake "$2" ;;
   (*)    usage       ;;
esac

$ sh makelink.sh 
Usage: find <what>
       make <appfile>
$ sh makelink.sh find monitor
/usr/share/applications/gnome-system-monitor.desktop
/usr/share/applications/gnome-system-monitor-kde.desktop
$ sh makelink.sh make /usr/share/applications/gnome-system-monitor.desktop
199


VIP:

do not edit these