109 lines
4.2 KiB
Python
109 lines
4.2 KiB
Python
from typing import TypedDict, NotRequired, Annotated
|
|
|
|
|
|
class OutputConfig(TypedDict):
|
|
x: Annotated[int, "The x position of the output in the global coordinate space"]
|
|
y: Annotated[int, "The y position of the output in the global coordinate space"]
|
|
mode: Annotated[
|
|
str,
|
|
"The mode to set the output to (e.g. 1920x1080). Includes the refresh rate if applicable.",
|
|
]
|
|
scale: Annotated[
|
|
NotRequired[int],
|
|
"The scale of the output as a 10^2 fixed-point number (e.g. 1.0 = 100). If not provided, a value of 100 (no scaling) is assumed.",
|
|
]
|
|
transform: Annotated[
|
|
NotRequired[str],
|
|
"The transform to apply to the output (e.g. 'normal', '90', '180', '270', 'flipped', 'flipped-90', 'flipped-180', 'flipped-270'). If not provided, a value of 'normal' is assumed.",
|
|
]
|
|
color_profile: Annotated[
|
|
NotRequired[str],
|
|
"The color profile to apply to the output. If not provided, no color profile is applied. Support for this is compositor-dependent.",
|
|
]
|
|
|
|
|
|
class GroupConfig(OutputConfig):
|
|
"""A group of workspaces displayed on a single output.
|
|
|
|
At least one of either `output_names` or `make`, `model`, and `serial` must be provided.
|
|
"""
|
|
|
|
name: Annotated[str, "The name of the workspace group"]
|
|
workspaces: Annotated[
|
|
list[int],
|
|
"The indices of the workspaces in the group. The first workspace in the list is the default workspace for the group.",
|
|
]
|
|
output_names: Annotated[
|
|
NotRequired[list[str]],
|
|
"The names of the outputs to use for the group (e.g 'eDP-1').",
|
|
]
|
|
make: Annotated[NotRequired[str], "The make of the output (e.g. 'Dell')."]
|
|
model: Annotated[NotRequired[str], "The model of the output (e.g. 'U2412M')."]
|
|
serial: Annotated[NotRequired[str], "The serial number of the output."]
|
|
reverse_order: Annotated[
|
|
NotRequired[bool],
|
|
"Whether to reverse the order of the workspaces in the group when rendering workspace indicators. If not provided, a value of False is assumed.",
|
|
]
|
|
bars: Annotated[
|
|
NotRequired[list[str]],
|
|
"The names of the bars to display on the output. If not provided, no bars are displayed.",
|
|
]
|
|
|
|
|
|
class MemoryProfile(TypedDict):
|
|
"""A memory profile for an application"""
|
|
|
|
high: Annotated[int, "The high memory threshold"]
|
|
max: Annotated[int, "The maximum memory the application can use"]
|
|
|
|
|
|
class WorkspaceConfig(TypedDict):
|
|
"""A workspace configuration."""
|
|
|
|
index: Annotated[int, "The index of the workspace in the compositor"]
|
|
name: Annotated[str, "The name of the workspace, as displayed to the user"]
|
|
exec: Annotated[str, "The default application command to run in the workspace"]
|
|
program_name: Annotated[
|
|
NotRequired[str],
|
|
"The name of the program run in this workspace. If not provided, the name of the workspace is used.",
|
|
]
|
|
memory_profile: Annotated[
|
|
NotRequired[MemoryProfile],
|
|
"The memory profile for the application. If not provided, no memory profile is applied.",
|
|
]
|
|
args: Annotated[
|
|
NotRequired[list[str]],
|
|
"The arguments to pass to the default application. If not provided, no arguments are passed.",
|
|
]
|
|
environ: Annotated[
|
|
NotRequired[dict[str, str]],
|
|
"The environment variables to set when running the default application. If not provided, no additional environment variables are set.",
|
|
]
|
|
systemd: Annotated[
|
|
NotRequired[bool],
|
|
"Whether to run the default application as a systemd unit. If not provided, a value of True is assumed.",
|
|
]
|
|
void_output: Annotated[
|
|
NotRequired[bool],
|
|
"Whether to void the output (not capture it to the system journal) of the default application. If not provided, a value of False is assumed.",
|
|
]
|
|
|
|
|
|
class Context(TypedDict):
|
|
"""A context configuration."""
|
|
|
|
name: Annotated[str, "The name of the context"]
|
|
groups: Annotated[
|
|
list[GroupConfig],
|
|
"The groups of workspaces to display on the outputs",
|
|
]
|
|
priority: Annotated[
|
|
NotRequired[int],
|
|
"The priority of the context. If not provided, a value of 0 is assumed.",
|
|
]
|
|
|
|
|
|
class Config(TypedDict):
|
|
workspaces: list[WorkspaceConfig]
|
|
contexts: list[Context]
|