Window

The window object is primarly for configuring the top-level window when running Alfred UIs externally.

{
  "window": {
    "padding": 16,
    "root": {
      "type": "view",
      "layout": "stack",
      "components": [
        {
          "type": "label",
          "text": "Hello, this is an Alfred UI",
          "textalign": "centre",
          "font": {
            "size": "large"
          }
        }
      ]
    }
  }
}

Properties

root
OBJECT
Required

The view hierarchy for the Alfred UI, it's recommended to use a view component.

id
STRING

The identifier of this window which can be referenced later

title
STRING
Recommended

The title for the top of the window.

blur
BOOL
Default: true

If the window takes on a blurred appearance.

movablebybackground
BOOL
Default: false

If the window can be moved by dragging the background. Default false when running externally to mimic macOS window behaviour, and true internally to mimic Alfred's window behaviour. Veto this per view by using the view's vetomovablebybackground flag.

level
INTEGER
Default: 0

The z-level of this window in the macOS window hierarchy as AppKit NSWindowLevel.

Warning

Use this property with care.

appearance
ENUM
Default: "automatic"

Override the macOS appearance for this window, which will alter how all subviews and components are rendered.

Value Description
"automatic" Use the default macOS appearance.
"light" Force light mode on this window and any subviews / components.
"dark" Force light mode on this window and any subviews / components.
Note

Use this property sparingly. It is preferable to leave this as automatic and make your UI light/dark mode compatible.

size
OBJECT

The size of this window in pixels. The default external window size is 800x600.

Note

Sizing works differently when running the UI inside Alfred, defaulting width to the same as your current theme and the height to the minimum required to fit the UI.

width
INTEGER
Default: 800, Range: 50-10000, Optional when running UI inside of Alfred

The width of the window.

height
INTEGER
Default: 600, Range: 50-10000, Optional when running UI inside of Alfred

The height of the window.

minsize
OBJECT

The minimum size of this window in pixels.

width
INTEGER

The minimum width of this window

height
INTEGER

The minimum height of this window

maxsize
OBJECT

The maximum size of this window in pixels.

width
INTEGER

The maximum width of this window

height
INTEGER

The maximum height of this window

borderless
BOOL
Default: false

Makes the window borderless, like the Alfred main window, with no title. Using this option will disable toolbar based options, and enable window cornerradius.

closeable
BOOL
Default: true

Enable or disable the close button.

minimisable
BOOL
Default: true

Enable or disable the minimise button.

resizeable
BOOL
Default: true

Enable or disable the resizeable button, and window resizing.

fullscreenable
BOOL
Default: true

Full screen behaviour on using the maximise button.

fullsizecontentview
BOOL
Default: false

Extend the content up to the top of the window behind the toolbar.

frameautosave
BOOL
Default: false

Automatically save the frame position for this UI, keyed on the location of the .alfredui file. Only for external UIs.

titlevisibility
BOOL
Default: true

Show or hide the window title.

titlebarappearstransparent
BOOL
Default: false

Make the title bar or toolbar transparent.

toolbar
OBJECT

Configuration for the window toolbar. Using this option will create a toolbar.

type
ENUM
Default: "unified"

The type of toolbar.

Value Description
"unified" Use a modern unified toolbar.
"unifiedcompact" Use a modern compact unified toolbar.
padding
INTEGER
Default: 0, Range: 0-32

Padding within the window before the Alfred UI is rendered. You will also benefit from automatic corner rounding and cropping where relevant.

cornerradius
INTEGER
Default: 0, Range: 0-128

The corner radius of this window, only possible with a borderless window.

Functions

Perform actions directly on this window using the functions Action.

close

Close this window. If you're running your UI inside of Alfred, take a look at the 'finish' action.

zoom

Maximise this window.

minimise

Minimise this window.