Processing Ajax...

Title

Message

Confirm

Confirm

Confirm

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure?

User Image
Gabriel Jones
2 discussion posts
Hello!

I use DisplayFusion's beta Window triggers to resize and move those stubborn windows that decide they want to popup on the wrong screen all the time. It works with most everything... except for my specific use case. The issue is with the way Chrome handles opening new windows: It doesn't know the title of the page it's opening until it... opens, so it just gives "Chrome: New window" or some other generic name for when it first starts up. Now, resizing for the most part works great (there's currently a small issue I've experienced with it not resizing the bottom of the window, but that's most likely due to the page I'm using being... odd.), but there isn't a way to delay looking for the match conditions in the triggers.

What is currently the problem:
Chrome windows open with a default title, then change titles to be something different a number of seconds later. As of now, I've had to set it so that my Event is Window Focused, and my Match Conditions are the Window Text of the fully loaded window. I then focus the window after it's fully loaded in Chrome, and it resizes.

What I think would be better:
Allow an action to delay checking match conditions, or as part of the trigger enable a delay with a customisable timer on Window Created to then go on to checking match conditions.

Thank you for your consideration, and I'm so happy to have bought this product so long ago, especially now that I really need it a lot!
Aug 9, 2016  • #1
User Image
NetMage
287 discussion posts
I have something similar happen with a script that attempts to move windows on the desktop when focused - if the window is focused by clicking the minimize button, it returns funny window bounds before the window is marked as minimized and messes up.

I put in a BFS.General.ThreadWait(100) to wait a tenth of a second to give time for the minimize event to be processed and then check if the window is minimized before using the bounds values.

Couldn't you put a similar delay to wait for Chrome to update its window title and then migrate the match conditions into your code to test the updated Window title.
Aug 9, 2016 (modified Aug 9, 2016)  • #2
madLyfe's profile on WallpaperFusion.com
i think a good addition to triggers would be the lock/unlock action of windows so that i can minimize/maximize windows when i lock/unlock my pc.
Aug 9, 2016  • #3
Keith Lammers (BFS)'s profile on WallpaperFusion.com
@Gabriel: I've added that to our feature request list. As NetMage mentioned, you could make the match conditions more generic (i.e. just check for the process), then check the title in a scripted function. That's a bit more complicated to setup though :)

@madLyfe: There actually are Desktop Locked/Unlocked Events available for the Triggers :)
Aug 11, 2016  • #4
madLyfe's profile on WallpaperFusion.com
Quote:
@madLyfe: There actually are Desktop Locked/Unlocked Events available for the Triggers :)


ah ok, im seeing that now. i guess im not sure how to minimize a couple chrome windows(not tabs) when i lock the PC and then maximize them when unlock the PC. actually id rather minimize them and then bring them back to their respective size.
Aug 11, 2016  • #5
User Image
NetMage
287 discussion posts
I might ask how you will know :)

Do you have other Chrome windows open that should not be minimized?

Here is code for a custom function that toggles all Chrome windows from minimized to restored. If you assign it to the Desktop Locked and Desktop Unlocked triggers it will toggle all Chrome windows.

If you have some minimized that should stay that way (e.g. be ignored) and not be restored on unlock, you can improve the GetWindowsByText filter to narrow down which windows are affected, and possibly write two separate lock/unlock functions and keep track of the windows to be restored if toggling isn't reliable enough.

I called the function ToggleChromeMinimize

Code

using System;
using System.Drawing;

// The 'windowHandle' parameter will contain the window handle for the:
//   - Active window when run by hotkey
//   - Trigger target when run by a Trigger rule
//   - TitleBar Button owner when run by a TitleBar Button
//   - Jump List owner when run from a Taskbar Jump List
//   - Currently focused window if none of these match
public static class DisplayFusionFunction
{
public static void Run(IntPtr windowHandle)
{
var chromeWindows = BFS.Window.GetWindowsByText("* - Google Chrome");

foreach (var aWindow in chromeWindows) {
if (BFS.Window.IsMinimized(aWindow))
            BFS.Window.Restore(aWindow);
else
            BFS.Window.Minimize(aWindow);
}
}
}
Aug 12, 2016  • #6
madLyfe's profile on WallpaperFusion.com
Quote:
I might ask how you will know :)

Do you have other Chrome windows open that should not be minimized?

Here is code for a custom function that toggles all Chrome windows from minimized to restored. If you assign it to the Desktop Locked and Desktop Unlocked triggers it will toggle all Chrome windows.

