In OS X Lion, when user toggle app full-screen, the window moves to the right to the new space and this new space has a default background.
In QuickTime X, when user toggle full screen, desktop background on the new space that gets created is black.
Is there a code to have a custom desktop image for the newly created space?
I know that it's possible to change the desktop background of every space in Lion through system preferences but I need not to change it, but to have it already set up when the space gets created for letting the app going full-screen.
Unfortunately, no. The default linen texture is shown when transitioning an application to a full screen (so that it has it's own space).
It's possible to set different desktop pictures for normal, non-application spaces using the methods available in NSWorkspace (i.e. – setDesktopImageURL:forScreen:options:error:), but they don't really let you control the space that the image is set on – it seems to just set whatever space you're currently on.
So sadly, the answer is no.
Related
I would like to change the wallpaper on ALL desktops including spaces on Mac but without needing to call killall Dock each minute. (Dock restarting forces wallpaper refresh).
I have an AppleScript that changes the desktop wallpaper instantly:
tell application "System Events" to tell every desktop to set picture to wallpaperPath
but that only changes the wallpaper on the active space (meaning that if the main desktop is not active, its background will not change).
I found this question How to loop through all Mac desktop spaces which suggests updating wallpaper path values in the SQLite database located at ~/Library/Application Support/Dock/desktoppicture.db. This changes the wallpaper at every space which is great but it requires restart of the dock using killall Dock which is undesirable as it disrupts the workflow.
My question is - is there some way to combine these two approaches? Seamlessly change wallpapers on every desktop space?
Any suggestions would be appreciated. I have no preferred language, it can be in C, Swift, Python, Bash, AppleScript etc.
I figured it out.
I am looping through all available screens and setting the wallpaper using setDesktopImageURL:forScreen:options:error::
for screen in NSScreen.screens {
try! NSWorkspace.shared.setDesktopImageURL(url, for: screen, options: [:])
}
This changes the wallpapers seamlessly, without the need for killall Dock on all the screens but only if the desktop is the active space.
To make sure the wallpaper is changed when I am on another space (usually a fullscreen app), I added an observer for NSWorkspace.activeSpaceDidChangeNotification on the NSWorkspace.shared.notificationCenter which sets the desktop images again (using the code above). So whenever I go back to the desktop, this notification is invoked and the wallpaper is seamlessly updated.
I even went one step further and added the same observer also for the NSWorkspace.didWakeNotification which updates the wallpaper as soon as the device wakes up which is cool!
In OSX, Dock when visible, reserves space that other windows can't use. How's that done?
In my use case,
I want to limit the space in which all application windows can open,
Whenever a new popup comes up it should be confined within the limited space and centred relative to the limited space
Something like Desktop Coral for windows.
You can write an apple script, which continuously monitors which application is started and resizes it to the desired size on launch. Small example to do so is given in following script:
https://gist.github.com/akshay-bhardwaj/daf93c2e1ed8b79a4619
Hope this helps. If you have further issues please feel free to ask
Regards
I am creating a toolbar on Windows that is being ported over to the Mac, is there such a concept as a workarea on the Mac, like there is on Windows.
If you are unfamiliar of what the workarea on Windows is, it is basically a defined space that all open windows can re-size in. Meaning normally you can re-size your windows to fill the whole screen, but if I change the workarea to a smaller size when you try to maximize your open windows they will stop at the boundaries of the new workarea. For example the Windows taskbar does this. If you move your windows taskbar up or down, then this affects how much space you have left for open windows to utilize, the taskbar is changing your workarea dimensions.
Windows uses the following function SystemParametersInfo with SPI_SETWORKAREA passed into to change the size of a workarea. Is there an equivalent to this on the Mac?
Thanks.
Yes, there is a mechanism in OS X to keep maximized windows from overlapping the Dock. Look at NSScreen's -visibleFrame method.
I am trying to build an Adobe AIR app that runs on two monitors with an extended desktop. Is that possible?
I've read fullscreen is restricted to a single display and the only option is to maximize the app to both displays. Is that right? If so, how can I hide OSX top menu bar?
Just for the record, OSX does not allow you to have more than one full screen applications (of any kind, not just AIR) open at the same time nor it let's you to expand a full screen app to more than one display.
An application window can span multiple displays as long as the window is sized properly. Menubar and dock can also be hidden. Check NSWindow in the apple documentation for more info. Adobe may or may not support this feature.
I have an OpenGL-based app that can run windowed or fullscreen in OS X 10.5. While in windowed mode, pressing the volume keys in the keyboard changes the volume setting (mute/unmute for example) and the OSX-drawn speaker icon overlay is drawn, as it happens with every other application.
However, in full screen mode, pressing the keys does change the volume setting, but no overlay is drawn - I can't figure out why, since I'm not doing anything different.
Any ides?
When you are in fullscreen, your app captures the display and nothing else can draw to the screen as the window server is not asked to do it's compositing.
If you want to have regular compositing in full screen, you must hide the menu bar, window title bar, and make your window full screen.
Google a bit, there are tons of posts on how to do that without capturing the display.
Edit: this might be of interest: http://developer.apple.com/mac/library/technotes/tn2002/tn2062.html