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.
- 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.
WarningUse 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. |
NoteUse this property sparingly. It is preferable to leave this as
automaticand make your UI light/dark mode compatible.
- size
- OBJECT
The size of this window in pixels. The default external window size is 800x600.
NoteSizing works differently when running the UI inside Alfred, defaulting
widthto the same as your current theme and theheightto the minimum required to fit the UI.
- 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.
- 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.
- 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.