Skip to content

Feat: create-window primitive #1895

@nikitabobko

Description

@nikitabobko

The feature proposal is to introduce aerospace create-window primitive

aerospace create-window [--tiling|--floating] [--title <title>] [--fullscreen] 
                        [--macos-native-fullscreen] [--macos-native-minimize] 
                        [--opacity <opacity>%] [--no-window-decoration] 
                        [--body <text>] [--body-size <text-size>] [--workspace <workspace>]
                        [--corner-radius <radius>] [--no-shadow] 
                        [--background-color <hex-color>] [--on-click <aerospace-command>] 
                        [--on-close <aerospace-command>]

--opacity <opacity>%::
Valid format is a number from 0 to 100.

--fullscreen::
The created window is immediately fullscreened. See `fullscreen` command.

--workspace <workspace>::
Immediately assign the created window to the specified workspace.

Motivation

Purity and general purpose scripting. Window is a basic primitive of a window manager. Similar to how package managers allow creating drafts of packages, window manager should be capable of creating windows.

Given that it's a basic primitive, real world use cases will emerge. Some people may use it to show big text on their screen, other people may use it to intentionally introduce gaps to make half of the wide screen empty (#1884)

Open questions

  1. --body <text>. Is it rich text or plain text? If it's a rich text is it markdown or html?
  2. --corner-radius and --no-window-decoration should be designed with what is technically possible in mind.
  3. Print window id to stdout?
  4. Menubar?
  5. Show anything in Dock? (probably not)
  6. How to change properties of already created windows?
  7. Instead of --fullscreen, --macos-native-fullscreen etc. add single --on-create <aerospace-command>. Delay window layout until the callback in called to avoid flickering. Related: Add a possibility to "await" the moment when new window opens #226
  8. Somehow make the command accessible without AeroSpace server running?

Special casing for hiding windows

AeroSpace hides windows in monitor corners. For our own windows, we could theoretically close them and open as needed. Though it's up to discussion. Other users might not like it because of mission control. In the first version, I'd prefer to avoid the special casing.

Technical challenges

AFAIK, we can't use the same mechanism that we use to move other windows. Process that tries to apply accessibility requests to itself immediately crashes

Related

#1403 app-menu primitive. Idea: what if create-window primitive was the way to create new windows of particular applications! Replacement for new-window-or-open

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureFeature proposal

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions