1

Basic idea: The window will be show for x seconds every n minutes on all displays. To "force" the user to take a break.

My problem is to get the window to show on all displays, how can this be done with swift?

Lars Nielsen
  • 2,005
  • 2
  • 25
  • 48
  • 2
    Instead of trying to have one window show on every display, you should consider having one window per display. – zneak Mar 27 '16 at 18:56
  • hmm so one instance per display, also an option do you have a guid for designation/assigning a window to a display ? – Lars Nielsen Mar 27 '16 at 18:57
  • NSWindow has an initializer that accepts a `NSScreen` argument. After the fact, you can also [do shenanigans to move the window to another screen](http://stackoverflow.com/questions/16658582/how-to-move-nswindow-to-a-particular-screen). – zneak Mar 27 '16 at 18:59
  • thanks @zneak will try and get it to work based on this – Lars Nielsen Mar 27 '16 at 19:02
  • If System Preferences > Mission Control > Displays have separate Spaces is enabled, then windows **can't** span multiple screens. See the [the 10.9 AppKit release notes](https://developer.apple.com/library/mac/releasenotes/AppKit/RN-AppKitOlderNotes/#10_9Spaces). – Ken Thomases Mar 27 '16 at 19:05
  • @zneak I may be completely stupid, but can I do the screen solution via a WindowController, pass that as a parameter along side the nib file name for the window ? – Lars Nielsen Mar 29 '16 at 09:50
  • 1
    @LarsNielsen maybe :) I didn't post an answer because I'm not completely sure of the mechanics, but I still thought that I could be somewhat helpful. – zneak Mar 29 '16 at 14:17

1 Answers1

0

Unless the user has their desktop Mirrored there is no way to display one NSWindow on all screens.

The only way to do this is to pretty much create a new window for each screen.

If your NSWindowController, NSWindow etc... complies with NSCopying, just copy it and take a look at this post regarding displaying NSWindows in various screens:

How to change the NSScreen a NSWindow appears on

Hope this helps.

Community
  • 1
  • 1
Adrian Sluyters
  • 2,186
  • 1
  • 16
  • 21