ctucx.git: nixfiles

ctucx' nixfiles

commit 80b10eff0a8ef9e619e1cf4555c95d8c6fcb23da
parent c1a26c5769452ce3c7168b8168ded08ce0d0f0e2
Author: Leah (ctucx) <leah@ctu.cx>
Date: Thu, 18 Aug 2022 20:46:57 +0200

darwin/appIcons: use same logic for all apps
1 file changed, 13 insertions(+), 32 deletions(-)
M
configurations/darwin/appIcons.nix
|
45
+++++++++++++--------------------------------
diff --git a/configurations/darwin/appIcons.nix b/configurations/darwin/appIcons.nix
@@ -32,7 +32,10 @@ let
   '';
 
   TelegramAppIcon       = pkgs.fetchurl { url = "https://media.macosicons.com/parse/files/macOSicons/8f18e7156bb932429ec99016d765f95a_Telegram.icns";       sha256 = "sha256-lPsU5ih/ubg1NJHsrOr1SqgQQ4WN2BKacd5fp26gZa4"; }; 
-  coconutBatteryAppIcon = pkgs.fetchurl { url = "https://media.macosicons.com/parse/files/macOSicons/740fe98d7cb4e087ef45459d60a2b745_coconutBattery.icns"; sha256 = "sha256-Yxg0LBf+7Rdx1Fvwib3I3UnoVC0bwjb7r9r8Cj3I4Pc"; }; 
+  coconutBatteryAppIcon = pkgs.fetchurl { url = "https://media.macosicons.com/parse/files/macOSicons/740fe98d7cb4e087ef45459d60a2b745_coconutBattery.icns"; sha256 = "sha256-Yxg0LBf+7Rdx1Fvwib3I3UnoVC0bwjb7r9r8Cj3I4Pc"; };
+  LibreOfficeAppIcon    = pkgs.fetchurl { url = "https://media.macosicons.com/parse/files/macOSicons/ce3097d5c5ce2322c7a868ed29f61cd8_Libre_Office.icns";   sha256 = "sha256-g78sDw366lkiJKfS6pgeTjxrpX2mSROkNTXmLaBZw1c"; };
+  FirefoxAppIcon        = pkgs.fetchurl { url = "https://media.macosicons.com/parse/files/macOSicons/3e2e434eb31e1d096e4fe6d87857ad0b_Firefox.icns";        sha256 = "sha256-0XU8hgUm8oBs5TrApHqE1yfYD8rzC55NxC2b+v3eg74"; };
+  ThunderbirdAppIcon    = pkgs.fetchurl { url = "https://media.macosicons.com/parse/files/macOSicons/d05f6c9df12594a119f87ba6b30d663f_Thunderbird.icns";    sha256 = "sha256-3mW22LfQQ+rAMki5LgnvlG3fa2Ct8EefYP4rQqI9HoI"; };
 
 in {
 

@@ -40,7 +43,6 @@ in {
     #
     # Update app-icons
     #
-    ICONS_CHANGED=0;
 
     # Telegram
     if [ ! -e $'/Applications/Telegram.app/Icon\r' ]; then

@@ -55,42 +57,21 @@ in {
     fi
 
     # LibreOffice
-    if [ -e '/Aplications/LibreOffice.app' ]; then
-      ICON_SHA256="$(shasum -a 256 /Applications/LibreOffice.app/Contents/Resources/main.icns | awk '{ print $1 }')";
-
-      if [ "$ICON_SHA256" != '83bf2c0f0dfaea592224a7d2ea981e4e3c6ba57da64913a43535e62da059c357' ]; then
-        curl -o /Applications/LibreOffice.app/Contents/Resources/main.icns 'https://media.macosicons.com/parse/files/macOSicons/ce3097d5c5ce2322c7a868ed29f61cd8_Libre_Office.icns';
-        touch '/Applications/LibreOffice.app';
-        ICONS_CHANGED=1;
-      fi
+    if [ ! -e $'/Applications/LibreOffice.app/Icon\r' ]; then
+      echo -n "Update LibreOffice.app Icon: "
+      ${setIcon} ${LibreOfficeAppIcon} /Applications/LibreOffice.app;
     fi
 
     # 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
+    if [ ! -e $'/Applications/Firefox.app/Icon\r' ]; then
+      echo -n "Update Firefox.app Icon: "
+      ${setIcon} ${FirefoxAppIcon} /Applications/Firefox.app;
     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;
+    if [ ! -e $'/Applications/Thunderbird.app/Icon\r' ]; then
+      echo -n "Update Thunderbird.app Icon: "
+      ${setIcon} ${ThunderbirdAppIcon} /Applications/Thunderbird.app;
     fi
   '';