Skip to content

Commit

Permalink
window buffer setting
Browse files Browse the repository at this point in the history
  • Loading branch information
ejbills committed Jun 25, 2024
1 parent 1a3571d commit 558145e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
Binary file not shown.
2 changes: 1 addition & 1 deletion DockDoor/Views/HoverWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class HoverWindow: NSWindow {
}

// Ensure the hover window stays within the dock screen bounds
xPosition = max(screenFrame.minX, min(xPosition, screenFrame.maxX - newHoverWindowSize.width))
xPosition = max(screenFrame.minX, min(xPosition, screenFrame.maxX - newHoverWindowSize.width)) + Defaults[.windowPadding]
yPosition = max(screenFrame.minY, min(yPosition, screenFrame.maxY - newHoverWindowSize.height))

position = CGPoint(x: xPosition, y: yPosition)
Expand Down
5 changes: 5 additions & 0 deletions DockDoor/Views/Settings/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,14 @@ struct SettingsView: View {

struct SizePickerView: View {
@Default(.sizingMultiplier) var sizingMultiplier
@Default(.windowPadding) var windowPadding

var body: some View {
VStack(spacing: 20) {
Slider(value: $windowPadding, in: -200...200, step: 20) {
Text("Window Buffer (adjust if hover window is misaligned with dock)")
}.buttonStyle(PlainButtonStyle())

Picker("Window Size", selection: $sizingMultiplier) {
ForEach(2...9, id: \.self) { size in
Text(getLabel(for: CGFloat(size))).tag(CGFloat(size))
Expand Down
2 changes: 1 addition & 1 deletion DockDoor/consts.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ let optimisticScreenSizeHeight = NSScreen.main!.frame.height

let roughHeightCap = optimisticScreenSizeHeight / 3
let roughWidthCap = optimisticScreenSizeWidth / 3

extension Defaults.Keys {
static let sizingMultiplier = Key<CGFloat>("sizingMultiplier") { 3 }
static let windowPadding = Key<CGFloat>("windowPadding") { 0 }
static let openDelay = Key<CGFloat>("openDelay") { 0 }
static let showAnimations = Key<Bool>("showAnimations") { true }

Expand Down

0 comments on commit 558145e

Please sign in to comment.