Skip to content

Instantly share code, notes, and snippets.

@641i130
Created January 3, 2023 05:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 641i130/f764ee2f2907adb4fac4de90a365e942 to your computer and use it in GitHub Desktop.
Save 641i130/f764ee2f2907adb4fac4de90a365e942 to your computer and use it in GitHub Desktop.
Set random wallpaper with given folders
feh --bg-fill "$(find /landscape/images/path/ -regextype posix-extended -regex '.*\.(png|jpg|jpeg)$' -print0 |shuf -z -n 1)" "$(find /portrait/images/path/ -regextype posix-extended -regex '.*\.(png|jpg|jpeg)$' -print0 |shuf -z -n 1)"
@641i130
Copy link
Author

641i130 commented Jan 4, 2023

Here is a one-liner that should do what you're asking:

find /path/to/directory -type f -exec convert {} -resize 1920x1080! {} ;

This will find all files in the directory specified by /path/to/directory, and for each file it will run the convert command to resize the image to 1920x1080 pixels, using the ! flag to overwrite the original image file.

Note that this command assumes that you have the convert command installed on your system. This command is part of the imagemagick package, which you can install using the following command:

sudo pacman -S imagemagick

I hope this helps! Let me know if you have any questions or if you need further assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment