Adds resize command to fish functions

This commit is contained in:
Dennis Schoepf 2025-02-16 13:08:21 +01:00
parent 83240184be
commit 2a2246795a
4 changed files with 23 additions and 18 deletions

View file

@ -21,4 +21,11 @@
];
programs.home-manager.enable = true;
# User Packages
home.packages = with pkgs; [
aider-chat
fortune
neofetch
];
}

View file

@ -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 = ''

View file

@ -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

View file

@ -32,8 +32,6 @@
fd
sd
bat
fortune
neofetch
neovim
just
tldr
@ -66,6 +64,7 @@
"typst"
"rsync"
"fnm"
"imagemagick"
];
casks = [