michelf / sim-daltonism

A color blindness simulator for Mac and iOS
256 stars 18 forks source link

Using over fullscreen apps switches to the desktop #6

Closed thecodewarrior closed 5 years ago

thecodewarrior commented 5 years ago

Using Sim Daltonism over fullscreen apps is difficult as whenever you try to move the viewer it snaps you back to the nearest desktop. The Helium app does this well, so here's their implementation:

https://github.com/JadenGeller/Helium/blob/b35a416376dee7184f788e6ae5736f19890d3ddc/Helium/Helium/HeliumPanelController.swift#L122-L129

class HeliumPanelController : NSWindowController {
    ...
    private var panel: NSPanel! {
        get {
            return (self.window as! NSPanel)
        }
    }
    ...
    private func setFloatOverFullScreenApps() {
        if NSUserDefaults.standardUserDefaults().boolForKey(UserSetting.DisabledFullScreenFloat.userDefaultsKey) {
            panel.collectionBehavior = [.MoveToActiveSpace, .FullScreenAuxiliary]

        } else {
            panel.collectionBehavior = [.CanJoinAllSpaces, .FullScreenAuxiliary]
        }
    }
    ...
}
michelf commented 5 years ago

I noticed that too. But I'm pretty sure it used to work before Mojave, as I spent some time debugging that. And if I test it right now, I can move the window over full screen apps just fine. I remember quite well not being able to move the window over a full-screen app a day or two ago. Maybe it's an intermittent problem?

Note that I'm doing pretty much the same thing as Helium is doing:

window?.collectionBehavior = [.canJoinAllSpaces, .fullScreenAuxiliary, .participatesInCycle]

I guess I need to investigate the next time I observe this.

thecodewarrior commented 5 years ago

I'm currently on a (10 year old) MacBook that only supports up to El Capitan, so that might be it. I would work on it but I don't think I can get XCode on this computer any more (because apple won't let you download old versions of software unless it's in your "already purchased" list for some reason) and even if I could I the latest El Capitan version probably doesn't support newer versions of Swift.

michelf commented 5 years ago

Ok, so that was useful information. It's easily reproducible on El Captain.

And you're right, you'll have a hard time running a modern version of Swift there.

The way window dragging works has changed at some point however. There's a chance if you try a version before this commit it'll work better. So maybe try version 2.0.1?

thecodewarrior commented 5 years ago

Using v2.0.1 it works perfectly.

Thank you for the prompt replies by the way. I was pleasantly shocked when you replied after only 20 minutes. Most of the time it takes at least a day for people to reply (I'm even worse though, so I'm kinda a pot calling the kettle black).