ctucx.git: nixfiles

ctucx' nixfiles

commit e0e0ea65d8d8a462a7bde46c781d22d5f8ad16ff
parent 0d1be02e20ca248e1b732fe6baa7b8f6bd4ebef9
Author: Leah (ctucx) <leah@ctu.cx>
Date: Tue, 14 Jun 2022 13:25:40 +0200

darwin/homebrew: change app-icons of firefox and thunderbird
1 file changed, 37 insertions(+), 2 deletions(-)
M
configurations/darwin/homebrew.nix
|
39
+++++++++++++++++++++++++++++++++++++--
diff --git a/configurations/darwin/homebrew.nix b/configurations/darwin/homebrew.nix
@@ -37,14 +37,49 @@
     HOMEBREW_JAVAVM="/opt/homebrew/opt/openjdk/libexec/openjdk.jdk"
     MACOS_JAVAVM="/Library/Java/JavaVirtualMachines/openjdk.jdk"
     if [ -d "$HOMEBREW_JAVAVM" ]; then
-      if [ ! -e "MACOS_JAVAVM" ] ; then
+      if [ ! -e "MACOS_JAVAVM" ]; then
         ln -sfn $HOMEBREW_JAVAVM $MACOS_JAVAVM;
       fi
     else
-      if [ ! -e "$MACOS_JAVAVM" ] ; then
+      if [ ! -e "$MACOS_JAVAVM" ]; then
         rm $MACOS_JAVAVM;
       fi
     fi
+
+    #
+    # Update app-icons
+    #
+
+
+    ICONS_CHANGED=0;
+
+    #Firefox
+    if [ -e '/Applications/Firefox.app' ]; then
+      ICON_SHA256="$(shasum -a 256 /Applications/Firefox.app/Contents/Resources/firefox.icns | awk '{ print $1 }')";
+
+      if [ "$ICON_SHA256" != 'd1753c860526f2806ce53ac0a47a84d727d80fcaf30b9e4dc42d9bfafdde83be' ]; then
+        curl -o /Applications/Firefox.app/Contents/Resources/firefox.icns 'https://media.macosicons.com/parse/files/macOSicons/3e2e434eb31e1d096e4fe6d87857ad0b_Firefox.icns';
+        touch '/Applications/Firefox.app';
+        ICONS_CHANGED=1;
+      fi
+    fi
+
+    #Thunderbird
+    if [ -e '/Applications/Thunderbird.app' ]; then
+      ICON_SHA256="$(shasum -a 256 /Applications/Thunderbird.app/Contents/Resources/thunderbird.icns | awk '{ print $1 }')";
+
+      if [ "$ICON_SHA256" != 'de65b6d8b7d043eac03248b92e09ef946ddf6b60adf0479f60fe2b42a23d1e82' ]; then
+        curl -o /Applications/Thunderbird.app/Contents/Resources/thunderbird.icns 'https://media.macosicons.com/parse/files/macOSicons/d05f6c9df12594a119f87ba6b30d663f_Thunderbird.icns';
+        touch '/Applications/Thunderbird.app';
+        ICONS_CHANGED=1;
+      fi
+    fi
+
+    # When an icon was changed, delete the icon-cache and restart Dock.app
+    if [ $ICONS_CHANGED -ne 0 ]; then
+      rm /var/folders/*/*/*/com.apple.dock.iconcache;
+      killall Dock;
+    fi
   '';
 
 }