Skip to content

Add NSWindow.tabbingMode #206

Description

@lkmavi

Hi I'm building a high-performance terminal emulator in Go using gogpu/wgpu and gogpu/gogpu. One of the key features I want to offer macOS users is native support for system-level tabs – exactly like those found in Alacritty, iTerm2, and other native macOS apps.

The macOS system tabbing mechanism (NSWindow.tabbingMode) allows multiple windows of an application to automatically combine into a single tabbed window. This is much more than a cosmetic feature:

  • macOS users expect this behavior from professional applications.
  • The system manages grouping, drag-and-drop merging, and the creation of new tabs from separate windows, greatly simplifying application code.
  • It follows Apple's Human Interface Guidelines.

Currently, gogpu provides no way to enable this mode because the window is created internally and access to the underlying NSWindow is not exposed through the public API.

Proposed Solution

Add a new optional method to the PlatformProvider interface (in the gpucontext package) that allows setting the tabbing mode for the application's window. The implementation would be provided in gogpu for macOS (using the ObjC runtime via goffi), and could be a no-op on other platforms.

1. New type and constants in gpucontext

// TabbingMode specifies the system tabbing behavior for a window.
// Currently only supported on macOS.
type TabbingMode int

const (
    // TabbingAutomatic lets the system decide whether to tab windows.
    TabbingAutomatic TabbingMode = 0
    // TabbingPreferred indicates the window prefers to open as a tab when possible.
    TabbingPreferred TabbingMode = 1
    // TabbingDisallowed explicitly prevents the window from being grouped into tabs.
    TabbingDisallowed TabbingMode = 2
)

Is this something you'd be interested in?

Before I start implementing, I wanted to ask: would this feature be a welcome addition to gogpu? I don't want to invest effort into a pull request that doesn't align with the project's current goals or design philosophy. If you think it's a good fit, I'm happy to move forward. If not, I completely understand – I just need to know whether to proceed or explore a different approach.

Thanks for your work on gogpu – it's an impressive project! Looking forward to your feedback.

Activity

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions