I tweeked it. feh --bg-fill -g +0+"$y" /usr/local/share/wallpapers/MATRIX-screen-1920x1080.jpg || exit
I cant see *.jpg moving up. It looks like the 'feh --bg-fill' that I use in .xinitrc (doing this on/in the root-window) On Mon, Sep 14, 2026 at 3:37 PM Todd Gruhn <[email protected]> wrote: > > What does " sh -ec ' " mean? > I am assuming "/bin/sh -ec ' " > > I rarely do shell -- usual perl > > On Mon, Sep 14, 2026 at 12:36 PM Robert Elz <[email protected]> wrote: > > > > Date: Sun, 13 Sep 2026 17:49:57 -0600 > > From: "DTB" <[email protected]> > > Message-ID: <[email protected]> > > > > | # I have not tried this! You may have to debug. > > > > Yes. > > > > | sh -ec ' > > | while :; do > > | pkill feh || true > > | feh --class wallpaper -g +0+$y /path/to/wallpaper.tif > > | > > | y=$(echo $y 1 + p | dc) # +1 per round > > | test $y -gt 100 && y=0 # 0-100 > > | sleep 5 # 5s > > | done' > > > > I know nothing about feh, or moving wallpapers (can't even imagine > > wanting that) or how smooth a technique like that would be, but as > > a sh script that's just painful to look at. > > > > Instead try: > > > > sh -c ' y=0 > > while : > > do > > pkill feh 2>/dev/null > > feh --class wallpaper -g +0+"$y" /path/to/wallpaper.tif || > > exit > > y=$(( y + 1 > 100 ? 0 : y + 1 )) > > sleep 5 || exit > > done' > > > > No evil -e, and because of that, no need for the || true after the pkill > > (but redirecting stderr, if there is no feh running, no need to be told > > about it), the next line might (probably does, but as I don't know feh > > I'm not sure) > > > > feh --class wallpaper -g +0+"$y" /path/to/wallpaper.tif & > > > > instead of what I put there - depends whether feh just loads the wallpaper > > and exits (in which case you want the first version with "|| true") > > or if it remains running, in which case you need the version with '&' > > instead, and in that case, between the pkill and the feh you also > > need to add "wait" (just that as command), or perhaps "wait $! || :" > > with the $! unquoted, so the first time it will just be "wait" which > > should do nothing, and later times it will wait for the previous "feh" > > to have exited before starting a new one - but starting async ('&' > > processes) > > and never waiting for them to exit isn't a good idea (it won't make > > zombie processes, the shell cleans up, but it is also remembering all > > the exit status values for no reason). > > > > The "sleep 5 || exit" as I expect that most of the time, that "sleep" > > will be what is running, and if interrupted or killed in some other way, > > you want the whole script to exit, not just iterate one more time. That's > > the place where the -e might have automated that, but it really is better > > to decide when the script should exit because of an error, and code that > > explicitly, rather than hoping -e will work as desired (it often doesn't). > > > > And to answer the on-list question, 'y' would be the y coordinate of the > > image on the screen, the original script didn't initialise it, hence you > > probably would get an error from "-g +0+" as the opion to feh the first > > time, and the y=$(echo $y 1 + p | dc) wouldn't have worked either. > > This version will gradually move the top of the wallpaper down the > > screen. To move up, init y to 100, and change the "y=" line in the > > loop to be: > > y=$(( y - 1 < 0 ? 100 : y - 1 )) > > > > It is quite likely that "100" is wrong, in both versions, and needs to > > be the vertical size of your screen, but again, I don't know feh, nor > > how it interprets its args, that might be a percentage of the screen size, > > rather than a pixel count, for all I know. > > > > kre > > > > ps: the script as a whole (moving down) using async feh might be ... > > > > sh -c ' y=0 > > while : > > do > > pkill feh 2>/dev/null > > wait $! || : > > feh --class wallpaper -g +0+"$y" /path/to/wallpaper.tif & > > y=$(( y + 1 > 100 ? 0 : y + 1 )) > > sleep 5 || exit > > done' > > > >
