Skip to content

Commit

Permalink
feat: add top right window title position option (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShlomoCode authored Jul 11, 2024
1 parent 13a39a9 commit 3abce70
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 10 additions & 1 deletion DockDoor/Views/Hover Window/WindowPreview.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,16 @@ struct WindowPreview: View {
}
.clipShape(uniformCardRadius ? AnyShape(RoundedRectangle(cornerRadius: 6, style: .continuous)) : AnyShape(Rectangle()))
}
.overlay(alignment: windowTitlePosition == .bottomLeft ? .bottomLeading : .bottomTrailing) {
.overlay(alignment: {
switch windowTitlePosition {
case .bottomLeft:
return .bottomLeading
case .bottomRight:
return .bottomTrailing
case .topRight:
return .topTrailing
}
}()) {
if showWindowTitle && ((windowTitleDisplayCondition == .always) || (windowTitleDisplayCondition == .windowSwitcherOnly && CurrentWindow.shared.showingTabMenu) || (windowTitleDisplayCondition == .dockPreviewsOnly && !CurrentWindow.shared.showingTabMenu)) {
windowTitleOverlay(selected: selected)
}
Expand Down
3 changes: 3 additions & 0 deletions DockDoor/consts.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,16 @@ enum WindowTitleDisplayCondition: String, CaseIterable, Defaults.Serializable {
enum WindowTitlePosition: String, CaseIterable, Defaults.Serializable {
case bottomLeft
case bottomRight
case topRight

var localizedName: String {
switch self {
case .bottomLeft:
String(localized: "Bottom Left", comment: "Preview window title position option")
case .bottomRight:
String(localized: "Bottom Right", comment: "Preview window title position option")
case .topRight:
String(localized: "Top Right", comment: "Preview window title position option")
}
}
}
Expand Down

0 comments on commit 3abce70

Please sign in to comment.