Repository navigation
Add hover background to split action buttons #2271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
52b8088
81af9da
f2dc14b
a787166
9ae375c
0feca11
e9b2e4b
9a45708
9932983
7dff656
d47ab35
a6758c5
1e538ae
1690dd1
389a665
c20b219
cf62e85
1d38fa2
6be43dd
ec3432e
7e70970
e64bbe8
3be593d
064660c
e6edc1e
79dbc9b
419f6a9
d59f040
91af725
d064bb0
7f852bf
0bed9ad
7f4b3e2
5bf7ea1
c5609a8
d1c78d1
00360af
6977684
6afa2f0
01ba1fe
1bfca09
af34d5c
3732418
ef502f8
2e26ca6
f372b7c
524b3cb
b3c9dd1
74194fa
eeb9d67
ff8b0a4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -474,14 +474,12 @@ struct cmuxApp: App { | |
|
|
||
| Divider() | ||
| Menu("Debug Windows") { | ||
| Button("Debug Window Controls…") { | ||
| DebugWindowControlsWindowController.shared.show() | ||
| Button("Background Debug…") { | ||
| BackgroundDebugWindowController.shared.show() | ||
| } | ||
|
|
||
| Button("Browser Import Hint Debug…") { | ||
| BrowserImportHintDebugWindowController.shared.show() | ||
| } | ||
|
|
||
| Button( | ||
| String( | ||
| localized: "debug.menu.browserProfilePopoverDebug", | ||
|
|
@@ -490,26 +488,21 @@ struct cmuxApp: App { | |
| ) { | ||
| BrowserProfilePopoverDebugWindowController.shared.show() | ||
| } | ||
|
|
||
| Button("Debug Window Controls…") { | ||
| DebugWindowControlsWindowController.shared.show() | ||
| } | ||
| Button("Menu Bar Extra Debug…") { | ||
| MenuBarExtraDebugWindowController.shared.show() | ||
| } | ||
| Button("Settings/About Titlebar Debug…") { | ||
| SettingsAboutTitlebarDebugWindowController.shared.show() | ||
| } | ||
|
|
||
| Divider() | ||
| Button("Sidebar Debug…") { | ||
| SidebarDebugWindowController.shared.show() | ||
| } | ||
|
|
||
| Button("Background Debug…") { | ||
| BackgroundDebugWindowController.shared.show() | ||
| } | ||
|
|
||
| Button("Menu Bar Extra Debug…") { | ||
| MenuBarExtraDebugWindowController.shared.show() | ||
| Button("Split Button Layout Debug…") { | ||
| SplitButtonLayoutDebugWindowController.shared.show() | ||
| } | ||
|
|
||
| Divider() | ||
|
|
||
| Button("Open All Debug Windows") { | ||
| openAllDebugWindows() | ||
| } | ||
|
|
@@ -3334,6 +3327,76 @@ private struct MenuBarExtraDebugView: View { | |
| } | ||
| } | ||
|
|
||
| // MARK: - Split Button Layout Debug Window | ||
|
|
||
| private final class SplitButtonLayoutDebugWindowController: NSWindowController, NSWindowDelegate { | ||
| static let shared = SplitButtonLayoutDebugWindowController() | ||
|
|
||
| private init() { | ||
| let window = NSPanel( | ||
| contentRect: NSRect(x: 0, y: 0, width: 320, height: 240), | ||
| styleMask: [.titled, .closable, .utilityWindow], | ||
| backing: .buffered, | ||
| defer: false | ||
| ) | ||
| window.title = "Split Button Layout" | ||
| window.titleVisibility = .visible | ||
| window.titlebarAppearsTransparent = false | ||
| window.isMovableByWindowBackground = true | ||
| window.isReleasedWhenClosed = false | ||
| window.identifier = NSUserInterfaceItemIdentifier("cmux.splitButtonLayoutDebug") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The new panel gets its own window identifier here, but that identifier is not added to Useful? React with 👍 / 👎. |
||
| window.center() | ||
| window.contentView = NSHostingView(rootView: SplitButtonLayoutDebugView()) | ||
| AppDelegate.shared?.applyWindowDecorations(to: window) | ||
| super.init(window: window) | ||
| window.delegate = self | ||
| } | ||
|
|
||
| @available(*, unavailable) | ||
| required init?(coder: NSCoder) { fatalError() } | ||
|
|
||
| func show() { | ||
| window?.center() | ||
| window?.makeKeyAndOrderFront(nil) | ||
| } | ||
| } | ||
|
|
||
| private struct SplitButtonLayoutDebugView: View { | ||
| @AppStorage("debugFadeColorStyle") private var backdropStyle = 0 | ||
|
|
||
| private let options: [(Int, String)] = [ | ||
| (0, "Pre-composited paneBackground"), | ||
| (1, "Raw paneBackground (opaque)"), | ||
| (2, "barBackground (tab chrome)"), | ||
| (3, "windowBackgroundColor"), | ||
| (4, "controlBackgroundColor"), | ||
| (5, "Pre-composited barBackground"), | ||
| ] | ||
|
|
||
| var body: some View { | ||
| VStack(alignment: .leading, spacing: 10) { | ||
| Text("Button Backdrop Color") | ||
| .font(.headline) | ||
|
|
||
| ForEach(options, id: \.0) { id, label in | ||
| HStack { | ||
| Image(systemName: backdropStyle == id ? "checkmark.circle.fill" : "circle") | ||
| .foregroundColor(backdropStyle == id ? .accentColor : .secondary) | ||
| Text(label) | ||
| } | ||
| .contentShape(Rectangle()) | ||
| .onTapGesture { backdropStyle = id } | ||
| } | ||
|
|
||
| Text("Changes apply live.") | ||
| .font(.caption) | ||
| .foregroundColor(.secondary) | ||
| } | ||
| .padding(16) | ||
| .frame(maxWidth: .infinity, alignment: .topLeading) | ||
| } | ||
| } | ||
|
|
||
| // MARK: - Background Debug Window | ||
|
|
||
| private final class BackgroundDebugWindowController: NSWindowController, NSWindowDelegate { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commit introduces new user-visible English literals (for example, the new Debug menu entry and window labels) without
String(localized:defaultValue:)keys, so the feature will remain untranslated in non-English locales. The repo policy in AGENTS.md explicitly requires all user-facing strings to be localized (including English and Japanese entries inLocalizable.xcstrings), so this should be converted before landing.Useful? React with 👍 / 👎.