From 2a2246795a065ec6c400cd3684de4a9f9de1e67e Mon Sep 17 00:00:00 2001 From: Dennis Date: Sun, 16 Feb 2025 13:08:21 +0100 Subject: [PATCH] Adds resize command to fish functions --- home/darwin.nix | 7 +++++++ home/modules/fish/default.nix | 15 +++++++++++++++ home/modules/fish/functions/resize_images.fish | 16 ---------------- hosts/dnsc-air/default.nix | 3 +-- 4 files changed, 23 insertions(+), 18 deletions(-) delete mode 100644 home/modules/fish/functions/resize_images.fish diff --git a/home/darwin.nix b/home/darwin.nix index 1ac14ab..1eb08fc 100644 --- a/home/darwin.nix +++ b/home/darwin.nix @@ -21,4 +21,11 @@ ]; programs.home-manager.enable = true; + + # User Packages + home.packages = with pkgs; [ + aider-chat + fortune + neofetch + ]; } diff --git a/home/modules/fish/default.nix b/home/modules/fish/default.nix index 34e8577..a8ebbaf 100644 --- a/home/modules/fish/default.nix +++ b/home/modules/fish/default.nix @@ -22,6 +22,21 @@ ''; fish_greeting = "fortune -a"; ng = "nvim -c \"Neogit\""; + resize_images = '' + if not command -q convert + echo "Error: ImageMagick is not installed. Please install it first." + return 1 + + for img in (find . -type f -name "*.JPG") + set original_size (stat -f %z "$img") + convert "$img" -resize 40% "$img" + set new_size (stat -f %z "$img") + echo "Processed $img" + echo "Original size: $original_size bytes" + echo "New size: $new_size bytes" + echo "---" + end + ''; }; interactiveShellInit = '' diff --git a/home/modules/fish/functions/resize_images.fish b/home/modules/fish/functions/resize_images.fish deleted file mode 100644 index 34f4655..0000000 --- a/home/modules/fish/functions/resize_images.fish +++ /dev/null @@ -1,16 +0,0 @@ -function resize_images --description "Resize all JPG images in current directory and subdirectories to 40% of original size" - if not command -q convert - echo "Error: ImageMagick is not installed. Please install it first." - return 1 - end - - for img in (find . -type f -name "*.JPG") - set original_size (stat -f %z "$img") - convert "$img" -resize 40% "$img" - set new_size (stat -f %z "$img") - echo "Processed $img" - echo "Original size: $original_size bytes" - echo "New size: $new_size bytes" - echo "---" - end -end diff --git a/hosts/dnsc-air/default.nix b/hosts/dnsc-air/default.nix index f22a10e..fc34435 100644 --- a/hosts/dnsc-air/default.nix +++ b/hosts/dnsc-air/default.nix @@ -32,8 +32,6 @@ fd sd bat - fortune - neofetch neovim just tldr @@ -66,6 +64,7 @@ "typst" "rsync" "fnm" + "imagemagick" ]; casks = [