Processing Ajax...

Title
Close Dialog

Message

Confirm
Close Dialog

Confirm
Close Dialog

Possible to use mouse idle timer to show/hide desktop windows?

JGultrawide's profile on WallpaperFusion.com
I want to get more enjoyment out of my active wallpapers. Is it possible to minimize all windows after 60 of no mouse input? And then relaunch all windows upon next mouse movement. Essentially a screensaver but for my desktop wallpaper.

I would also want a toggle switch for the timer, as I may want to enable long idles for watching videos and such. Is something like this possible? Where would I start?
Aug 26, 2021  • #1
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
Hello,

The attached script below should be able to do this for you. You can import it by opening the DisplayFusion Settings > Functions > Scripted Function > Import Scripted Function. You can then run it from a "System Idle" trigger.

Thanks!
Aug 27, 2021  • #2
User Image
David L. West
1 discussion post
I'm trying to figure out how to modify the script to not run if it's on a portrait oriented monitor. Then I'd move the mouse to that screen when watching video. I found code that does this:

Rectangle bounds = BFS.Monitor.GetMonitorBoundsByMouseCursor();

But I haven't yet found the docs for the Rectangle object and am unsure of what context I should be looking in. But I'd just do the above and then wrap the whole thing in an if statement conditioned on the monitor width being greater than the height.
Sep 20, 2022 (modified Sep 20, 2022)  • #3
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
Hi David,

Yep you got it, you could add in the following lines:

Code

Rectangle bounds = BFS.Monitor.GetMonitorBoundsByMouseCursor();
        if (bounds.X < bounds.Y) 
        {
         //do stuff
        return;
        }
Sep 22, 2022  • #4
User Image
saf1
7 discussion posts
I added this at line 17 to prevent it from minimizing if the mouse cursor is in the very top left corner.

Code

if (scriptStartMousePosition.X + scriptStartMousePosition.Y == 0)
        {
            return; // Don't do anything if the mouse is in the upper left corner.
        }
Oct 12, 2022 (modified Oct 12, 2022)  • #5
User Image
saf1
7 discussion posts
Seems like the System Idle trigger gets fired after every delay. So if you set it to go one minute after idle starts, it'll fire off a new thread every minute until you move the mouse. Is there any way to detect an already running instance of a trigger that's still running?
Oct 12, 2022  • #6
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Responded to your email already, but will post this here in case anyone else comes across it:

It looks like the sendkeys that the script sends makes Windows reset its idle timer. I've done a quick test here, and doing this should work around that:

Add this at the start of the script:

Code

// If the script is already running, exit
if (BFS.ScriptSettings.ReadValueBool("MinimizeScriptIsRunning"))
{
return;
}

// Mark the script as running
BFS.ScriptSettings.WriteValueBool("MinimizeScriptIsRunning", true);


And this at the end of the script:

Code

// Mark the script as not running
BFS.ScriptSettings.WriteValueBool("MinimizeScriptIsRunning", false);
Oct 13, 2022  • #7
Was this helpful?  Login to Vote(1)  Login to Vote(-)