From b90574f68416bbe57914346c26f6975fdee7aa73 Mon Sep 17 00:00:00 2001 From: gor_down Date: Mon, 9 Jun 2025 04:34:35 -0300 Subject: [PATCH] cosas --- .config/mimeapps.list | 72 --------- .../xfce-perchannel-xml/xfce4-panel.xml | 145 ------------------ .local/bin/allminus | 15 ++ .local/bin/optimizechar | 100 +++++++++--- 4 files changed, 97 insertions(+), 235 deletions(-) delete mode 100644 .config/mimeapps.list delete mode 100644 .config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml create mode 100755 .local/bin/allminus diff --git a/.config/mimeapps.list b/.config/mimeapps.list deleted file mode 100644 index 8870db9..0000000 --- a/.config/mimeapps.list +++ /dev/null @@ -1,72 +0,0 @@ -[Default Applications] -x-scheme-handler/http=userapp-Pale Moon-IPLD22.desktop -x-scheme-handler/https=userapp-Pale Moon-IPLD22.desktop -inode/directory=xfce4-file-manager.desktop -x-scheme-handler/trash=xfce4-file-manager.desktop -application/x-tar=xarchiver.desktop -application/octet-stream=vim.desktop -x-scheme-handler/discord-399779271737868288=discord-399779271737868288.desktop -x-scheme-handler/mailto=xfce4-mail-reader.desktop -x-scheme-handler/ftp=userapp-Pale Moon-IPLD22.desktop -x-scheme-handler/chrome=userapp-Pale Moon-IPLD22.desktop -text/html=userapp-Pale Moon-IPLD22.desktop -application/x-extension-htm=userapp-Pale Moon-IPLD22.desktop -application/x-extension-html=userapp-Pale Moon-IPLD22.desktop -application/x-extension-shtml=userapp-Pale Moon-IPLD22.desktop -application/xhtml+xml=userapp-Pale Moon-IPLD22.desktop -application/x-extension-xhtml=userapp-Pale Moon-IPLD22.desktop -application/x-extension-xht=userapp-Pale Moon-IPLD22.desktop -inode/symlink=thunar.desktop -image/jpeg=feh.desktop -image/png=feh.desktop - -[Added Associations] -x-scheme-handler/http=xfce4-web-browser.desktop;userapp-Pale Moon-IPLD22.desktop; -x-scheme-handler/https=xfce4-web-browser.desktop;userapp-Pale Moon-IPLD22.desktop; -application/x-shellscript=kitty-open.desktop;vim.desktop; -application/x-zerosize=org.xfce.mousepad.desktop;vim.desktop;codium.desktop; -inode/directory=xfce4-file-manager.desktop; -x-scheme-handler/trash=xfce4-file-manager.desktop; -application/x-tar=xarchiver.desktop;thunar.desktop; -application/x-theme=nvim.desktop; -application/x-raw-disk-image-xz-compressed=xarchiver.desktop; -audio/x-mpegurl=nvim.desktop; -application/vnd.ms-wpl=nvim.desktop; -video/x-matroska=mpv.desktop;gnac.desktop;org.xfce.Parole.desktop; -audio/midi=audacious.desktop; -text/plain=org.xfce.mousepad.desktop;vim.desktop;codium.desktop;nvim.desktop; -audio/vnd.wave=audacious.desktop; -application/octet-stream=userapp-codium-RWYGX2.desktop; -image/bmp=aseprite.desktop;feh.desktop; -image/jpeg=gimp.desktop;feh.desktop;userapp-catboxupload-A9Q122.desktop; -video/mp4=mpv.desktop; -image/webp=feh.desktop;gimp.desktop; -image/x-gimp-pat=vim.desktop; -application/octet-stream=codium.desktop;feh.desktop;vim.desktop; -video/vnd.avi=mpv.desktop; -image/png=gimp.desktop;feh.desktop;aseprite.desktop; -video/x-ms-wmv=mpv.desktop; -image/gif=feh.desktop;chromium.desktop; -video/quicktime=mpv.desktop; -x-scheme-handler/mailto=xfce4-mail-reader.desktop; -text/html=codium.desktop;vim.desktop;nvim.desktop;chromium.desktop;userapp-Pale Moon-IPLD22.desktop; -audio/AMR-WB=audacious.desktop; -application/x-bat=nvim.desktop; -text/csv=gvim.desktop; -audio/flac=mpv.desktop; -audio/mpeg=mpv.desktop; -text/javascript=codium.desktop;nvim.desktop; -text/css=vim.desktop;gvim.desktop; -text/x-python=codium.desktop; -application/vnd.efi.img=gnome-disk-image-mounter.desktop; -x-scheme-handler/ftp=userapp-Pale Moon-IPLD22.desktop; -x-scheme-handler/chrome=userapp-Pale Moon-IPLD22.desktop; -application/x-extension-htm=userapp-Pale Moon-IPLD22.desktop; -application/x-extension-html=userapp-Pale Moon-IPLD22.desktop; -application/x-extension-shtml=userapp-Pale Moon-IPLD22.desktop; -application/xhtml+xml=userapp-Pale Moon-IPLD22.desktop; -application/x-extension-xhtml=userapp-Pale Moon-IPLD22.desktop; -application/x-extension-xht=userapp-Pale Moon-IPLD22.desktop; -video/mpeg=mpv.desktop; -inode/symlink=vim.desktop;thunar.desktop; -text/x-log=vim.desktop; diff --git a/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml b/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml deleted file mode 100644 index 9fcf0ae..0000000 --- a/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.local/bin/allminus b/.local/bin/allminus new file mode 100755 index 0000000..03668f1 --- /dev/null +++ b/.local/bin/allminus @@ -0,0 +1,15 @@ +#!/bin/bash + +# Loop through all files and directories in the current directory +for item in *; do + # Check if the item is a file or directory + if [ -e "$item" ]; then + # Convert the name to lowercase + lowercase_item=$(echo "$item" | tr '[:upper:]' '[:lower:]') + + # Rename the item if the lowercase name is different + if [ "$item" != "$lowercase_item" ]; then + mv "$item" "$lowercase_item" + fi + fi +done diff --git a/.local/bin/optimizechar b/.local/bin/optimizechar index 8514b7c..4df5396 100755 --- a/.local/bin/optimizechar +++ b/.local/bin/optimizechar @@ -16,6 +16,55 @@ downscale_image() { fi } +downscale_webp() { + local img="$1" + local width height + dimensions=$(identify -format "%wx%h" "$img") + width=$(echo $dimensions | cut -d'x' -f1) + height=$(echo $dimensions | cut -d'x' -f2) + if [ "$width" -gt 960 ] || [ "$height" -gt 544 ]; then + gifname="${img}.gif" + magick "$img" "$gifname" + gifsicle --resize _x544 --colors 256 "$gifname" > "${gifname}s" + rm "$img" + rm "$gifname" + magick "${gifname}s" "$img" + rm "${gifname}s" + fi +} + +# downscale_apng() { +# local img="$1" +# local width height +# dimensions=$(identify -format "%wx%h" "$img") +# width=$(echo $dimensions | cut -d'x' -f1) +# height=$(echo $dimensions | cut -d'x' -f2) +# if [ "$width" -gt 960 ] || [ "$height" -gt 544 ]; then +# gifname="${img}.gif" +# magick "$img" "$gifname" +# gifsicle --resize _x544 --colors 256 "$gifname" > "${gifname}s" +# rm "$img" +# rm "$gifname" +# magick "${gifname}s" "$img" +# rm "${gifname}s" +# fi +# } + +convert_audio_files() { + local audio_file="$1" + local dir=$(dirname "$audio_file") + local base=$(basename "$audio_file") + local filename="${base%.*}" + local opus_file="$dir/$filename.opus" + + # Convert to opus format + ffmpeg -i "$audio_file" -c:a libopus -b:a 128k "$opus_file" && \ + if [[ "${base,,}" == *.wav ]]; then + rm "$audio_file" + echo "Deleted original WAV file: $audio_file" + fi +} + # Function to resize char_icon to 60x60 if it's bigger resize_char_icon() { local img="$1" @@ -69,22 +118,10 @@ delete_files_with_on() { # Delete all Thumbs.db files recursively delete_thumbs_db() { find . -type f -iname "Thumbs.db" -exec rm -f {} \; + echo "Deleted all Thumbs.db files" } -# Recursively find all image files except those in "emotions" directory -find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.webp" -o -iname "*.apng" -o -iname "*.gif" -o -iname "*.bmp" \) | while read -r img; do - # Skip files in "emotions" folder - if [[ "$img" == *"/emotions/"* ]]; then - # Resize image in "emotions" folder if necessary - resize_emotions_images "$img" - continue - fi - - # Downscale image if necessary - downscale_image "$img" -done - # Resize the char_icon image to 60x60 if it's larger than that char_icon="char_icon" for ext in webp apng jpg jpeg png gif bmp; do @@ -94,16 +131,43 @@ for ext in webp apng jpg jpeg png gif bmp; do fi done -# Optimize all images -find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.webp" -o -iname "*.apng" -o -iname "*.gif" -o -iname "*.bmp" \) | while read -r img; do - optimize_images "$img" -done - # Delete files containing "_on" in the filename find . -type f | while read -r img; do delete_files_with_on "$img" done +# Optimize all images +find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.webp" -o -iname "*.gif" -o -iname "*.bmp" \) | while read -r img; do + # Skip files in "emotions" folder + if [[ "$img" == *"/emotions/"* ]]; then + # Resize image in "emotions" folder if necessary + resize_emotions_images "$img" + continue + fi + if [[ "$img" == *".webp" ]]; then + downscale_webp "$img" + # elif [[ "$img" == *".apng" ]]; then + # downscale_apng "$img" + elif [[ "$img" == *".gif" ]]; then + dimensions=$(identify -format "%wx%h" "$img") + width=$(echo $dimensions | cut -d'x' -f1) + height=$(echo $dimensions | cut -d'x' -f2) + if [ "$width" -gt 960 ] || [ "$height" -gt 544 ]; then + gifsicle --resize _x544 --colors 256 "$img" > "${img}s" + rm "$img" + mv "${img}s" "$img" + fi + else + # Downscale image if necessary + downscale_image "$img" + optimize_images "$img" + fi +done + +find . -type f \( -iname "*.wav" -o -iname "*.mp3" \) | while read -r audio; do + convert_audio_files "$audio" +done + # Delete all Thumbs.db files recursively delete_thumbs_db