You are not logged in.

#1 2021-11-18 17:34:06

nnnyt2
Member
Registered: 2021-10-06
Posts: 2

[Solved] How to select a random wallpaper from different dir based...

I'm currently running the "awesomedm" desktop manager through xorg. I'm working on making scripts to change my wallpaper, and want to select a random wallpaper from a folder for each monitor.

Currently, I use nitrogen to set wallpapers, and while it works there doesn't seem to be a way to change wallpapers outside of the GUI, while I want to make scripts to change the theme of my setup through the command line without clicking through a GUI each time.
I've also tinkered a bit with feh and it seems to be a better option, as it works through the command line and has a built in randomization feature that selects a random wallpaper for each monitor from a directory.

My main problem stems from the fact that one of my monitors is vertical, and obviously I don't want to use a horizontal wallpaper for this monitor, I want some way to randomly select a wallpaper for my 2 horizontal monitors from a directory of horizontal wallpapers, and then randomly select a wallpaper for my vertical monitor from a directory of vertical wallpapers, and unfortunately feh doesn't seem to have this option, as its --randomize feature seems to set all wallpapers at once

How can I make a script that will randomly select a wallpaper from a directory of horizontal wallpapers and set my horizontal monitor to it, and then randomly select a wallpaper from a directory of vertical wallpapers and set my vertical monitor to it?

edit note: had to shorten title and cut off "based on monitor?" to fit [solved] in title

Last edited by nnnyt2 (2021-11-18 19:40:54)

Offline

#2 2021-11-18 18:14:54

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [Solved] How to select a random wallpaper from different dir based...

man feh (emphasis added) wrote:

Note that all options except --bg-tile support Xinerama.  For instance, if you have multiple monitors connected and use e.g. --bg-center, feh will center or appropriately offset the image on each monitor.  You may even specify more than one file, in that case, the first file is set on monitor 0, the second on monitor 1, and so on.  Use xrandr --listmonitor to determine how Xinerama monitor IDs map to screens / monitors in your setup.

feh --bg-scale $(shuf -en1 /path/to/portrait/*)" "$(shuf -en1 /path/to/landscape/*)"

Last edited by Trilby (2021-11-18 18:20:33)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2021-11-18 19:39:56

nnnyt2
Member
Registered: 2021-10-06
Posts: 2

Re: [Solved] How to select a random wallpaper from different dir based...

That worked great, thank you!

Offline

#4 2024-06-23 04:02:26

madhur
Member
From: India
Registered: 2022-12-03
Posts: 2
Website

Re: [Solved] How to select a random wallpaper from different dir based...

This does not work for me. The order is completely random.

Offline

#5 2024-06-23 14:54:21

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [Solved] How to select a random wallpaper from different dir based...

madhur wrote:

The order is completely random.

Yeah, that's the point.  If you want something different, you'll need a different command.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB