How to block shell script until new background image is set AND displayed?












0















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:



#!/bin/sh
~/.scripts/helpers/killall-other-script-instances
while true
do
for f in ~/Pictures/wallpapers/show/*; do
feh --bg-scale $f
sleep 3
done
done









share|improve this question




















  • 1





    I'd bet that feh waits until the bg is set (which should be almost instant), but not until it is shown.

    – RoVo
    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
















0















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:



#!/bin/sh
~/.scripts/helpers/killall-other-script-instances
while true
do
for f in ~/Pictures/wallpapers/show/*; do
feh --bg-scale $f
sleep 3
done
done









share|improve this question




















  • 1





    I'd bet that feh waits until the bg is set (which should be almost instant), but not until it is shown.

    – RoVo
    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














0












0








0


1






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:



#!/bin/sh
~/.scripts/helpers/killall-other-script-instances
while true
do
for f in ~/Pictures/wallpapers/show/*; do
feh --bg-scale $f
sleep 3
done
done









share|improve this question
















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:



#!/bin/sh
~/.scripts/helpers/killall-other-script-instances
while true
do
for f in ~/Pictures/wallpapers/show/*; do
feh --bg-scale $f
sleep 3
done
done






shell-script x11 wallpaper feh






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 28 at 16:37







Wis

















asked Feb 27 at 14:51









WisWis

33




33








  • 1





    I'd bet that feh waits until the bg is set (which should be almost instant), but not until it is shown.

    – RoVo
    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














  • 1





    I'd bet that feh waits until the bg is set (which should be almost instant), but not until it is shown.

    – RoVo
    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








1




1





I'd bet that feh waits until the bg is set (which should be almost instant), but not until it is shown.

– RoVo
Feb 27 at 15:08







I'd bet that feh waits until the bg is set (which should be almost instant), but not until it is shown.

– RoVo
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





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





@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





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





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










0






active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f503362%2fhow-to-block-shell-script-until-new-background-image-is-set-and-displayed%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f503362%2fhow-to-block-shell-script-until-new-background-image-is-set-and-displayed%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

is 'sed' thread safe

How to make a Squid Proxy server?