Skip to content

Commit

Permalink
🐞 Make system window manager work on multi-screen setups
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKai77 committed Dec 28, 2024
1 parent 706a942 commit d7eec27
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions Loop/Extensions/Notification+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ extension Notification.Name {
static let didLoop = Notification.Name("didLoop")
static let activeStateChanged = Notification.Name("activeStateChanged")

static let systemWindowManagerStateChanged = Notification.Name("systemWindowManagerStateChanged")
static let keybindsUpdated = Notification.Name("keybindsUpdated")

static let didImportKeybindsSuccessfully = Notification.Name("didImportKeybindsSuccessfully")
Expand Down
5 changes: 4 additions & 1 deletion Loop/Luminare/Loop/AdvancedConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import SwiftUI

class AdvancedConfigurationModel: ObservableObject {
@Published var useSystemWindowManagerWhenAvailable = Defaults[.useSystemWindowManagerWhenAvailable] {
didSet { Defaults[.useSystemWindowManagerWhenAvailable] = useSystemWindowManagerWhenAvailable }
didSet {
Defaults[.useSystemWindowManagerWhenAvailable] = useSystemWindowManagerWhenAvailable
Notification.Name.systemWindowManagerStateChanged.post()
}
}

@Published var animateWindowResizes = Defaults[.animateWindowResizes] {
Expand Down
3 changes: 3 additions & 0 deletions Loop/Luminare/Settings/Behavior/BehaviorConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ struct BehaviorConfigurationView: View {
}
}
}
.onReceive(.systemWindowManagerStateChanged) { _ in
model.useSystemWindowManagerWhenAvailable = Defaults[.useSystemWindowManagerWhenAvailable]
}

LuminareSection("Cursor") {
LuminareToggle("Use screen with cursor", isOn: $model.useScreenWithCursor)
Expand Down
2 changes: 1 addition & 1 deletion Loop/Window Management/WindowEngine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ enum WindowEngine {
window.activate()
}

if #available(macOS 15, *), Defaults[.useSystemWindowManagerWhenAvailable] {
if #available(macOS 15, *), Defaults[.useSystemWindowManagerWhenAvailable], !willChangeScreens {
SystemWindowManager.MoveAndResize.syncPadding()

// System resizes seem to only be able to be performed on the frontmost app
Expand Down

0 comments on commit d7eec27

Please sign in to comment.