Skip to content

add feature override green button#1777

Open
f7urry wants to merge 1 commit into
rxhanson:mainfrom
f7urry:override-green-button
Open

add feature override green button#1777
f7urry wants to merge 1 commit into
rxhanson:mainfrom
f7urry:override-green-button

Conversation

@f7urry

@f7urry f7urry commented Jun 11, 2026

Copy link
Copy Markdown
image

Added a new setting that overrides the macOS green button behavior. When enabled, clicking a window's green button maximizes it to fill the screen instead of entering native macOS full screen. Holding any modifier key or using the button's menu restores the default macOS behavior.

Core manager responsible for intercepting and handling green button clicks.

  • Registers a low-level ActiveEventMonitor for leftMouseDown and leftMouseUp events
  • On mouseDown: detects clicks on the full-screen button (with no modifier keys held), captures the window element and button frame, and consumes the event to prevent native full screen
  • On mouseUp: if the cursor is still within the button bounds, dispatches a maximize or restore action based on the window's last recorded Rectangle action
  • Listens to greenButtonOverride and configImported notifications to start or stop the monitor dynamically

Modified Files

Rectangle/AccessibilityElement.swift

  • Added isFullScreenButton computed property that returns true when the element's subrole is .fullScreenButton

Rectangle/AppDelegate.swift

  • Declared a greenButtonManager: GreenButtonManager property
  • Instantiated GreenButtonManager() during app startup alongside other managers

Rectangle/Defaults.swift

  • Added greenButtonOverride as a new BoolDefault with key "greenButtonOverride"
  • Registered greenButtonOverride in the array of all defaults

Rectangle/PrefsWindow/SettingsViewController.swift

  • Added greenButtonOverrideCheckbox outlet
  • Added toggleGreenButtonOverride(_:) action that saves the setting and posts the greenButtonOverride notification
  • Added initializeGreenButtonOverrideCheckbox() that programmatically inserts the checkbox and a description label into the settings stack view after doubleClickTitleBarCheckbox
  • Updated initializeToggles() to sync the checkbox state on load

Rectangle/Utilities/NotificationExtension.swift

  • Added Notification.Name.greenButtonOverride for broadcasting setting changes to GreenButtonManager

Rectangle/mul.lproj/Main.xcstrings

  • Added localization entries for:
    • Checkbox label: "Click green button to fill screen instead of full screen"
    • Description label: "Clicking a window's green button maximizes it to fill the screen instead of entering macOS full screen. Hold any modifier key or use the button's menu for the default macOS behavior."

@rxhanson

Copy link
Copy Markdown
Owner

Thanks!

Click event monitors can trip up other apps, so it might make sense to keep only one instance running at a time, although this might be something that I will address post-merge.

I do think the checkbox label and the description could use some improvement (although this is a minor thing). Maximize is the nomenclature used elsewhere in Rectangle (rather than fill screen). And I typically always see the button referred to as the green stoplight button. Any thoughts/improvements here are welcome.

Also worth noting: I have a bit of rearranging of the settings that I'll be doing for an upcoming release, so this setting might get moved around when that time comes.

I'll give this a little more testing, but at first look I don't see much getting in the way of merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants