Electron win.flashFrame() method when app is minimized - windows

win.flashFrame() makes tray icon flash until the icon is clicked and the app window is back in the focus again (on Windows 10)
However, if the app is minimized, the flashing ends automatically after just a couple of seconds without even clicking on the icon.
How can I prevent this?

If the window is minimized the user won't see the window flash, you will need to use the win.setProgressBar funciton. This will make a loading bar behind the icon in the tray, you can also set the mode of the progress bar to indeterminate and set the progress to 100% and it will flash yellow/orange. This is a general standard used by lots of applications to get a users attention when the app is minimized.
win.setProgressBar(1, {
mode: "indeterminate"
});

Related

Detect show/hide Task View (Win+Tab)

I'm developing a Application Desktop Toolbar (next Toolbar). Toolbar receives ABN_FULLSCREENAPP notification when a fullscreen application window is opened or closed (e.g. through F11). A window is fullscreen when its client area occupies the entire screen. Toolbar should take themselves out of the topmost z-order so that they do not cover the fullscreen window. For this I use SetWindowPos() with flag HWND_BOTTOM/HWND_TOPMOST.
Problem: On Windows 10 when a fullscreen application window is opened (e.g. Explorer window through F11) Toolbar receives ABN_FULLSCREENAPP and send themselves to bottom z-order. Then, when Win + Tab is pressed, Task View appears. Task View occupies the entire working area of the screen - entire screen exclude the Taskbar area and the Toolbar area. But Toolbar remains under the full-screen window and Takbar appears on top, see image below. I want the Toolbar to also be on top of the full-screen window when TaskVew is open.
During the opening of Task View, Toolbar does not receive any messages. Apparently since Microsoft stopped development of the ADT API, there is no special message for the Toolbars.
Possible solutions:
1) Use the solution from similar question by performing the function in the timer between the opening and closing of the full-screen window;
2) Use LowLevelKeyboardProc() with SetWindowsHookEx().
Both solutions are not elegant. If you know other method of detecting the opening / closing TaskView please report. Undocumented methods are also useful.

How can I make the taskbar icon for my app move to the same display as the app?

Starting with Windows 8, there is a taskbar settings called Show taskbar buttons on where the user can control where the taskbar buttons are displayed when multiple displays are being used. How can I get my application to obey the Taskbar where window is open setting instead of always displaying on only the main taskbar?
The app in question is written in VB6 but I imagine this question might apply to other older frameworks as well.

XCode: debugging mac app window is always on top across applications

I am developing an Mac OS app, and have preference window presented as model. This works just fine as I want and I don't want to change that behaviour. The problem is: when the window is shown, and I debug on some breakpoints, the preference window is still there, however, Xcode's app is in focused now, but the preference window from the current app still shows on top. This is annoying. I have to drag it to somewhere to see the Xcode window. Is there anything that I can do so that if the app is in debug mode, then that preference window should also be gone away with my app in background and just Xcode is in foreground?
When a window is run as a modal window, its window level is set to NSModalPanelWindowLevel, which is above normal windows. As a hack just for debugging, you could do something like this just before running the window as modal:
dispatch_async(dispatch_get_main_queue(), ^{
NSApp.modalWindow.level = NSNormalWindowLevel;
});
Another approach would be to just run your app on a separate desktop space from Xcode.

NSWindow, how not to be part of a screenshot?

My Cocoa app displays a transparent window on the screen, but when the user tries to take a screenshot using Mac OS X's built-in screen capture key with the option of selecting full windows (Command-Shift-4, then Space Bar), my window gets highlighted as part of the possible windows to capture.
How can I tell my Window or App not to allow this? My Window already refuses to be the Main Window or Key Window through -canBecomeKeyWindow and -canBecomeMainWindow both returning NO, but this still happens.
The Window is also at the NSModalPanelWindowLevel and NSScreenSaverWindowLevel does the same thing.
Notice that every window is eligible for screenshots, even the desktop, dock and menu bar, which are special windows. You can even take a screenshot of the Exposé overlay window itself. This leads me to believe that there is no way to do this.
I suppose you could hook the Command+Shift+4 key event and hide the window, but that key combo is user-definable, so it is subject to change.

Cocoa - prevent window from getting overlapped

I'm writing an app that should remain visible on the desktop at all times. As such, I have to prevent other apps' windows moving on top of my app's window.
The Dock.app from Mac OS X partially does this: if you resize windows, they won't resize into the Dock.app's screen space, and if you hit the windows' '+' button, the window will not cover the dock.
Is it possible to replicate this functionality, and if so, how can I do it?
I'm not sure how well it will work and it definitely requires "Enable access for assistive devices" to be enabled in the "Universal Access" system preference panel, but you could try using the Accessibility Hierarchy to monitor window frame changes of all on-screen windows and further manipulate them as desired.

Resources