Files
niri/model_action.go
2025-07-25 13:41:23 +02:00

548 lines
16 KiB
Go

package niri
import "time"
type Action struct {
Action map[string]any `json:"Action"`
}
func ActionCustom[T any](actionName string, actionContent T) Action {
return Action{map[string]any{actionName: actionContent}}
}
func ActionQuit(skipConfirmation bool) Action {
return ActionCustom("Quit", map[string]any{"skip_confirmation": skipConfirmation})
}
func ActionPowerOffMonitors() Action {
return ActionCustom("PowerOffMonitors", map[string]any{})
}
func ActionPowerOnMonitors() Action {
return ActionCustom("PowerOnMonitors", map[string]any{})
}
func ActionSpawn(command []string) Action {
return ActionCustom("Spawn", map[string]any{"command": command})
}
func ActionDoScreenTransition(delay Option[time.Duration]) Action {
return ActionCustom("DoScreenTransition", map[string]any{"delay_ms": mapOption(delay, time.Duration.Milliseconds)})
}
func ActionScreenshot(showPointer bool) Action {
return ActionCustom("Screenshot", map[string]any{"show_pointer": showPointer})
}
func ActionScreenshotScreen(writeToDisk, showPointer bool) Action {
return ActionCustom("ScreenshotScreen", map[string]any{"write_to_disk": writeToDisk, "show_pointer": showPointer})
}
func ActionScreenshotWindow(id Option[WindowID], writeToDisk bool) Action {
return ActionCustom("ScreenshotWindow", map[string]any{"id": id, "write_to_disk": writeToDisk})
}
func ActionToggleKeyboardShortcutsInhibit() Action {
return ActionCustom("ToggleKeyboardShortcutsInhibit", map[string]any{})
}
func ActionCloseWindow(id Option[WindowID]) Action {
return ActionCustom("CloseWindow", map[string]any{"id": id})
}
func ActionFullscreenWindow(id Option[WindowID]) Action {
return ActionCustom("FullscreenWindow", map[string]any{"id": id})
}
func ActionToggleWindowedFullscreen(id Option[WindowID]) Action {
return ActionCustom("ToggleWindowedFullscreen", map[string]any{"id": id})
}
func ActionFocusWindow(id WindowID) Action {
return ActionCustom("FocusWindow", map[string]any{"id": id})
}
func ActionFocusWindowInColumn(index int) Action {
return ActionCustom("FocusWindowInColumn", map[string]any{"index": index})
}
func ActionFocusWindowPrevious() Action {
return ActionCustom("FocusWindowPrevious", map[string]any{})
}
func ActionFocusColumnLeft() Action {
return ActionCustom("FocusColumnLeft", map[string]any{})
}
func ActionFocusColumnRight() Action {
return ActionCustom("FocusColumnRight", map[string]any{})
}
func ActionFocusColumnFirst() Action {
return ActionCustom("FocusColumnFirst", map[string]any{})
}
func ActionFocusColumnLast() Action {
return ActionCustom("FocusColumnLast", map[string]any{})
}
func ActionFocusColumnRightOrFirst() Action {
return ActionCustom("FocusColumnRightOrFirst", map[string]any{})
}
func ActionFocusColumnLeftOrLast() Action {
return ActionCustom("FocusColumnLeftOrLast", map[string]any{})
}
func ActionFocusColumn(index int) Action {
return ActionCustom("FocusColumn", map[string]any{"index": index})
}
func ActionFocusWindowOrMonitorUp() Action {
return ActionCustom("FocusWindowOrMonitorUp", map[string]any{})
}
func ActionFocusWindowOrMonitorDown() Action {
return ActionCustom("FocusWindowOrMonitorDown", map[string]any{})
}
func ActionFocusColumnOrMonitorLeft() Action {
return ActionCustom("FocusColumnOrMonitorLeft", map[string]any{})
}
func ActionFocusColumnOrMonitorRight() Action {
return ActionCustom("FocusColumnOrMonitorRight", map[string]any{})
}
func ActionFocusWindowDown() Action {
return ActionCustom("FocusWindowDown", map[string]any{})
}
func ActionFocusWindowUp() Action {
return ActionCustom("FocusWindowUp", map[string]any{})
}
func ActionFocusWindowDownOrColumnLeft() Action {
return ActionCustom("FocusWindowDownOrColumnLeft", map[string]any{})
}
func ActionFocusWindowDownOrColumnRight() Action {
return ActionCustom("FocusWindowDownOrColumnRight", map[string]any{})
}
func ActionFocusWindowUpOrColumnLeft() Action {
return ActionCustom("FocusWindowUpOrColumnLeft", map[string]any{})
}
func ActionFocusWindowUpOrColumnRight() Action {
return ActionCustom("FocusWindowUpOrColumnRight", map[string]any{})
}
func ActionFocusWindowOrWorkspaceDown() Action {
return ActionCustom("FocusWindowOrWorkspaceDown", map[string]any{})
}
func ActionFocusWindowOrWorkspaceUp() Action {
return ActionCustom("FocusWindowOrWorkspaceUp", map[string]any{})
}
func ActionFocusWindowTop() Action {
return ActionCustom("FocusWindowTop", map[string]any{})
}
func ActionFocusWindowBottom() Action {
return ActionCustom("FocusWindowBottom", map[string]any{})
}
func ActionFocusWindowDownOrTop() Action {
return ActionCustom("FocusWindowDownOrTop", map[string]any{})
}
func ActionFocusWindowUpOrBottom() Action {
return ActionCustom("FocusWindowUpOrBottom", map[string]any{})
}
func ActionMoveColumnLeft() Action {
return ActionCustom("MoveColumnLeft", map[string]any{})
}
func ActionMoveColumnRight() Action {
return ActionCustom("MoveColumnRight", map[string]any{})
}
func ActionMoveColumnToFirst() Action {
return ActionCustom("MoveColumnToFirst", map[string]any{})
}
func ActionMoveColumnToLast() Action {
return ActionCustom("MoveColumnToLast", map[string]any{})
}
func ActionMoveColumnLeftOrToMonitorLeft() Action {
return ActionCustom("MoveColumnLeftOrToMonitorLeft", map[string]any{})
}
func ActionMoveColumnRightOrToMonitorRight() Action {
return ActionCustom("MoveColumnRightOrToMonitorRight", map[string]any{})
}
func ActionMoveColumnToIndex(index int) Action {
return ActionCustom("MoveColumnToIndex", map[string]any{"index": index})
}
func ActionMoveWindowDown() Action {
return ActionCustom("MoveWindowDown", map[string]any{})
}
func ActionMoveWindowUp() Action {
return ActionCustom("MoveWindowUp", map[string]any{})
}
func ActionMoveWindowDownOrToWorkspaceDown() Action {
return ActionCustom("MoveWindowDownOrToWorkspaceDown", map[string]any{})
}
func ActionMoveWindowUpOrToWorkspaceUp() Action {
return ActionCustom("MoveWindowUpOrToWorkspaceUp", map[string]any{})
}
func ActionConsumeOrExpelWindowLeft(id Option[WindowID]) Action {
return ActionCustom("ConsumeOrExpelWindowLeft", map[string]any{"id": id})
}
func ActionConsumeOrExpelWindowRight(id Option[WindowID]) Action {
return ActionCustom("ConsumeOrExpelWindowRight", map[string]any{"id": id})
}
func ActionConsumeWindowIntoColumn() Action {
return ActionCustom("ConsumeWindowIntoColumn", map[string]any{})
}
func ActionExpelWindowFromColumn() Action {
return ActionCustom("ExpelWindowFromColumn", map[string]any{})
}
func ActionSwapWindowRight() Action {
return ActionCustom("SwapWindowRight", map[string]any{})
}
func ActionSwapWindowLeft() Action {
return ActionCustom("SwapWindowLeft", map[string]any{})
}
func ActionToggleColumnTabbedDisplay() Action {
return ActionCustom("ToggleColumnTabbedDisplay", map[string]any{})
}
func ActionSetColumnDisplay(display ColumnDisplay) Action {
return ActionCustom("SetColumnDisplay", map[string]any{"display": display})
}
func ActionCenterColumn() Action {
return ActionCustom("CenterColumn", map[string]any{})
}
func ActionCenterWindow(id Option[WindowID]) Action {
return ActionCustom("CenterWindow", map[string]any{"id": id})
}
func ActionCenterVisibleColumns() Action {
return ActionCustom("CenterVisibleColumns", map[string]any{})
}
func ActionFocusWorkspaceDown() Action {
return ActionCustom("FocusWorkspaceDown", map[string]any{})
}
func ActionFocusWorkspaceUp() Action {
return ActionCustom("FocusWorkspaceUp", map[string]any{})
}
func ActionFocusWorkspace(reference WorkspaceReferenceArg) Action {
return ActionCustom("FocusWorkspace", map[string]any{"reference": reference})
}
func ActionFocusWorkspacePrevious() Action {
return ActionCustom("FocusWorkspacePrevious", map[string]any{})
}
func ActionMoveWindowToWorkspaceDown() Action {
return ActionCustom("MoveWindowToWorkspaceDown", map[string]any{})
}
func ActionMoveWindowToWorkspaceUp() Action {
return ActionCustom("MoveWindowToWorkspaceUp", map[string]any{})
}
func ActionMoveWindowToWorkspace(id Option[WindowID], reference WorkspaceReferenceArg, focus bool) Action {
return ActionCustom("MoveWindowToWorkspace", map[string]any{"id": id, "reference": reference, "focus": focus})
}
func ActionMoveColumnToWorkspaceDown(focus bool) Action {
return ActionCustom("MoveColumnToWorkspaceDown", map[string]any{"focus": focus})
}
func ActionMoveColumnToWorkspaceUp(focus bool) Action {
return ActionCustom("MoveColumnToWorkspaceUp", map[string]any{"focus": focus})
}
func ActionMoveColumnToWorkspace(reference WorkspaceReferenceArg, focus bool) Action {
return ActionCustom("MoveColumnToWorkspace", map[string]any{"reference": reference, "focus": focus})
}
func ActionMoveWorkspaceDown() Action {
return ActionCustom("MoveWorkspaceDown", map[string]any{})
}
func ActionMoveWorkspaceUp() Action {
return ActionCustom("MoveWorkspaceUp", map[string]any{})
}
func ActionMoveWorkspaceToIndex(index int, reference Option[WorkspaceReferenceArg]) Action {
return ActionCustom("MoveWorkspaceToIndex", map[string]any{"index": index, "reference": reference})
}
func ActionSetWorkspaceName(name string, workspace Option[WorkspaceReferenceArg]) Action {
return ActionCustom("SetWorkspaceName", map[string]any{"name": name, "workspace": workspace})
}
func ActionUnsetWorkspaceName(reference Option[WorkspaceReferenceArg]) Action {
return ActionCustom("UnsetWorkspaceName", map[string]any{"reference": reference})
}
func ActionFocusMonitorLeft() Action {
return ActionCustom("FocusMonitorLeft", map[string]any{})
}
func ActionFocusMonitorRight() Action {
return ActionCustom("FocusMonitorRight", map[string]any{})
}
func ActionFocusMonitorDown() Action {
return ActionCustom("FocusMonitorDown", map[string]any{})
}
func ActionFocusMonitorUp() Action {
return ActionCustom("FocusMonitorUp", map[string]any{})
}
func ActionFocusMonitorPrevious() Action {
return ActionCustom("FocusMonitorPrevious", map[string]any{})
}
func ActionFocusMonitorNext() Action {
return ActionCustom("FocusMonitorNext", map[string]any{})
}
func ActionFocusMonitor(output OutputName) Action {
return ActionCustom("FocusMonitorNext", map[string]any{"output": output})
}
func ActionMoveWindowToMonitorLeft() Action {
return ActionCustom("MoveWindowToMonitorLeft", map[string]any{})
}
func ActionMoveWindowToMonitorRight() Action {
return ActionCustom("MoveWindowToMonitorRight", map[string]any{})
}
func ActionMoveWindowToMonitorDown() Action {
return ActionCustom("MoveWindowToMonitorDown", map[string]any{})
}
func ActionMoveWindowToMonitorUp() Action {
return ActionCustom("MoveWindowToMonitorUp", map[string]any{})
}
func ActionMoveWindowToMonitorPrevious() Action {
return ActionCustom("MoveWindowToMonitorPrevious", map[string]any{})
}
func ActionMoveWindowToMonitorNext() Action {
return ActionCustom("MoveWindowToMonitorNext", map[string]any{})
}
func ActionMoveWindowToMonitor(id Option[WindowID], output OutputName) Action {
return ActionCustom("FocusMonitorNext", map[string]any{"id": id, "output": output})
}
func ActionMoveColumnToMonitorLeft() Action {
return ActionCustom("MoveColumnToMonitorLeft", map[string]any{})
}
func ActionMoveColumnToMonitorRight() Action {
return ActionCustom("MoveColumnToMonitorRight", map[string]any{})
}
func ActionMoveColumnToMonitorDown() Action {
return ActionCustom("MoveColumnToMonitorDown", map[string]any{})
}
func ActionMoveColumnToMonitorUp() Action {
return ActionCustom("MoveColumnToMonitorUp", map[string]any{})
}
func ActionMoveColumnToMonitorPrevious() Action {
return ActionCustom("MoveColumnToMonitorPrevious", map[string]any{})
}
func ActionMoveColumnToMonitorNext() Action {
return ActionCustom("MoveColumnToMonitorNext", map[string]any{})
}
func ActionMoveColumnToMonitor(output OutputName) Action {
return ActionCustom("FocusMonitorNext", map[string]any{"output": output})
}
func ActionSetWindowWidth(id Option[WindowID], change SizeChange) Action {
return ActionCustom("SetWindowWidth", map[string]any{"id": id, "change": change})
}
func ActionSetWindowHeight(id Option[WindowID], change SizeChange) Action {
return ActionCustom("SetWindowHeight", map[string]any{"id": id, "change": change})
}
func ActionResetWindowHeight(id Option[WindowID]) Action {
return ActionCustom("ResetWindowHeight", map[string]any{"id": id})
}
func ActionSwitchPresetColumnWidth() Action {
return ActionCustom("SwitchPresetColumnWidth", map[string]any{})
}
func ActionSwitchPresetWindowWidth(id Option[WindowID]) Action {
return ActionCustom("SwitchPresetWindowWidth", map[string]any{"id": id})
}
func ActionSwitchPresetWindowHeight(id Option[WindowID]) Action {
return ActionCustom("SwitchPresetWindowHeight", map[string]any{"id": id})
}
func ActionMaximizeColumn() Action {
return ActionCustom("MaximizeColumn", map[string]any{})
}
func ActionSetColumnWidth(change SizeChange) Action {
return ActionCustom("SetColumnWidth", map[string]any{"change": change})
}
func ActionExpandColumnToAvailableWidth() Action {
return ActionCustom("ExpandColumnToAvailableWidth", map[string]any{})
}
func ActionSwitchLayout(layout LayoutSwitchTarget) Action {
return ActionCustom("SwitchLayout", map[string]any{"layout": layout})
}
func ActionShowHotkeyOverlay() Action {
return ActionCustom("ShowHotkeyOverlay", map[string]any{})
}
func ActionMoveWorkspaceToMonitorLeft() Action {
return ActionCustom("MoveWorkspaceToMonitorLeft", map[string]any{})
}
func ActionMoveWorkspaceToMonitorRight() Action {
return ActionCustom("MoveWorkspaceToMonitorRight", map[string]any{})
}
func ActionMoveWorkspaceToMonitorDown() Action {
return ActionCustom("MoveWorkspaceToMonitorDown", map[string]any{})
}
func ActionMoveWorkspaceToMonitorUp() Action {
return ActionCustom("MoveWorkspaceToMonitorUp", map[string]any{})
}
func ActionMoveWorkspaceToMonitorPrevious() Action {
return ActionCustom("MoveWorkspaceToMonitorPrevious", map[string]any{})
}
func ActionMoveWorkspaceToMonitorNext() Action {
return ActionCustom("MoveWorkspaceToMonitorNext", map[string]any{})
}
func ActionMoveWorkspaceToMonitor(output OutputName, reference Option[WorkspaceReferenceArg]) Action {
return ActionCustom("MoveWorkspaceToMonitor", map[string]any{"output": output, "reference": reference})
}
func ActionToggleDebugTint() Action {
return ActionCustom("ToggleDebugTint", map[string]any{})
}
func ActionDebugToggleOpaqueRegions() Action {
return ActionCustom("DebugToggleOpaqueRegions", map[string]any{})
}
func ActionDebugToggleDamage() Action {
return ActionCustom("DebugToggleDamage", map[string]any{})
}
func ActionToggleWindowFloating(id Option[WindowID]) Action {
return ActionCustom("ToggleWindowFloating", map[string]any{"id": id})
}
func ActionMoveWindowToFloating(id Option[WindowID]) Action {
return ActionCustom("MoveWindowToFloating", map[string]any{"id": id})
}
func ActionMoveWindowToTiling(id Option[WindowID]) Action {
return ActionCustom("MoveWindowToTiling", map[string]any{"id": id})
}
func ActionFocusFloating() Action {
return ActionCustom("FocusFloating", map[string]any{})
}
func ActionFocusTiling() Action {
return ActionCustom("FocusTiling", map[string]any{})
}
func ActionSwitchFocusBetweenFloatingAndTiling() Action {
return ActionCustom("SwitchFocusBetweenFloatingAndTiling", map[string]any{})
}
func ActionMoveFloatingWindow(id Option[WindowID], x PositionChange, y PositionChange) Action {
return ActionCustom("MoveFloatingWindow", map[string]any{"id": id, "x": x, "y": y})
}
func ActionToggleWindowRuleOpacity(id Option[WindowID]) Action {
return ActionCustom("ToggleWindowRuleOpacity", map[string]any{"id": id})
}
func ActionSetDynamicCastWindow(id Option[WindowID]) Action {
return ActionCustom("SetDynamicCastWindow", map[string]any{"id": id})
}
func ActionSetDynamicCastMonitor(output Option[OutputName]) Action {
return ActionCustom("SetDynamicCastMonitor", map[string]any{"output": output})
}
func ActionClearDynamicCastTarget() Action {
return ActionCustom("ClearDynamicCastTarget", map[string]any{})
}
func ActionToggleOverview() Action {
return ActionCustom("ToggleOverview", map[string]any{})
}
func ActionOpenOverview() Action {
return ActionCustom("OpenOverview", map[string]any{})
}
func ActionCloseOverview() Action {
return ActionCustom("CloseOverview", map[string]any{})
}
func ActionToggleWindowUrgent(id Option[WindowID]) Action {
return ActionCustom("ToggleWindowUrgent", map[string]any{"id": id})
}
func ActionSetWindowUrgent(id Option[WindowID]) Action {
return ActionCustom("SetWindowUrgent", map[string]any{"id": id})
}
func ActionUnsetWindowUrgent(id Option[WindowID]) Action {
return ActionCustom("UnsetWindowUrgent", map[string]any{"id": id})
}