mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-28 15:44:32 +00:00
BugFix
This commit is contained in:
parent
ab13b91d20
commit
eac9f69977
3 changed files with 63 additions and 16 deletions
|
|
@ -327,7 +327,7 @@
|
||||||
"CPU Usage" : {
|
"CPU Usage" : {
|
||||||
|
|
||||||
},
|
},
|
||||||
"Current custom timer: %@" : {
|
"Current custom timer:" : {
|
||||||
|
|
||||||
},
|
},
|
||||||
"Current History" : {
|
"Current History" : {
|
||||||
|
|
@ -1219,7 +1219,7 @@
|
||||||
"unmuted" : {
|
"unmuted" : {
|
||||||
|
|
||||||
},
|
},
|
||||||
"Update" : {
|
"Update Timer" : {
|
||||||
|
|
||||||
},
|
},
|
||||||
"Upgrade to Pro" : {
|
"Upgrade to Pro" : {
|
||||||
|
|
|
||||||
|
|
@ -75,13 +75,48 @@ class ClipboardPanel: NSPanel {
|
||||||
let screenFrame = screen.visibleFrame
|
let screenFrame = screen.visibleFrame
|
||||||
let panelFrame = frame
|
let panelFrame = frame
|
||||||
|
|
||||||
// Position at top center of screen (near where the notch would be)
|
// Check if we have a saved position
|
||||||
|
if let savedPosition = getSavedPosition() {
|
||||||
|
// Validate saved position is still on screen
|
||||||
|
let savedFrame = NSRect(origin: savedPosition, size: panelFrame.size)
|
||||||
|
if screenFrame.intersects(savedFrame) {
|
||||||
|
setFrameOrigin(savedPosition)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default to center of screen (not top center)
|
||||||
let xPosition = (screenFrame.width - panelFrame.width) / 2 + screenFrame.minX
|
let xPosition = (screenFrame.width - panelFrame.width) / 2 + screenFrame.minX
|
||||||
let yPosition = screenFrame.maxY - panelFrame.height - 10 // 10px from top
|
let yPosition = (screenFrame.height - panelFrame.height) / 2 + screenFrame.minY
|
||||||
|
|
||||||
setFrameOrigin(NSPoint(x: xPosition, y: yPosition))
|
setFrameOrigin(NSPoint(x: xPosition, y: yPosition))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func getSavedPosition() -> NSPoint? {
|
||||||
|
let defaults = UserDefaults.standard
|
||||||
|
let x = defaults.double(forKey: "clipboardPanelPositionX")
|
||||||
|
let y = defaults.double(forKey: "clipboardPanelPositionY")
|
||||||
|
|
||||||
|
// Check if we have valid saved coordinates (not default 0.0)
|
||||||
|
if x != 0.0 || y != 0.0 {
|
||||||
|
return NSPoint(x: x, y: y)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
private func saveCurrentPosition() {
|
||||||
|
let currentOrigin = frame.origin
|
||||||
|
let defaults = UserDefaults.standard
|
||||||
|
defaults.set(currentOrigin.x, forKey: "clipboardPanelPositionX")
|
||||||
|
defaults.set(currentOrigin.y, forKey: "clipboardPanelPositionY")
|
||||||
|
}
|
||||||
|
|
||||||
|
override func setFrameOrigin(_ point: NSPoint) {
|
||||||
|
super.setFrameOrigin(point)
|
||||||
|
// Save position whenever it changes (user dragging)
|
||||||
|
saveCurrentPosition()
|
||||||
|
}
|
||||||
|
|
||||||
func positionNearMouse() {
|
func positionNearMouse() {
|
||||||
let mouseLocation = NSEvent.mouseLocation
|
let mouseLocation = NSEvent.mouseLocation
|
||||||
let panelFrame = frame
|
let panelFrame = frame
|
||||||
|
|
|
||||||
|
|
@ -1324,8 +1324,8 @@ struct TimerSettings: View {
|
||||||
Text("Custom Timer Duration")
|
Text("Custom Timer Duration")
|
||||||
.font(.headline)
|
.font(.headline)
|
||||||
|
|
||||||
HStack(spacing: 16) {
|
HStack(spacing: 20) {
|
||||||
VStack {
|
VStack(alignment: .center, spacing: 8) {
|
||||||
Text("Minutes")
|
Text("Minutes")
|
||||||
.font(.system(size: 14, weight: .medium))
|
.font(.system(size: 14, weight: .medium))
|
||||||
.foregroundStyle(.secondary)
|
.foregroundStyle(.secondary)
|
||||||
|
|
@ -1336,10 +1336,10 @@ struct TimerSettings: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.pickerStyle(.menu)
|
.pickerStyle(.menu)
|
||||||
.frame(width: 80, height: 40)
|
.frame(width: 100)
|
||||||
}
|
}
|
||||||
|
|
||||||
VStack {
|
VStack(alignment: .center, spacing: 8) {
|
||||||
Text("Seconds")
|
Text("Seconds")
|
||||||
.font(.system(size: 14, weight: .medium))
|
.font(.system(size: 14, weight: .medium))
|
||||||
.foregroundStyle(.secondary)
|
.foregroundStyle(.secondary)
|
||||||
|
|
@ -1350,20 +1350,32 @@ struct TimerSettings: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.pickerStyle(.menu)
|
.pickerStyle(.menu)
|
||||||
.frame(width: 80, height: 40)
|
.frame(width: 100)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.frame(maxWidth: .infinity)
|
||||||
|
|
||||||
HStack {
|
VStack(alignment: .leading, spacing: 8) {
|
||||||
Text("Current custom timer: \(customTimerDisplayText)")
|
HStack {
|
||||||
.foregroundStyle(.secondary)
|
Text("Current custom timer:")
|
||||||
Spacer()
|
.foregroundStyle(.secondary)
|
||||||
Button("Update") {
|
Text(customTimerDisplayText)
|
||||||
customTimerDuration = Double(customMinutes * 60 + customSeconds)
|
.foregroundStyle(.primary)
|
||||||
|
.fontWeight(.medium)
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
|
||||||
|
HStack {
|
||||||
|
Spacer()
|
||||||
|
Button("Update Timer") {
|
||||||
|
customTimerDuration = Double(customMinutes * 60 + customSeconds)
|
||||||
|
}
|
||||||
|
.disabled(customMinutes == 0 && customSeconds == 0)
|
||||||
|
.buttonStyle(.borderedProminent)
|
||||||
}
|
}
|
||||||
.disabled(customMinutes == 0 && customSeconds == 0)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.padding(.vertical, 8)
|
||||||
} header: {
|
} header: {
|
||||||
Text("Custom Timer")
|
Text("Custom Timer")
|
||||||
} footer: {
|
} footer: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue