From 0ad9e3cdd9b2b162a400620be5938a89d8c21330 Mon Sep 17 00:00:00 2001 From: Kai Azim Date: Sat, 14 Sep 2024 16:16:06 -0600 Subject: [PATCH 1/5] =?UTF-8?q?=E2=9A=A1=20Replace=20order=20of=20initiali?= =?UTF-8?q?zation=20in=20`AppDelegate`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make it so that the accessibility request will show in front of Loop's settings window. --- Loop/AppDelegate.swift | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Loop/AppDelegate.swift b/Loop/AppDelegate.swift index 78ed0204..eb36304e 100644 --- a/Loop/AppDelegate.swift +++ b/Loop/AppDelegate.swift @@ -27,16 +27,6 @@ class AppDelegate: NSObject, NSApplicationDelegate { await Defaults.iCloud.waitForSyncCompletion() } - // Check & ask for accessibility access - AccessibilityManager.requestAccess() - UNUserNotificationCenter.current().delegate = self - - AppDelegate.requestNotificationAuthorization() - - IconManager.refreshCurrentAppIcon() - AppDelegate.loopManager.start() - AppDelegate.windowDragManager.addObservers() - if !launchedAsLoginItem { LuminareManager.open() } else { @@ -45,6 +35,17 @@ class AppDelegate: NSObject, NSApplicationDelegate { NSApp.setActivationPolicy(.accessory) } } + + IconManager.refreshCurrentAppIcon() + AppDelegate.loopManager.start() + AppDelegate.windowDragManager.addObservers() + + UNUserNotificationCenter.current().delegate = self + AppDelegate.requestNotificationAuthorization() + + DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { + AccessibilityManager.requestAccess() + } } func applicationShouldTerminateAfterLastWindowClosed(_: NSApplication) -> Bool { From a8ae4247f075781d605b05e9fb04e4ace4680a4c Mon Sep 17 00:00:00 2001 From: Kai Azim Date: Sat, 14 Sep 2024 16:16:58 -0600 Subject: [PATCH 2/5] =?UTF-8?q?=E2=8F=AA=EF=B8=8F=20Restore=20window=20act?= =?UTF-8?q?ion=20icon=20behavior=20to=20that=20of=201.1.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Loop/Window Management/WindowAction+Image.swift | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/Loop/Window Management/WindowAction+Image.swift b/Loop/Window Management/WindowAction+Image.swift index 3543a536..8e428b8d 100644 --- a/Loop/Window Management/WindowAction+Image.swift +++ b/Loop/Window Management/WindowAction+Image.swift @@ -70,16 +70,6 @@ struct IconView: View { .font(.system(size: 8)) .fontWeight(.bold) .frame(width: size.width, height: size.height) - } else if action.direction == .cycle, action.cycle?.first == nil { - Image(._18PxRepeat4) - .resizable() - .aspectRatio(contentMode: .fit) - .frame(width: size.width, height: size.height) - } else if action.direction == .custom, frame == .zero { - Image(._18PxSliders) - .resizable() - .aspectRatio(contentMode: .fit) - .frame(width: size.width, height: size.height) } else { ZStack { RoundedRectangle(cornerRadius: outerCornerRadius - inset) From 74efe7e4a47bcc1dd39f65916cc7f7fd1928e209 Mon Sep 17 00:00:00 2001 From: Kai Azim Date: Sat, 14 Sep 2024 16:17:32 -0600 Subject: [PATCH 3/5] =?UTF-8?q?=E2=9C=A8=20Blur=20`ScreenView`=20when=20si?= =?UTF-8?q?ze=20mode=20is=20not=20set=20to=20custom?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CustomActionConfigurationView.swift | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Loop/Luminare/Settings/Keybindings/CustomActionConfigurationView.swift b/Loop/Luminare/Settings/Keybindings/CustomActionConfigurationView.swift index 66fa5846..32d5fa8c 100644 --- a/Loop/Luminare/Settings/Keybindings/CustomActionConfigurationView.swift +++ b/Loop/Luminare/Settings/Keybindings/CustomActionConfigurationView.swift @@ -43,19 +43,19 @@ struct CustomActionConfigurationView: View { } var body: some View { - ScreenView { + ScreenView(blurred: .constant(action.sizeMode != .custom)) { GeometryReader { geo in - let frame = action.getFrame(window: nil, bounds: CGRect(origin: .zero, size: geo.size), disablePadding: true) - let _ = print(frame) ZStack { if action.sizeMode == .custom { + let frame = action.getFrame(window: nil, bounds: CGRect(origin: .zero, size: geo.size), disablePadding: true) + blurredWindow() .frame(width: frame.width, height: frame.height) .offset(x: frame.origin.x, y: frame.origin.y) + .animation(LuminareSettingsWindow.animation, value: frame) } } .frame(width: geo.size.width, height: geo.size.height, alignment: .topLeading) - .animation(LuminareSettingsWindow.animation, value: frame) } } .onChange(of: action) { windowAction = $0 } @@ -303,9 +303,9 @@ struct CustomActionConfigurationView: View { @ViewBuilder private func blurredWindow() -> some View { VisualEffectView(material: .hudWindow, blendingMode: .withinWindow) .overlay { - RoundedRectangle(cornerRadius: 5) - .strokeBorder(.white.opacity(0.1), lineWidth: 2) + RoundedRectangle(cornerRadius: 12 - 5) + .strokeBorder(Color.getLoopAccent(tone: .normal), lineWidth: 2) } - .clipShape(RoundedRectangle(cornerRadius: 5)) + .clipShape(RoundedRectangle(cornerRadius: 12 - 5)) } } From e5540963f82ce74ac5de9d407775d65f0101846f Mon Sep 17 00:00:00 2001 From: Kai Azim Date: Sat, 14 Sep 2024 17:03:32 -0600 Subject: [PATCH 4/5] =?UTF-8?q?=F0=9F=92=84=20#552=20Remove=20edit=20butto?= =?UTF-8?q?n=20to=20reduce=20confusion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit User can now click on the keybind title/icon itself to edit it. --- .../Settings/Keybindings/KeybindingItem.swift | 74 ++++++++++++++----- 1 file changed, 57 insertions(+), 17 deletions(-) diff --git a/Loop/Luminare/Settings/Keybindings/KeybindingItem.swift b/Loop/Luminare/Settings/Keybindings/KeybindingItem.swift index cb3bb19b..ed46a8e8 100644 --- a/Loop/Luminare/Settings/Keybindings/KeybindingItem.swift +++ b/Loop/Luminare/Settings/Keybindings/KeybindingItem.swift @@ -94,11 +94,6 @@ struct KeybindingItemView: View { } .help("Customize what this keybind cycles through.") } - - if isHovering { - directionPicker() - .help("Customize this keybind's action.") - } } .font(.title3) .foregroundStyle(isHovering ? .primary : .secondary) @@ -137,6 +132,7 @@ struct KeybindingItemView: View { .fixedSize() } } + .animation(LuminareSettingsWindow.animation, value: keybind) .padding(.horizontal, 12) .onAppear { computeSearchResults() @@ -163,21 +159,26 @@ struct KeybindingItemView: View { } func label() -> some View { - HStack(spacing: 0) { - HStack(spacing: 8) { - IconView(action: $keybind) - - Text(keybind.getName()) - .lineLimit(1) - .contentTransition(.numericText()) - .animation(LuminareSettingsWindow.animation, value: keybind) - } + Button { + isPresented.toggle() + } label: { + HStack(spacing: 0) { + HStack(spacing: 8) { + IconView(action: $keybind) + + Text(keybind.getName()) + .lineLimit(1) + .contentTransition(.numericText()) + } - if let info = keybind.direction.infoView { - info + if let info = keybind.direction.infoView { + info + } } + .fixedSize(horizontal: false, vertical: true) } - .fixedSize(horizontal: false, vertical: true) + .buttonStyle(CompactButtonStyle()) + .help("Customize this keybind's action.") } func directionPicker() -> some View { @@ -225,3 +226,42 @@ struct KeybindingItemView: View { } } } + +private struct CompactButtonStyle: ButtonStyle { + @Environment(\.hoveringOverLuminareItem) var hoveringOverLuminareItem + @Environment(\.isEnabled) private var isEnabled: Bool + let elementMinHeight: CGFloat = 25 + @State var isHovering: Bool = false + let cornerRadius: CGFloat = 6 + + public func makeBody(configuration: Configuration) -> some View { + configuration.label + .background { + if configuration.isPressed || isHovering || hoveringOverLuminareItem { + backgroundForState(isPressed: configuration.isPressed) + .background { + RoundedRectangle(cornerRadius: cornerRadius) + .strokeBorder(.quaternary, lineWidth: 1) + } + .clipShape(.rect(cornerRadius: cornerRadius)) + .padding(-4) + } + } + .onHover { isHovering = $0 } + .animation(LuminareSettingsWindow.fastAnimation, value: [isHovering, hoveringOverLuminareItem]) + .frame(minHeight: elementMinHeight) + .opacity(isEnabled ? 1 : 0.5) + } + + private func backgroundForState(isPressed: Bool) -> some View { + Group { + if isPressed { + Rectangle().foregroundStyle(.quaternary) + } else if isHovering { + Rectangle().foregroundStyle(.quaternary.opacity(0.6)) + } else { + Rectangle().foregroundStyle(.quinary.opacity(0.5)) + } + } + } +} From 0be86ea8a0f3c1ac7cf5e14340f20000c0ff6eb3 Mon Sep 17 00:00:00 2001 From: Kai Azim Date: Sat, 14 Sep 2024 17:15:47 -0600 Subject: [PATCH 5/5] =?UTF-8?q?=F0=9F=90=9E=20Fix=20bug=20where=20Loop=20c?= =?UTF-8?q?rashes=20when=20resizing=20self?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Loop/Window Management/WindowEngine.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Loop/Window Management/WindowEngine.swift b/Loop/Window Management/WindowEngine.swift index 817bde91..3d6246bf 100644 --- a/Loop/Window Management/WindowEngine.swift +++ b/Loop/Window Management/WindowEngine.swift @@ -63,8 +63,8 @@ enum WindowEngine { let animate = Defaults[.animateWindowResizes] && !enhancedUI WindowRecords.record(window, action) - if window.nsRunningApplication == NSRunningApplication.current, - let window = NSApp.keyWindow { + if window.nsRunningApplication?.bundleIdentifier == Bundle.main.bundleIdentifier, + let window = NSApp.keyWindow ?? NSApp.windows.first { var newFrame = targetFrame newFrame.size = window.frame.size