If you have some minimized that should stay that way (e.g. be ignored) and not be restored on unlock, you can improve the GetWindowsByText filter to narrow down which windows are affected, and possibly write two separate lock/unlock functions and keep track of the windows to be restored if toggling isn't reliable enough.

I called the function ToggleChromeMinimize

Code

using System;
using System.Drawing;

// The 'windowHandle' parameter will contain the window handle for the:
//   - Active window when run by hotkey
//   - Trigger target when run by a Trigger rule
//   - TitleBar Button owner when run by a TitleBar Button
//   - Jump List owner when run from a Taskbar Jump List
//   - Currently focused window if none of these match
public static class DisplayFusionFunction
{
public static void Run(IntPtr windowHandle)
{
var chromeWindows = BFS.Window.GetWindowsByText("* - Google Chrome");

foreach (var aWindow in chromeWindows) {
if (BFS.Window.IsMinimized(aWindow))
            BFS.Window.Restore(aWindow);
else
            BFS.Window.Minimize(aWindow);
}
}
}


i have a couple websites that i run in windowed mode through chrome so they feel more like apps. for some reason if i have these windows active and not minimized they will hold my computer from activating the screensaver. ive spent waaay too much time trying to figure out why but if i minimize them then i can get the screensaver to function properly. so when i lock my PC it would be nice to have just these windows minimized and then restored when i unlock.
Aug 12, 2016  • #7
User Image
NetMage
287 discussion posts
Possibly they are flash based and telling windows not to start the screen saver (as if you were watching media). You could try opening an Administrative prompt and running powercfg /requests to see if you see something in the [Display] section from Chrome.

Are the window titles similar enough you can adjust the filter to match them, or do you need to provide a list of titles?

Also seems like you need the function to minimize on lock instead of toggle to be sure. Would you want it to leave windows manually minimized before lock as untouched after unlock instead of restoring them?
Aug 12, 2016 (modified Aug 12, 2016)  • #8
madLyfe's profile on WallpaperFusion.com
Quote:
Possibly they are flash based and telling windows not to start the screen saver (as if you were watching media). You could try opening an Administrative prompt and running powercfg /requests to see if you see something in the [Display] section from Chrome.

Are the window titles similar enough you can adjust the filter to match them, or do you need to provide a list of titles?

Also seems like you need the function to minimize on lock instead of toggle to be sure. Would you want it to leave windows manually minimized before lock as untouched after unlock instead of restoring them?


well the two windows in question are irccloud and tweetdeck and flash in chrome is disabled unless enabled for that site. i know there is media embedded into these windows that keep the screen saver from triggering but as far as i can tell its unique to me as to why. nobody else ive talked to about it has the issue. i have a post on here, and other sites talking about the issue.

tweetdeck title on the window is static. the irccloud window on the other changes it title depending on which channel/server i was last viewing so that one is variable.

im not sure what you are describing or asking in the third paragraph.
Aug 12, 2016  • #9
User Image
NetMage
287 discussion posts
The first function I wrote toggles Chrome windows from minimized to normal. If you have manually minimized tweetdeck and then locked, the function would restore tweetdeck and your screen saver wouldn't activate.

So, I think a function that only minimizes when locked and restores when unlocked would be best.

But when you unlock the screen do you want tweetdeck and irccloud to be restored even if you had manually minimized them before you locked?
Aug 12, 2016 (modified Aug 12, 2016)  • #10
madLyfe's profile on WallpaperFusion.com
Quote:
The first function I wrote toggles Chrome windows from minimized to normal. If you have manually minimized tweetdeck and then locked, the function would restore tweetdeck and your screen saver wouldn't activate.

So, I think a function that only minimizes when locked and restores when unlocked would be best.

But when you unlock the screen do you want tweetdeck and irccloud to be restored even if you had manually minimized them before you locked?


ya that would be nice. if it properly minimizes those windows when i lock the computer i will not manually be doing it though. maybe putting that in there just in case of user error. :D
Aug 13, 2016  • #11
User Image
NetMage
287 discussion posts
Here is a new script that will minimize Chrome windows on desktop lock with titles matching a series of wildcards, and then restore them on desktop unlock. Create a Desktop Locked trigger and Desktop Unlocked trigger and assign them both to run the function, which I named MinimizeChromeWhileLocked:

Code

using System;
using System.Collections.Generic;
using System.Drawing;

// The 'windowHandle' parameter will contain the window handle for the:
//   - Active window when run by hotkey
//   - Trigger target when run by a Trigger rule
//   - TitleBar Button owner when run by a TitleBar Button
//   - Jump List owner when run from a Taskbar Jump List
//   - Currently focused window if none of these match
public static class DisplayFusionFunction
{
public static void Run(IntPtr windowHandle)
{
        var chromeTitleMatches = new string[] { "*Tweetdeck", "*IRCCloud" };
        
var chromeWindows = new List<IntPtr>();
foreach (var aTitle in chromeTitleMatches) {
            chromeWindows.AddRange(BFS.Window.GetWindowsByText(aTitle + " - Google Chrome"));
        }

foreach (var aWindow in chromeWindows) {
            if (BFS.General.IsDesktopLocked()) {
                if (!BFS.Window.IsMinimized(aWindow))
                    BFS.Window.Minimize(aWindow);
            }
            else {
                if (BFS.Window.IsMinimized(aWindow))
                    BFS.Window.Restore(aWindow);
            }
        }
}
}
Aug 18, 2016  • #12
madLyfe's profile on WallpaperFusion.com
Quote:
Here is a new script that will minimize Chrome windows on desktop lock with titles matching a series of wildcards, and then restore them on desktop unlock. Create a Desktop Locked trigger and Desktop Unlocked trigger and assign them both to run the function, which I named MinimizeChromeWhileLocked:

Code

using System;
using System.Collections.Generic;
using System.Drawing;

// The 'windowHandle' parameter will contain the window handle for the:
//   - Active window when run by hotkey
//   - Trigger target when run by a Trigger rule
//   - TitleBar Button owner when run by a TitleBar Button
//   - Jump List owner when run from a Taskbar Jump List
//   - Currently focused window if none of these match
public static class DisplayFusionFunction
{
public static void Run(IntPtr windowHandle)
{
        var chromeTitleMatches = new string[] { "*Tweetdeck", "*IRCCloud" };
        
var chromeWindows = new List<IntPtr>();
foreach (var aTitle in chromeTitleMatches) {
            chromeWindows.AddRange(BFS.Window.GetWindowsByText(aTitle + " - Google Chrome"));
        }

foreach (var aWindow in chromeWindows) {
            if (BFS.General.IsDesktopLocked()) {
                if (!BFS.Window.IsMinimized(aWindow))
                    BFS.Window.Minimize(aWindow);
            }
            else {
                if (BFS.Window.IsMinimized(aWindow))
                    BFS.Window.Restore(aWindow);
            }
        }
}
}


how do i go about using this?
Nov 30, 2016  • #13
User Image
NetMage
287 discussion posts
On the Functions tab, use Add Scripted to create a new scripted function named MinimizeChromeWhileLocked and paste the code in place of what is currently in the window and click OK to save it.

On the Triggers tab, Add a new trigger for Desktop Locked and Add a Run Function action to run the new scripted function above (MinimizeChromeWhileLocked).
Add another new trigger for Desktop Unlocked and Add a Run Function action to run the new scripted function above (MinimizeChromeWhileLocked).

Now Ok or Apply everything and you should be good to go.
Dec 1, 2016  • #14
madLyfe's profile on WallpaperFusion.com
Quote:
On the Functions tab, use Add Scripted to create a new scripted function named MinimizeChromeWhileLocked and paste the code in place of what is currently in the window and click OK to save it.

On the Triggers tab, Add a new trigger for Desktop Locked and Add a Run Function action to run the new scripted function above (MinimizeChromeWhileLocked).
Add another new trigger for Desktop Unlocked and Add a Run Function action to run the new scripted function above (MinimizeChromeWhileLocked).

Now Ok or Apply everything and you should be good to go.


ty for this. is there a way to test if this is working to see if the windows are actually being minimized?

also, my IRCCloud window doesnt have IRCCloud in the title, it only has the current channel or server name as the title for the window that i am on. there is always a '*' as the first character in the window title, though, that maybe be of some help.
• Attachment: chrome_2017-04-11_13-15-08.png [323,864 bytes]
chrome_2017-04-11_13-15-08.png
chrome_2017-04-11_13-15-08.png
Apr 11, 2017 (modified Apr 11, 2017)  • #15
Keith Lammers (BFS)'s profile on WallpaperFusion.com
We've just released a new DisplayFusion beta version there's now a delay setting for the Match Conditions. Please let us know if you run into any trouble after updating.

Thanks!
Apr 27, 2018  • #16
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)