Update: Support for 2K resolution

This commit is contained in:
Hariharan Mudaliar 2026-03-05 13:54:11 +05:30
commit 5b489ee90d
No known key found for this signature in database
GPG key ID: 025583EB0BE5640E
5 changed files with 42 additions and 9 deletions

View file

@ -369,10 +369,13 @@ class AppDelegate: NSObject, NSApplicationDelegate {
private func resizeWindow(_ window: NSWindow, on screen: NSScreen, to size: CGSize, animated: Bool) { private func resizeWindow(_ window: NSWindow, on screen: NSScreen, to size: CGSize, animated: Bool) {
let screenFrame = screen.frame let screenFrame = screen.frame
// Clamp width to screen width so the notch never extends beyond screen edges on scaled displays
let clampedWidth = min(size.width, screenFrame.width)
let clampedHeight = min(size.height, screenFrame.height)
let centerX = screenFrame.midX let centerX = screenFrame.midX
let newX = centerX - (size.width / 2) let newX = centerX - (clampedWidth / 2)
let newY = screenFrame.origin.y + screenFrame.height - size.height let newY = screenFrame.origin.y + screenFrame.height - clampedHeight
let targetFrame = NSRect(x: newX, y: newY, width: size.width, height: size.height) let targetFrame = NSRect(x: newX, y: newY, width: clampedWidth, height: clampedHeight)
window.setFrame(targetFrame, display: true) window.setFrame(targetFrame, display: true)
} }

View file

@ -53,10 +53,11 @@ struct DynamicIslandHeader: View {
} }
if vm.notchState == .open && !Defaults[.enableMinimalisticUI] { if vm.notchState == .open && !Defaults[.enableMinimalisticUI] {
let spacerWidth = min(vm.closedNotchSize.width, 300)
Rectangle() Rectangle()
.fill(NSScreen.screens .fill(NSScreen.screens
.first(where: { $0.localizedName == coordinator.selectedScreen })?.safeAreaInsets.top ?? 0 > 0 ? .black : .clear) .first(where: { $0.localizedName == coordinator.selectedScreen })?.safeAreaInsets.top ?? 0 > 0 ? .black : .clear)
.frame(width: vm.closedNotchSize.width) .frame(width: spacerWidth)
.mask { .mask {
NotchShape() NotchShape()
} }

View file

@ -32,7 +32,8 @@ struct MusicPlayerView: View {
var body: some View { var body: some View {
HStack(alignment: .top, spacing: 12) { HStack(alignment: .top, spacing: 12) {
AlbumArtView(vm: vm, albumArtNamespace: albumArtNamespace).padding(.all, 5) AlbumArtView(vm: vm, albumArtNamespace: albumArtNamespace)
.padding(.all, 5)
MusicControlsView() MusicControlsView()
.frame(maxWidth: .infinity, alignment: .leading) .frame(maxWidth: .infinity, alignment: .leading)
.drawingGroup() .drawingGroup()

View file

@ -3469,7 +3469,9 @@ struct Appearance: View {
@State private var speed: CGFloat = 1.0 @State private var speed: CGFloat = 1.0
private var notchWidthRange: ClosedRange<Double> { private var notchWidthRange: ClosedRange<Double> {
Double(currentRecommendedMinimumNotchWidth())...900 let minW = Double(currentRecommendedMinimumNotchWidth())
let maxW = min(900, Double(maxAllowedNotchWidth()))
return minW...max(minW, maxW)
} }
private var defaultOpenNotchWidth: CGFloat { private var defaultOpenNotchWidth: CGFloat {
currentRecommendedMinimumNotchWidth() currentRecommendedMinimumNotchWidth()

View file

@ -30,10 +30,31 @@ let batterySneakSize: CGSize = .init(width: 160, height: 1)
var openNotchSize: CGSize { var openNotchSize: CGSize {
let storedWidth = Defaults[.openNotchWidth] let storedWidth = Defaults[.openNotchWidth]
let minWidth = currentRecommendedMinimumNotchWidth() let minWidth = currentRecommendedMinimumNotchWidth()
let width = max(storedWidth, minWidth) let maxWidth = maxAllowedNotchWidth()
let width = min(max(storedWidth, minWidth), maxWidth)
return .init(width: width, height: 200) return .init(width: width, height: 200)
} }
/// Maximum notch width based on the current screen's point width.
/// Prevents the notch from extending beyond the screen on scaled displays.
func maxAllowedNotchWidth(for screenName: String? = nil) -> CGFloat {
let screen: NSScreen?
if let screenName {
screen = NSScreen.screens.first { $0.localizedName == screenName }
} else {
screen = NSScreen.main
}
guard let screenWidth = screen?.frame.width, screenWidth > 0 else {
return 900
}
return max(screenWidth - 60, 400)
}
/// Convenience for the main screen.
func maxAllowedNotchWidth() -> CGFloat {
maxAllowedNotchWidth(for: nil)
}
// MARK: - Tab-Based Notch Width // MARK: - Tab-Based Notch Width
/// Counts the number of currently enabled standard notch tabs. /// Counts the number of currently enabled standard notch tabs.
@ -87,12 +108,17 @@ func currentRecommendedMinimumNotchWidth() -> CGFloat {
} }
/// Enforces the minimum notch width based on current tab count. /// Enforces the minimum notch width based on current tab count.
/// Also clamps to screen width so the notch never exceeds the display.
/// Only adjusts when not in minimalistic mode. /// Only adjusts when not in minimalistic mode.
func enforceMinimumNotchWidth() { func enforceMinimumNotchWidth() {
guard !Defaults[.enableMinimalisticUI] else { return } guard !Defaults[.enableMinimalisticUI] else { return }
let minWidth = currentRecommendedMinimumNotchWidth() let minWidth = currentRecommendedMinimumNotchWidth()
if Defaults[.openNotchWidth] < minWidth { let maxWidth = maxAllowedNotchWidth()
Defaults[.openNotchWidth] = minWidth var width = Defaults[.openNotchWidth]
if width < minWidth { width = minWidth }
if width > maxWidth { width = maxWidth }
if Defaults[.openNotchWidth] != width {
Defaults[.openNotchWidth] = width
} }
} }
private let minimalisticBaseOpenNotchSize: CGSize = .init(width: 420, height: 180) private let minimalisticBaseOpenNotchSize: CGSize = .init(width: 420, height: 180)