Skip to content
Merged
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
Empty file removed .gitmodules
Empty file.
13 changes: 13 additions & 0 deletions Loop/Extensions/CGGeometry+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,19 @@ extension CGSize {
height: height
)
}

func fitting(aspectRatio: CGFloat) -> CGSize {
guard width > 0, height > 0, aspectRatio > 0 else {
return self
}

let sizeAspectRatio = width / height
if sizeAspectRatio > aspectRatio {
return CGSize(width: height * aspectRatio, height: height)
} else {
return CGSize(width: width, height: width / aspectRatio)
}
}
}

extension CGRect {
Expand Down
2 changes: 1 addition & 1 deletion Loop/Settings Window/Loop/AboutConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ struct AboutConfigurationView: View {
Button {
Task {
await updater.fetchLatestInfo(bypassUpdatesEnabled: true)

switch updater.updateState {
case .available:
await updater.showUpdateWindowIfEligible()
Expand Down
4 changes: 2 additions & 2 deletions Loop/Settings Window/Loop/ExcludedAppsConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ struct ExcludedAppsConfigurationView: View {
Button("Add") {
showAppChooser()
}

Button("Remove", role: .destructive) {
excludedApps.removeAll { selectedApps.contains($0) }
}
.disabled(selectedApps.isEmpty)
.keyboardShortcut(.delete)
}
.luminareRoundingBehavior(top: true)

LuminareList(
items: $excludedApps,
selection: $selectedApps,
Expand Down
18 changes: 9 additions & 9 deletions Loop/Settings Window/Theming/AccentColorConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,22 @@ struct AccentColorConfigurationView: View {
LuminareForm {
LuminareSection {
accentColorModePicker

LuminareToggle("Gradient", isOn: $useGradient)

if accentColorMode == .wallpaper {
syncWallpaperButton
}
}

if accentColorMode == .custom {
LuminareSection(String(localized: "Color", comment: "Section header shown in settings")) {
LuminareColorPicker(
color: $customAccentColor,
style: .textFieldWithColorWell()
)
.luminareRoundingBehavior(top: true, bottom: true)

if useGradient {
LuminareColorPicker(
color: $gradientColor,
Expand All @@ -57,7 +57,7 @@ struct AccentColorConfigurationView: View {
}
.animation(luminareAnimation, value: accentColorMode)
}

private var accentColorModePicker: some View {
LuminarePicker(
elements: AccentColorOption.allCases,
Expand All @@ -66,10 +66,10 @@ struct AccentColorConfigurationView: View {
) { option in
VStack(spacing: 6) {
Spacer()

option.image
Text(option.text)

Spacer()
}
.font(.title3)
Expand All @@ -78,12 +78,12 @@ struct AccentColorConfigurationView: View {
.luminareRoundingBehavior(top: true)
.environment(\.appearsActive, true) // Keep on active state to show accent color
}

private var syncWallpaperButton: some View {
Button(action: syncWallpaper) {
HStack {
Text("Sync Wallpaper")

if didSyncWallpaper {
Image(systemName: "checkmark")
.foregroundStyle(.green)
Expand Down
4 changes: 2 additions & 2 deletions Loop/Settings Window/Theming/IconConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ struct IconConfigurationView: View {
get: { IconManager.currentAppIcon },
set: {
currentIcon = $0.assetName

Task {
IconManager.refreshCurrentAppIcon()
}
Expand All @@ -131,7 +131,7 @@ struct IconConfigurationView: View {
}
.luminareRoundingBehavior(top: true, bottom: true)
}

LuminareSection(String(localized: "Options", comment: "Section header shown in settings")) {
LuminareToggle("Show in dock", isOn: $showDockIcon)
LuminareToggle(
Expand Down
16 changes: 8 additions & 8 deletions Loop/Settings Window/Theming/PreviewConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct PreviewConfigurationView: View {
},
set: {
previewVisibility = $0

if !previewVisibility {
moveCursorWithWindow = false
}
Expand All @@ -46,7 +46,7 @@ struct PreviewConfigurationView: View {
}
.animation(luminareAnimation, value: previewVisibility)
}

LuminareSlider(
"Padding",
value: $previewPadding.doubleBinding,
Expand All @@ -56,7 +56,7 @@ struct PreviewConfigurationView: View {
clampsLower: true,
suffix: Text("px", comment: "Unit symbol: pixels")
)

// On macOS Sequoia and below, simply show the corner radius slider.
if #unavailable(macOS 26) {
LuminareSlider(
Expand All @@ -69,7 +69,7 @@ struct PreviewConfigurationView: View {
suffix: Text("px", comment: "Unit symbol: pixels")
)
}

LuminareSlider(
"Border thickness",
value: $previewBorderThickness.doubleBinding,
Expand All @@ -80,7 +80,7 @@ struct PreviewConfigurationView: View {
suffix: Text("px", comment: "Unit symbol: pixels")
)
}

// On macOS Tahoe and above, Loop has the ability to read the selected window's corner radius.
// So display it in a separate section, with the option to configure this functionality.
if #available(macOS 26, *) {
Expand All @@ -89,7 +89,7 @@ struct PreviewConfigurationView: View {
"Prioritize selected window’s corner radius",
isOn: $previewUseWindowCornerRadius
)

LuminareSlider(
previewUseWindowCornerRadius ? "Default corner radius" : "Corner radius",
value: $previewCornerRadius.doubleBinding,
Expand All @@ -102,10 +102,10 @@ struct PreviewConfigurationView: View {
}
.animation(luminareAnimation, value: previewUseWindowCornerRadius)
}

LuminareSection("Background") {
LuminareToggle("Enable blur", isOn: $previewBackgroundEnableBlur)

LuminareSlider(
"Accent opacity",
value: $previewBackgroundAccentOpacity.doubleBinding,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import SwiftUI
struct RadialMenuConfigurationView: View {
@EnvironmentObject private var windowModel: SettingsWindowManager
@Environment(\.luminareAnimation) private var luminareAnimation

@Default(.radialMenuVisibility) private var radialMenuVisibility
@Default(.radialMenuCornerRadius) private var radialMenuCornerRadius
@Default(.radialMenuThickness) private var radialMenuThickness
Expand All @@ -24,7 +24,7 @@ struct RadialMenuConfigurationView: View {
LuminareForm {
LuminareSection {
LuminareToggle("Radial menu", isOn: $radialMenuVisibility)

if radialMenuVisibility {
LuminareSlider(
"Corner radius",
Expand All @@ -40,7 +40,7 @@ struct RadialMenuConfigurationView: View {
radialMenuThickness = radialMenuCornerRadius - 1
}
}

LuminareSlider(
"Thickness",
value: $radialMenuThickness.doubleBinding,
Expand All @@ -58,7 +58,7 @@ struct RadialMenuConfigurationView: View {
}
}
.animation(luminareAnimation, value: radialMenuVisibility)

if enableRadialMenuCustomization {
LuminareSection(
String(localized: "Actions", comment: "Header for radial menu section shown in settings"),
Expand All @@ -68,15 +68,15 @@ struct RadialMenuConfigurationView: View {
Button("Add") {
radialMenuActions.insert(.custom(.init(.noAction)), at: 0)
}

Button("Remove", role: .destructive) {
radialMenuActions.removeAll(where: selectedRadialMenuActions.contains)
}
.disabled(selectedRadialMenuActions.isEmpty)
.keyboardShortcut(.delete)
}
.luminareRoundingBehavior(top: true)

LuminareList(
items: $radialMenuActions,
selection: $selectedRadialMenuActions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ struct PaddingConfiguration: Codable, Defaults.Serializable, Hashable {
if let resolvedWindowProperties, !resolvedWindowProperties.isResizable {
let centeredFrame = resolvedWindowProperties.frame.size
.center(inside: result)
.pushInside(bounds)
Comment thread
mrkai77 marked this conversation as resolved.

return centeredFrame
}
Expand Down
Loading
Loading