Show NSWindow when Mission Control/Exposé "Show Desktop" is active - cocoa

I am building a Cocoa application that allows you to drag and drop files from a NSTableView to your computer. Personally, and I know I'm not alone, when I use applications like this I grab the files, invoke the "Show Desktop" hotkey which makes all my windows go away and then I drop the files on my Desktop.
However, if the files already exist on my Desktop, or wherever I'm dropping them, an Alert sheet comes up asking if I want to overwrite the files. But since I'm in Mission Control/Exposé "Show Desktop" mode, the sheet is floating in the middle of my Desktop instead of attached to my NSWindow...
Ideally, if my application has to show an alert sheet, while all the windows are offscreen, I would like to bring my window forward and out of this mode so the sheet is attached to it and not floating in the middle of my desktop but I cannot find much information on the subject. I've tried the standard makeKey and orderFront tactics but no dice. I've also looked into NSWindows setCollectionBehavior but none of these options seem applicable unless i just want my window to just always stay out and ignore this mode.
Does anyone know how to bring a NSWindow out of Exposé when in "Show Desktop" mode?

Related

Add commands to existing application right-click menu in macOS Dock

Safari's dock icon includes right-click commands for "New Window" and "New Private Window" -- see screenshot.
Since Mozilla rather negligently left these shortcuts off of the Firefox dock icon, is there any way (i.e., via AppleScript?) to add the same commands to Firefox's icon in the dock?
Edit: It has come to my attention that, currently, both Firefox and Safari act identically in this matter. If either application is open, the "New Window" and "New Private Window" commands appear in its dock icon's context menu. When either Safari or Firefox is closed, no such commands can be seen. This may be an across-the-board restriction in macOS regarding what commands may be seen when Command-Clicking on pinned icons in the dock for applications that are not running. If so, it's a pity; in Windows, if Firefox is pinned to the taskbar, these commands are always available via right-clicking whether Firefox is open or closed.
Not without modifying the Firefox application itself. (Good luck… it's a scary place in there.)
Dock menu items have to be created from native code running within an application. They can't be set by another process.
Applescript can do some interesting things in general, but it can only interact with existing functionality of an application (and even then, only with functionality that's explicitly been made scriptable). It can't add completely new features to an existing application.

Is it possible to make a webpage in FireFox take up the full window (no address-bar, etc.)?

I've been trying to use FireFox as a simple window for a webpage that I will not be leaving, so I don't need the address-bar or close buttons, but I would like to keep my task bar visible (i.e. I do not want to simply go full screen). The gists of what I am trying to achieve is a "full window mode". Is there an add on that allows this? Preferably, I'd like an add on that can easily be turned on and off.
To elaborate, I may have the window only be half of the screen, so a full screen mode that leaves the task bar visible would not be sufficient.
You can come close to this with some simple JavaScript, just a bookmarklet, which will open the currently viewed URL in a window with most of the info/action bars hidden:
javascript:void(window.open(location.href,"_blank","outerWidth=1000,outerHeight=650,top=0,left=250,menubar=no,toolbar=no,location=no,personalbar=no,status=no"))
You can get close to maximized with specifying appropriate numbers for outerWidth=1000,outerHeight=650,top=0,left=250 which match your screen size, but you will not get quite what you can do when maximized.
You can then maximize the window. Which gives you:
Window.open requires chrome privileges in order to hide the titlebar and locationbar which means an add-on must do it. You can then use add-ons to get the rest of the way.
Using the Hide Caption Titlebar Plus add-on (with appropriate options selected) will get you to a maximized window of:
And with the addition of the add-on Hide Navigation Bar, maximized and hitting the default F2 to hide the locationbar you get:
Non-maximized:
You also asked that it provide removal of the various action/status/tool bars when not maximized. These add-ons will do so.
Easily turning them on and off:
Hide Navigation Bar only hides the location bar if you hit F2. Hide Caption Titlebar Plus is a restartless add-on and thus can be enabled/disabled at will from about:addons (Ctrl+Shift+A). It can also be set to mostly affect only maximized windows, so may not be something you need to enable/disable on a regular basis.
Personally, if this was something I wanted, I would set up a separate Firefox profile which has these add-ons and the home page as the one I wanted displayed. I would then set up a shortcut that automatically opens that page and shows what I want. You may need to use something like the add-on Session Manager to automatically restore the maximized window, but the default functionality in Firefox may be sufficient. In order to have a shortcut that brings up another Firefox profile automatically, you will need to set the Target to something like:
"C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -no-remote -P "your profile name"
This would allow you to bring up the page you wanted with a single click and not have the configuration disturb your normal use of Firefox. It would also be something that you would not need to mess around with enabling/disabling on a regular basis.
Many ways to do this:
There are, probably, many different combinations of add-ons which will get you to a similar look. There is, perhaps, even a single one which will do so. You should do some research on your own to find a combination that works for you. For the profile I was initially using to test, I did not need the Hide Navigation Bar add-on to hide the locationbar as that functionality was covered in a different add-on. However, if starting with a stock profile these two add-ons will get you to where it sounds like you want to be.
Taskbar is visible:
For all of the above images: If I had taken a shot of my entire desktop, you would see that that the Windows Taskbar is still visible (the Firefox window is just maximized, not full-screen). The above images are not full-screen for privacy reasons. I do not desire to share the windows I have open and my taskbar configuration. If I have the time later, I will re-take the window shots as full-screen shots after a clean re-boot.

Shortcut for cursor actions

I have windows 7 and here is my problem, I have an sequence of actions that I should make once every 3 minutes, it's right click on mcafee icon, and click on a parameter, that's all, I would like to create a keybord shortcut of that, I know that I didn't explain a lot, but I'm open to any questions you would have.
I assume that with "mcafee icon" you mean its tray icon.
If so, you can't do it with a single shortcut (unless that parameter you want to click on has one), but you can do it with either:
A sequence of shortcuts:
Windows key (or Ctrl+Esc)
Esc
Shift+Tab
Shift+Tab
You will now have set the focus on either the leftmost tray icon or the arrow to display the hidden tray icons (the focused item will have a rectangle around it), and you'll be able to move the focus to the other tray icons with the right or left keys. So...
Press the right or left keys until you focus the mcafee icon
Press the "menu key" or, if your keyboard doesn't have it, Shift+F10
You'll now have opened the mcafee's tray icon context menu, where if I understood you your "parameter" is. All you have left to do is to:
Select the "parameter" entry with the up or down keys
Press Return
Or you can probably do it with some kind of macro recording, UI automated testing or "gui scripting" (e.g. AutoHotKey) software . I don't know well any though so I can't advice you on that.
Beware that if you adopt the first solution the sequence of shortcuts solution will vary over time, you can't for example put it in a script and rely that it will always work, because the tray icons generally get placed in different orders and if you have the auto-hide feature enabled every now and then some get hidden.
The automated solution might be more stable instead, if the icons can be reliably identified.
I should also warn you that I wasn't able to really test the shortcuts' sequence on Windows 7 before posting, I have at my disposal at this moment just a Vista, but I'm rather confident it is valid for 7 too.

MFC: Address Bar control like Windows Explorer

In my MFC app, I'm attempting to make a window that resembles the Windows 7 Open File dialog, but it browses a virtual/fake file system. It doesn't need to be pixel-perfect, but I'd like parity with the native OS dialog where possible.
Probably the most challenging part is the address bar the runs along the top of an Open dialog. The address bar control is also atop all Windows Explorer windows. It shows the folder names that make up your path. It shows and hides buttons when moused over (including an attractive fade animation), changes the active directory when names are clicked, and shows submenus when the triangles between names are clicked. This doesn't seem to correspond to any MFC control (or group of controls). Spy++ shows it as an "AddressDisplay Control" but I can't find much documentation beyond that.
Is there a way to access a control like this, or to mimic it, in MFC? Also, I am not browsing the real file system, so I have to be able to tell the control what to display--I can't just point it at C:\ and let the system do the rest.
Here's a picture of the control in question.
Unfortunately, I think this is one of those controls that Microsoft has decided not to expose to developers through the Feature Pack. The Feature Pack was developed from the BCG control library. And, that library contains the control you want. However, it's not free. The only other alternative is to code it yourself.

How to assume/steal another process's windows as my own?

I'd like to show another app's windows under my app's taskbar button. It's a background app that reports another process's windows as my app's own. Is there any universal way to do this, e.g. each "new" window, alert glow, progressmeter, and other taskbar features, show under my own app's button?
For example, Winfox runs under its own process and steals Firefox's windows. It also adds features, but that's irrelevant -- I just want to support another app's existing taskbar features under my own app's button -- multiple windows, progressmeter, alert flashing, error flashing, mini-icons, etc. Is there a near-universal way to steal an app, or is it largely app-specific? Thanks!
You should be able to use SetParent() to take ownership of a window, but I'm not sure how much this will help you in your attempt to add taskbar features to the legacy app.

Resources