Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/dev-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
jobs:
pre-release:
name: Development Build
runs-on: macos-26
runs-on: xcode-27
permissions:
contents: write
pull-requests: write
Expand Down Expand Up @@ -44,7 +44,7 @@ jobs:
echo "FROM_TAG=$FROM_TAG" >> $GITHUB_ENV

- name: 🔧 Select Xcode
run: sudo xcode-select -s "/Applications/Xcode_26.4.app"
run: sudo xcode-select -s "/Applications/Xcode_27.0.app"

- name: 🎟️ Install Development & Developer ID Certificate
env:
Expand Down
80 changes: 45 additions & 35 deletions Loop.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
objects = {

/* Begin PBXBuildFile section */
2A28492B2F22B4B700F6CE42 /* Scribe in Frameworks */ = {isa = PBXBuildFile; productRef = 2A28492A2F22B4B700F6CE42 /* Scribe */; };
2A03B7272FFD8ECC00B2243F /* Scribe in Frameworks */ = {isa = PBXBuildFile; productRef = 2A03B7262FFD8ECC00B2243F /* Scribe */; };
2A03B7292FFD8EDC00B2243F /* Scribe in Frameworks */ = {isa = PBXBuildFile; productRef = 2A03B7282FFD8EDC00B2243F /* Scribe */; };
2A28B6292EE5050C00A1E26B /* Defaults in Frameworks */ = {isa = PBXBuildFile; productRef = 2A28B6282EE5050C00A1E26B /* Defaults */; };
2A504E822FFD8E5400694B30 /* Scribe in Frameworks */ = {isa = PBXBuildFile; productRef = 2A504E812FFD8E5400694B30 /* Scribe */; };
2A504E872FFD8E7700694B30 /* Luminare in Frameworks */ = {isa = PBXBuildFile; productRef = 2A504E862FFD8E7700694B30 /* Luminare */; };
2A504E8A2FFD8E8800694B30 /* Subsurface in Frameworks */ = {isa = PBXBuildFile; productRef = 2A504E892FFD8E8800694B30 /* Subsurface */; };
2A86890D2F80968A005B521B /* LoopDockTile.plugin in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2A8689072F809625005B521B /* LoopDockTile.plugin */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
2AC4F4A82FDCAF1F00CB2FBE /* Scribe in Frameworks */ = {isa = PBXBuildFile; productRef = 2AF9238D2F540B1300F467FD /* Scribe */; };
2AC4F62C2FDCAF7100CB2FBE /* Luminare in Frameworks */ = {isa = PBXBuildFile; productRef = 2AC4F62B2FDCAF7100CB2FBE /* Luminare */; };
2AE091C72F81A22800EF6149 /* Scribe in Frameworks */ = {isa = PBXBuildFile; productRef = 2AE091C62F81A22800EF6149 /* Scribe */; };
2AF923902F540B2200F467FD /* Scribe in Frameworks */ = {isa = PBXBuildFile; productRef = 2AF9238F2F540B2200F467FD /* Scribe */; };
3ED0A7B92F21DF6800A58629 /* ZIPFoundation in Frameworks */ = {isa = PBXBuildFile; productRef = 3ED0A7B82F21DF6800A58629 /* ZIPFoundation */; };
B1AA00412F30000100AABBCC /* LoopUpdaterHelper in CopyFiles */ = {isa = PBXBuildFile; fileRef = B1AA00012F30000100AABBCC /* LoopUpdaterHelper */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
F06D768A2DFF7A77007EEDA9 /* SkyLight.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F06D76892DFF7A77007EEDA9 /* SkyLight.framework */; };
Expand Down Expand Up @@ -129,7 +129,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
2AE091C72F81A22800EF6149 /* Scribe in Frameworks */,
2A03B7272FFD8ECC00B2243F /* Scribe in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -144,20 +144,20 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
2AC4F4A82FDCAF1F00CB2FBE /* Scribe in Frameworks */,
2A28B6292EE5050C00A1E26B /* Defaults in Frameworks */,
2A28492B2F22B4B700F6CE42 /* Scribe in Frameworks */,
2A504E8A2FFD8E8800694B30 /* Subsurface in Frameworks */,
F06D768A2DFF7A77007EEDA9 /* SkyLight.framework in Frameworks */,
2A504E822FFD8E5400694B30 /* Scribe in Frameworks */,
2A504E872FFD8E7700694B30 /* Luminare in Frameworks */,
3ED0A7B92F21DF6800A58629 /* ZIPFoundation in Frameworks */,
2AC4F62C2FDCAF7100CB2FBE /* Luminare in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
B1AA00102F30000100AABBCC /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
2AF923902F540B2200F467FD /* Scribe in Frameworks */,
2A03B7292FFD8EDC00B2243F /* Scribe in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -222,7 +222,7 @@
);
name = LoopDockTile;
packageProductDependencies = (
2AE091C62F81A22800EF6149 /* Scribe */,
2A03B7262FFD8ECC00B2243F /* Scribe */,
);
productName = LoopDockTile;
productReference = 2A8689072F809625005B521B /* LoopDockTile.plugin */;
Expand Down Expand Up @@ -275,9 +275,9 @@
packageProductDependencies = (
2A28B6282EE5050C00A1E26B /* Defaults */,
3ED0A7B82F21DF6800A58629 /* ZIPFoundation */,
2A28492A2F22B4B700F6CE42 /* Scribe */,
2AF9238D2F540B1300F467FD /* Scribe */,
2AC4F62B2FDCAF7100CB2FBE /* Luminare */,
2A504E812FFD8E5400694B30 /* Scribe */,
2A504E862FFD8E7700694B30 /* Luminare */,
2A504E892FFD8E8800694B30 /* Subsurface */,
);
productName = WindowManager;
productReference = A8E59C35297F5E9A0064D4BA /* Loop.app */;
Expand All @@ -300,7 +300,7 @@
);
name = LoopUpdaterHelper;
packageProductDependencies = (
2AF9238F2F540B2200F467FD /* Scribe */,
2A03B7282FFD8EDC00B2243F /* Scribe */,
);
productName = LoopUpdaterHelper;
productReference = B1AA00012F30000100AABBCC /* LoopUpdaterHelper */;
Expand Down Expand Up @@ -355,8 +355,9 @@
packageReferences = (
2A28B6272EE5050C00A1E26B /* XCRemoteSwiftPackageReference "Defaults" */,
3ED0A7B72F21DF6800A58629 /* XCRemoteSwiftPackageReference "ZIPFoundation" */,
2AF9238C2F540B1300F467FD /* XCRemoteSwiftPackageReference "Scribe" */,
2AC4F62A2FDCAF7100CB2FBE /* XCRemoteSwiftPackageReference "Luminare" */,
2A504E802FFD8E5400694B30 /* XCRemoteSwiftPackageReference "Scribe" */,
2A504E852FFD8E7700694B30 /* XCRemoteSwiftPackageReference "Luminare" */,
2A504E882FFD8E8800694B30 /* XCRemoteSwiftPackageReference "Subsurface" */,
);
productRefGroup = A8E59C36297F5E9A0064D4BA /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -1064,17 +1065,25 @@
minimumVersion = 9.0.0;
};
};
2AC4F62A2FDCAF7100CB2FBE /* XCRemoteSwiftPackageReference "Luminare" */ = {
2A504E802FFD8E5400694B30 /* XCRemoteSwiftPackageReference "Scribe" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/MrKai77/Luminare";
repositoryURL = "https://github.com/SenpaiHunters/Scribe";
requirement = {
branch = main;
kind = branch;
};
};
2AF9238C2F540B1300F467FD /* XCRemoteSwiftPackageReference "Scribe" */ = {
2A504E852FFD8E7700694B30 /* XCRemoteSwiftPackageReference "Luminare" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/SenpaiHunters/Scribe";
repositoryURL = "https://github.com/mrkai77/Luminare";
requirement = {
branch = main;
kind = branch;
};
};
2A504E882FFD8E8800694B30 /* XCRemoteSwiftPackageReference "Subsurface" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/mrkai77/Subsurface";
requirement = {
branch = main;
kind = branch;
Expand All @@ -1091,34 +1100,35 @@
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
2A28492A2F22B4B700F6CE42 /* Scribe */ = {
2A03B7262FFD8ECC00B2243F /* Scribe */ = {
isa = XCSwiftPackageProductDependency;
package = 2A504E802FFD8E5400694B30 /* XCRemoteSwiftPackageReference "Scribe" */;
productName = Scribe;
};
2A03B7282FFD8EDC00B2243F /* Scribe */ = {
isa = XCSwiftPackageProductDependency;
package = 2A504E802FFD8E5400694B30 /* XCRemoteSwiftPackageReference "Scribe" */;
productName = Scribe;
};
2A28B6282EE5050C00A1E26B /* Defaults */ = {
isa = XCSwiftPackageProductDependency;
package = 2A28B6272EE5050C00A1E26B /* XCRemoteSwiftPackageReference "Defaults" */;
productName = Defaults;
};
2AC4F62B2FDCAF7100CB2FBE /* Luminare */ = {
isa = XCSwiftPackageProductDependency;
package = 2AC4F62A2FDCAF7100CB2FBE /* XCRemoteSwiftPackageReference "Luminare" */;
productName = Luminare;
};
2AE091C62F81A22800EF6149 /* Scribe */ = {
2A504E812FFD8E5400694B30 /* Scribe */ = {
isa = XCSwiftPackageProductDependency;
package = 2AF9238C2F540B1300F467FD /* XCRemoteSwiftPackageReference "Scribe" */;
package = 2A504E802FFD8E5400694B30 /* XCRemoteSwiftPackageReference "Scribe" */;
productName = Scribe;
};
2AF9238D2F540B1300F467FD /* Scribe */ = {
2A504E862FFD8E7700694B30 /* Luminare */ = {
isa = XCSwiftPackageProductDependency;
package = 2AF9238C2F540B1300F467FD /* XCRemoteSwiftPackageReference "Scribe" */;
productName = Scribe;
package = 2A504E852FFD8E7700694B30 /* XCRemoteSwiftPackageReference "Luminare" */;
productName = Luminare;
};
2AF9238F2F540B2200F467FD /* Scribe */ = {
2A504E892FFD8E8800694B30 /* Subsurface */ = {
isa = XCSwiftPackageProductDependency;
package = 2AF9238C2F540B1300F467FD /* XCRemoteSwiftPackageReference "Scribe" */;
productName = Scribe;
package = 2A504E882FFD8E8800694B30 /* XCRemoteSwiftPackageReference "Subsurface" */;
productName = Subsurface;
};
3ED0A7B82F21DF6800A58629 /* ZIPFoundation */ = {
isa = XCSwiftPackageProductDependency;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "2ACE2DE83043A6F600C4FECB"
BuildableName = "LoopTests.xctest"
BlueprintName = "LoopTests"
ReferencedContainer = "container:Loop.xcodeproj">
</BuildableReference>
</TestableReference>
Expand Down
6 changes: 6 additions & 0 deletions Loop.xcodeproj/xcshareddata/xcschemes/Loop.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "2ACE2DE83043A6F600C4FECB"
BuildableName = "LoopTests.xctest"
BlueprintName = "LoopTests"
ReferencedContainer = "container:Loop.xcodeproj">
</BuildableReference>
</TestableReference>
Expand Down Expand Up @@ -104,6 +105,11 @@
value = "1"
isEnabled = "NO">
</EnvironmentVariable>
<EnvironmentVariable
key = "LOOP_GESTURE_DEBUG_OVERLAY"
value = "1"
isEnabled = "NO">
</EnvironmentVariable>
</EnvironmentVariables>
</LaunchAction>
<ProfileAction
Expand Down
39 changes: 27 additions & 12 deletions Loop/Accent Color/WallpaperImageFetcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,19 @@
import SwiftUI

final class WallpaperImageFetcher {
/// Bundle identifier for the wallpaper window process
/// On macOS 27 and later, the wallpaper window is not owned by the dock but rather the window manager.
private static let wallpaperOwnerBundleIDs: Set<String> = [
"com.apple.dock",
"com.apple.WindowManager"
]

/// Takes a screenshot of the main display.
/// - Returns: An NSImage of the screenshot or nil if the operation fails.
///
/// This method attempts to capture the desktop wallpaper using three approaches:
/// 1. First, it tries to find and capture the Dock's wallpaper window directly that matches our screen dimensions
/// 2. If that fails, it tries to capture any wallpaper window from the Dock (even if not on our exact screen)
/// 1. First, it tries to find and capture the system wallpaper window directly that matches our screen dimensions
/// 2. If that fails, it tries to capture any system wallpaper window (even if not on our exact screen)
/// 3. As a last resort, it falls back to capturing the entire screen
///
/// The direct wallpaper capture is preferred as it gets only the wallpaper without desktop icons,
Expand All @@ -24,13 +31,13 @@ final class WallpaperImageFetcher {
let screen = NSScreen.screenWithMouse ?? NSScreen.main ?? NSScreen.screens[0]
let screenFrame = screen.displayBounds

// First try to get the wallpaper window from the Dock app that matches our screen dimensions
if let wallpaperImage = try? await captureWallpaperFromDock(screenFrame: screenFrame, matchFrame: true) {
// First try to get the wallpaper window from the system that matches our screen dimensions
if let wallpaperImage = try? await captureSystemWallpaper(screenFrame: screenFrame, matchFrame: true) {
return wallpaperImage
}

// Second fallback: try to get any wallpaper window from the Dock, regardless of screen dimensions
if let anyWallpaperImage = try? await captureWallpaperFromDock(screenFrame: screenFrame, matchFrame: false) {
// Second fallback: try to get any wallpaper window, regardless of screen dimensions
if let anyWallpaperImage = try? await captureSystemWallpaper(screenFrame: screenFrame, matchFrame: false) {
return anyWallpaperImage
}

Expand All @@ -42,22 +49,30 @@ final class WallpaperImageFetcher {
throw WallpaperProcessorError.screenshotFailed
}

/// Attempts to capture the wallpaper window from the Dock app.
/// Attempts to capture the wallpaper window from the Dock or WindowManager.
/// - Parameters:
/// - screenFrame: The frame of the screen to capture.
/// - matchFrame: Whether to match the exact screen frame dimensions or get any wallpaper window.
/// - Returns: An NSImage of the wallpaper or nil if the operation fails.
///
/// This approach uses window capturing APIs to specifically target the Dock's wallpaper window.
/// This approach uses window capturing APIs to specifically target the systems wallpaper window.
/// It requires appropriate permissions, but provides the cleanest capture of just the wallpaper.
/// The method identifies the wallpaper window by filtering window properties from the Dock process.
private func captureWallpaperFromDock(screenFrame: CGRect, matchFrame: Bool) async throws -> NSImage? {
// Get all windows and filter for the Dock's wallpaper windows
/// The method identifies the wallpaper window by filtering window properties from the Dock/WindowManager process.
private func captureSystemWallpaper(screenFrame: CGRect, matchFrame: Bool) async throws -> NSImage? {
// Get all windows and filter for the wallpaper windows
let windows = CGWindowListCopyWindowInfo(.optionAll, kCGNullWindowID) as! [[CFString: Any]]
var wallpaperWindows = windows
.filter { $0[kCGWindowOwnerName] as? String == "Dock" }
.filter { window in
guard let pid = window[kCGWindowOwnerPID] as? pid_t,
let bundleIdentifier = NSRunningApplication(processIdentifier: pid)?.bundleIdentifier
else {
return false
}
return Self.wallpaperOwnerBundleIDs.contains(bundleIdentifier)
}
.filter { ($0[kCGWindowName] as? String ?? "").contains("Wallpaper") }
.filter { $0[kCGWindowIsOnscreen] as? Int == 1 }
.filter { ($0[kCGWindowLayer] as? Int ?? 0) <= CGWindowLevelForKey(.desktopWindow) }

// Apply additional frame filtering only if matchFrame is true
if matchFrame {
Expand Down
2 changes: 1 addition & 1 deletion Loop/App/AppDelegate+UNNotifications.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
private static func registerNotificationCategories() {
let setIconAction = UNNotificationAction(
identifier: "setIconAction",
title: String(localized: "Set Current Icon", comment: "Label for a button that lets the user set their icon for Loop"),
title: String(localized: "Use This Icon", comment: "Notification action button that sets the newly unlocked icon as Loop's icon"),
options: .destructive
)
let notificationCategory = UNNotificationCategory(
Expand Down
10 changes: 6 additions & 4 deletions Loop/App/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ final class AppDelegate: NSObject, NSApplicationDelegate {

func applicationDidFinishLaunching(_: Notification) {
configureLogging()
DefaultsiCloudSyncRegistrar.register()

// Register before broadcasting so other instances can receive the signal
registerTerminateObserver()

Task {
let dataPatcherTask = Task { @MainActor in
await Defaults.iCloud.waitForSyncCompletion()
DataPatcher.run()
}

// Show settings window only if not launched as login item AND startHidden is disabled
Expand All @@ -43,7 +45,6 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
SettingsWindowManager.shared.close()
}

DataPatcher.run()
IconManager.refreshCurrentAppIcon()
LaunchAtLoginManager.shared.start()

Expand All @@ -58,10 +59,11 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
andEventID: AEEventID(kAEGetURL)
)

let stalePIDs = broadcastTerminateToOtherInstances()

// Wait for other instances to fully exit before installing event taps to prevent conflicts
Task { @MainActor in
await dataPatcherTask.value

let stalePIDs = broadcastTerminateToOtherInstances()
await waitForInstancesToExit(pids: stalePIDs, timeout: .seconds(3))
LoopManager.shared.start()
WindowDragManager.shared.addObservers()
Expand Down
29 changes: 29 additions & 0 deletions Loop/App/DataPatcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,28 @@ enum DataPatcher {
Defaults[.hideOnNoSelection] = Defaults[.hideUntilDirectionIsChosen]
Defaults.reset(.hideUntilDirectionIsChosen)
}

runPatchIfNeeded(patch: .splitRadialMenuPresentationPolicies, initialPatches: initialPatches) {
let hideOnNoSelection = Defaults[.hideOnNoSelection] || Defaults[.hideUntilDirectionIsChosen]
Defaults[.hideOnNoSelectionForKeybinds] = hideOnNoSelection
Defaults[.hideOnNoSelectionForGestures] = hideOnNoSelection
Defaults.reset(.hideOnNoSelection)
Defaults.reset(.hideUntilDirectionIsChosen)
}

runPatchIfNeeded(patch: .keepCustomizedPreviewBackground, initialPatches: initialPatches) {
// Users who changed the blur or accent opacity keep the custom background
let blurKey = Defaults.Keys.previewBackgroundEnableBlur
let accentKey = Defaults.Keys.previewBackgroundAccentOpacity
let customizedBlur = UserDefaults.standard.object(forKey: blurKey.name) != nil
&& Defaults[blurKey] != blurKey.defaultValue
let customizedAccent = UserDefaults.standard.object(forKey: accentKey.name) != nil
&& Defaults[accentKey] != accentKey.defaultValue

if customizedBlur || customizedAccent {
Defaults[.previewBackgroundStyle] = .custom
}
}
}

private static func runPatchIfNeeded(patch: Patches, initialPatches: Patches, with callback: () -> ()) {
Expand All @@ -62,6 +84,12 @@ enum DataPatcher {

/// Key was renamed from `hideUntilDirectionIsChosen` to `hideOnNoSelection` with slightly different behavior
static let changeTohideOnNoSelection = Self(rawValue: 1 << 2)

/// Split the global no-selection setting into trigger-specific presentation policies.
static let splitRadialMenuPresentationPolicies = Self(rawValue: 1 << 3)

/// The preview background now defaults to the system style, so users who customized it keep the custom style.
static let keepCustomizedPreviewBackground = Self(rawValue: 1 << 4)
}
}

Expand All @@ -77,5 +105,6 @@ private extension Defaults.Keys {
static let processWallpaper = Key<Bool>("processWallpaper", default: false)

// IndicatorService
static let hideOnNoSelection = Key<Bool>("hideOnNoSelection", default: false)
static let hideUntilDirectionIsChosen = Key<Bool>("hideUntilDirectionIsChosen", default: false)
}
Loading
Loading