Skip to content

Add maximize and minimize button mapping actions - #1341

Merged
lujjjh merged 6 commits into
linearmouse:mainfrom
DrMatrix85:button-mapping-media-window-actions
Aug 9, 2026
Merged

lujjjh merged 6 commits into
linearmouse:mainfrom
DrMatrix85:button-mapping-media-window-actions

Conversation

@DrMatrix85

Copy link
Copy Markdown
Contributor

Adds two new Button Mapping actions:

Maximize Window
Minimize Window

Maximize Window resizes the focused window to the usable area of its display while preserving the menu bar and Dock, rather than entering macOS full-screen mode.

Minimize Window minimizes the focused window to the Dock using the macOS Accessibility API.

These actions work with the existing Button Mapping system, including the swipe triggers introduced in #1326.

Tested successfully with:

Logitech MX Master 4
Samsung Bluetooth Mouse Slim

Verified:

Maximize correctly fits the focused window within the visible screen area
Minimize correctly sends the focused window to the Dock
Full test suite passes
SwiftFormat lint passes

@lujjjh

lujjjh commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the contribution! Please update Documentation/Configuration.d.ts with the new actions, then regenerate Documentation/Configuration.json by running:

npm run generate:json-schema

It would also be good to add the new UI strings to the localization catalog.

I’ll test it later, but the current implementation may have issues with multiple displays because AX and NSScreen use different coordinate systems. This could select the wrong screen or place the window incorrectly when displays have different heights or are arranged vertically.

The build also produces a new warning for the forced AXUIElement cast. The unchecked AXValue casts could similarly crash if an application returns an unexpected AX value, so these should use safe, type-checked conversions.

@DrMatrix85

Copy link
Copy Markdown
Contributor Author

Thanks for the review! I’ve addressed the requested changes:

Updated Documentation/Configuration.d.ts
Regenerated Documentation/Configuration.json
Added the new UI strings to the localization catalog
Reworked the AX/AppKit coordinate conversion for multi-display layouts
Replaced the unchecked AX casts with runtime type checks

I also rebuilt and reran the full test suite successfully, and verified Maximize/Minimize still work as expected on the hardware I have available.

@lujjjh

lujjjh commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

I’ve pushed a few follow-up changes to the branch: formatted Configuration.d.ts, replaced the manual string extraction with proper localization and translations, and improved window maximization reliability, particularly for Firefox, based on the approach used by Rectangle and Hammerspoon.

@lujjjh
lujjjh merged commit c07b22e into linearmouse:main Aug 9, 2026
1 check passed
@DrMatrix85

Copy link
Copy Markdown
Contributor Author

Thanks for the review, follow-up improvements, and merge! I really appreciate the extra polish on the maximization behavior and localization. Glad I could contribute!

@DrMatrix85
DrMatrix85 deleted the button-mapping-media-window-actions branch August 9, 2026 02:22
@lujjjh lujjjh added the enhancement New feature or request label Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants