Created
January 3, 2017 13:11
-
-
Save vladshub/daa5ac5418ad235837f63d93976b2af0 to your computer and use it in GitHub Desktop.
Sublime Text 3 gnome desktop install icon script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # Resolve the location of the SublimeText 3 installation. | |
| # This includes resolving any symlinks. | |
| PRG=$0 | |
| while [ -h "$PRG" ]; do | |
| ls=`ls -ld "$PRG"` | |
| link=`expr "$ls" : '^.*-> \(.*\)$' 2>/dev/null` | |
| if expr "$link" : '^/' 2> /dev/null >/dev/null; then | |
| PRG="$link" | |
| else | |
| PRG="`dirname "$PRG"`/$link" | |
| fi | |
| done | |
| SUBLIMETEXT=`dirname "$PRG"` | |
| # absolutize dir | |
| oldpwd=`pwd` | |
| cd "${SUBLIMETEXT}" | |
| SUBLIMETEXT=`pwd` | |
| cd "${oldpwd}" | |
| ICON_NAME=vlad-sublimetext | |
| TMP_DIR=`mktemp --directory` | |
| DESKTOP_FILE=$TMP_DIR/vlad-sublimetext.desktop | |
| cat << EOF > $DESKTOP_FILE | |
| [Desktop Entry] | |
| Version=1.0 | |
| Encoding=UTF-8 | |
| Name=Sublime Text 3 | |
| Keywords=file editor;edit; | |
| GenericName=Generic File Editor | |
| Type=Application | |
| Categories=Development;Editors | |
| Terminal=false | |
| StartupNotify=true | |
| StartupWMClass=SublimeText3 | |
| Exec="$SUBLIMETEXT/sublime_text" %u | |
| MimeType=application/ecmascript;application/javascript;application/mbms-associated-procedure-description+xml;application/mbms-protection-description+xml;application/mbms-user-service-description+xml;application/postscript;application/vnd.cab-jscript;application/vnd.coffeescript;application/vnd.cups-postscript;application/vnd.kodak-descriptor;application/vnd.oasis.opendocument.text;application/vnd.oasis.opendocument.text-master;application/vnd.oasis.opendocument.text-template;application/vnd.oasis.opendocument.text-web;application/vnd.oma.poc.invocation-descriptor+xml;application/vnd.vividence.scriptfile;application/vnd.wap.wmlscriptc;application/vnd.yamaha.hv-script;image/vnd.valve.source.texture;model/vnd.parasolid.transmit.text;text/1d-interleaved-parityfec;text/cache-manifest;text/calendar;text/css;text/csv;text/csv-schema;text/directory;text/dns;text/encaprtp;text/enriched;text/example;text/fwdred;text/grammar-ref-list;text/html;text/jcr-cnd;text/markdown;text/mizar;text/n3;text/parameters;text/parityfec;text/plain;text/provenance-notation;text/prs.fallenstein.rst;text/prs.lines.tag;text/prs.prop.logic;text/raptorfec;text/RED;text/rfc822-headers;text/richtext;text/rtf;text/rtp-enc-aescm128;text/rtploopback;text/rtx;text/sgml;text/t140;text/tab-separated-values;text/troff;text/turtle;text/ulpfec;text/uri-list;text/vcard;text/vnd.a;text/vnd.abc;text/vnd.ascii-art;text/vnd.curl;text/vnd.debian.copyright;text/vnd.DMClientScript;text/vnd.dvb.subtitle;text/vnd.esmertec.theme-descriptor;text/vnd.fly;text/vnd.fmi.flexstor;text/vnd.graphviz;text/vnd.in3d.3dml;text/vnd.in3d.spot;text/vnd.IPTC.NewsML;text/vnd.IPTC.NITF;text/vnd.latex-z;text/vnd.motorola.reflex;text/vnd.ms-mediapackage;text/vnd.net2phone.commcenter.command;text/vnd.radisys.msml-basic-layout;text/vnd.si.uricatalogue;text/vnd.sun.j2me.app-descriptor;text/vnd.trolltech.linguist;text/vnd.wap.si;text/vnd.wap.sl;text/vnd.wap.wml;text/vnd.wap.wmlscript;text/xml;text/xml-external-parsed-entity;text/html-sandboxed;text/x-pod;text/x-setext; | |
| Icon=$ICON_NAME.png | |
| EOF | |
| # seems necessary to refresh immediately: | |
| chmod 644 $DESKTOP_FILE | |
| xdg-desktop-menu install $DESKTOP_FILE | |
| xdg-icon-resource install --size 16 "$SUBLIMETEXT/Icon/16x16/sublime-text.png" $ICON_NAME | |
| xdg-icon-resource install --size 32 "$SUBLIMETEXT/Icon/32x32/sublime-text.png" $ICON_NAME | |
| xdg-icon-resource install --size 48 "$SUBLIMETEXT/Icon/48x48/sublime-text.png" $ICON_NAME | |
| xdg-icon-resource install --size 128 "$SUBLIMETEXT/Icon/128x128/sublime-text.png" $ICON_NAME | |
| xdg-icon-resource install --size 256 "$SUBLIMETEXT/Icon/256x256/sublime-text.png" $ICON_NAME | |
| rm $DESKTOP_FILE | |
| rm -R $TMP_DIR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment