Skip to content

Linux - Provide window borders and title bar buttons approprate for the user's desktop environment #44540

@acerspyro

Description

@acerspyro

Preflight Checklist

Problem Description

It is my understanding that Windows and macOS impose window border shapes and appearances through their respective window managers. These operating systems also provide native title bar buttons upon request or overlay them automatically.

In contrast, Linux platforms delegate the responsibility for border styles, title bar buttons, their positioning, appearance, and quantity to the Electron application itself.

This approach shifts the burden of proper desktop integration to the application developer. Often, developers opt for a simplified solution: an undrawn square border with three generic buttons (minimize, maximize, and close) positioned in the top-right corner. However, this generic approach may not align with user preferences or conform to the conventions of the current desktop environment.

Image

Proposed Solution

Electron should provide a platform-specific window border and apply two sets of title bar buttons (left and right) to the application upon request.

This system could support multiple desktop environments with unique title bar styling, including but not limited to:

  • GNOME
  • KDE
  • Elementary
  • COSMIC

While the extent of matching user preferences may vary, this approach would require exposing a generic interface to the underlying application. This interface would automatically apply the correct title bar button styling and appearance using a strategy pattern.

Alternatives Considered

I've explored the possibility of developing a Web Components library that would provide three key components:

  1. A window wrapper component:

    • Implements the correct border (and shadow, if necessary) for the platform
    • Optionally includes a simple title bar
  2. A component for the left bank of title bar buttons

  3. A component for the right bank of title bar buttons

This approach would enable developers to incorporate environment-specific window controls without the need to create custom solutions specifically for the Linux platform.

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions