I ran this as a test to check if feh blocks util the background changes then exits/returns, turns out it doesn't (because only pic2 gets displayed as background, pic1 flashes for milliseconds sometimes before).

feh --bg-scale pic1.jpg && feh --bg-scale pic2.jpeg

is there an (x11?) event for background changed that can be triggered in bash? that can be a solution.

my goal is to show each pic exactly n seconds (using the sleep command) not more or less, which is currently dependent on how much time it takes for the pic to get scaled, set AND displayed as background.

my shell script:

while true
    for f in ~/Pictures/wallpapers/show/*; do
        feh --bg-scale $f
        sleep 3
  • 1
    I'd bet that feh waits until the bg is set (which should be almost instant), but not until it is shown. – pLumo Feb 27 at 15:08
  • I untagged bash as it's not directly involved; it seems more along the lines of an X11 question. – Jeff Schaller Feb 27 at 15:10
  • @RoVo Yup, my test proved it, feh exited before I could see the background change, thus i'm asking this. probably I should edit "set as background" to "set and shown as background". @ JeffSchaller sorry, I forgot to read the tag descriptions. – Wis Feb 27 at 15:16
  • if the pictures take different amounts of time to scale, then your timings will be thrown off -- you'd have to keep track of when the last one finished rendering and know how long the next one will take to render. – Jeff Schaller Feb 27 at 16:15
  • that's what I though so, too. they're all different with a much higher res. than my monitor. I will try pre-scaling them now to my monitors resolution with a single Image Magic command. – Wis Feb 27 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.