/** * A workspace definition. */ export interface Workspace { /** * The unique ID of the workspace. This is used as the name of the workspace in Sway, * and also for references in groups. */ index: number; /** * The name of the workspace. This is used for display purposes only. */ name: string; /** * The program to run in the workspace, not including any arguments. */ exec: string; /** * The name of the program, used to create the transient systemd unit for the program. */ program_name: string; /** * The arguments to pass to the program. */ args?: string[]; /** * The environment variables to set for the program. */ environ?: Record; /** * Whether to run the program in a systemd unit. Defaults to true. * If false, the program will be run directly by sway, using the `exec` sway command. * If true, a transient systemd unit will be created for the program via `systemd-run`. */ systemd?: boolean; /** * Whether to capture the output of the program and display it in the workspace. Defaults to false. * If true, the output of the program will not be logged. When systemd is enabled, the program will be run in a scope unit rather than a service unit. * If false, the output of the program will be logged. When systemd is disabled, this is done via `systemd-cat`, and the program_name will be used as the tag. */ void_output?: boolean; /** * A memory profile to apply to the program. This can only be applied when systemd is enabled, and will be ignored otherwise. */ memory_profile?: { /** * The "high" memory limit for the program. See `systemd.resource-control(5)` for more information. */ high: string; /** * The "max" memory limit for the program. See `systemd.resource-control(5)` for more information. If exceeded, the program will be killed. */ max: string; }; } /** * An output definition, used to match the connected outputs to defined contexts. * * Outputs can be identified in one of two ways: * 1) by make, model, and serial of the physical monitor associated with the output * 2) by compositor-assigned name * * Make, model, and serial guarantees a perfect match, and is thus preferred for static * configurations (e.g. desktop) where these values rarely if ever change. Output names * can be used when perfect matching is undesireable (such as for a presentation context) * or infeasible (a monitor that does not provide one of the above values), or for a * monitor that will always be assigned the same name regardless of system configuration * (such as the eDP-1 output on laptops). * * The special name '*' can be used when any output that is not statically defined is acceptable. * Only one output can be selected via wildcard. * * If an output can be identified both perfectly and by name, the perfect match will take precedence. */ export interface Output { /** * The make of the output. At least one of this or `names` must be present. */ make?: string; /** * The model of the output. At least one of this or `names` must be present. */ model?: string; /** * The serial number of the output. At least one of this or `names` must be present. */ serial?: string; /** * The names that the output can be identified by. Either this or `make`, `model`, and `serial` must be present. */ names?: string[]; /** * The workspace group to assign to the output. * If mirroring, a group should only be assigned to one output. */ group?: string; /** * The position of the output in the framebuffer. * If mirroring, this should be the same for all outputs in the group. */ position: [number, number]; /** * The output's configuration. This is a string that is passed directly to sway's `output` command. * Position should not be included, as it is set by the `position` field. */ mode: string; /** * The bar windows to open on the output in this context, in the order in which they should be opened. */ bars: string[]; } /** * A workspace group definition. */ export interface Group { /** * The workspaces in the group, in the order in which they should be referenced by index. */ workspaces: number[]; /** * Whether the workspace order should be reversed when displayed. Defaults to false. * * This does not affect the order of the workspaces in the group, only the order in which they are displayed. * If true, the first workspace will be displayed on the right, and the last workspace will be displayed on the left. */ reverse?: boolean; } /** * A context definition. * * "Contexts" are a way to define a set of outputs and workspaces that should be active in a given situation. * The name is a holdover from the original conception of this project, where it was intended to be used to * define different "contexts" in which the system could be used (e.g. "work", "home", "presentation"). * While this system can be used for that purpose, its primary use is to define a set of outputs and workspaces * that should be active in a given situation, regardless of the user's intent, so that when the monitor * configuration changes, the system can automatically adjust workspaces and status bars to match. */ export interface Context { /** * The outputs that this context requires. */ outputs: Output[]; /** * The name of the "primary" group for this context. This group will be focused when the context is activated if * focus was not originally on a group in this context. */ primary: string; /** * The workspace groups that make up this context. */ groups: Record; /** * The priority of this context, used for tiebreaking when multiple contexts are compatible. * Higher priority contexts will be selected over lower priority contexts. Defaults to 0. * * Behind the scenes, this is added to an internal "score" calculated for each context when matching. * The context with the highest score is selected. * A perfect output match is worth 3 points, a name match is worth 2 points, and a wildcard match is worth 1 point. * Any failed match immediately gives the context a score of 0, and contexts with a score <= 0 are not considered. * As such, this value can be used to give a context a slight advantage in the case of a tie, boost a more general * context over a more specific one, or remove it from consideration entirely. * * This value is not considered when requesting a context by name, allowing for contexts which cannot be automatically * selected to be manually selected. */ priority?: number; } export interface Config { workspaces: Workspace[]; contexts: Record; default_context: string; }