Documentation
¶
Overview ¶
Contains enums for niri models.
These are not really structs, nor are they actions or events either, but can be used in models.
Package models contains all the necessary models for different niri objects.
Index ¶
- type Config
- type ConfiguredMode
- type ConfiguredPosition
- type KeyboardLayouts
- type Layer
- type LayerSurface
- type LayerSurfaceKeyboardInteractivity
- type LogicalOutput
- type Match
- type Mode
- type ModeToSet
- type NiriRequest
- type Output
- type OutputAction
- type OutputConfigChanged
- type Overview
- type PickedColor
- type PositionToSet
- type Response
- type Rule
- type ScaleToSet
- type Transform
- type VrrToSet
- type Window
- type Workspace
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// LogLevel is the log level to use. One of "DEBUG", "INFO", "WARN", "ERROR" should be used. Defaults to "INFO".
LogLevel string `json:"logLevel"`
// Rules contains the rules to match windows, and the actions to perform on them.
Rules []Rule `json:"rules,omitempty"`
// ScratchpadWorkspace is the name of the scratchpad workspace. Defaults to "scratchpad".
//
// NOTE: The named workspace must be defined in niri config.
ScratchpadWorkspace string `json:"scratchpadWorkspace,omitempty"`
}
Config contains the configuration for nirimgr.
type ConfiguredMode ¶
type ConfiguredMode struct {
// Width is the width in physical pixels.
Width uint16 `json:"width"`
// Height is the height in physical pixels.
Height uint16 `json:"height"`
// Refresh is the refresh rate.
Refresh float64 `json:"refresh,omitempty"`
}
ConfiguredMode is the output mode as set in the config file.
type ConfiguredPosition ¶
type ConfiguredPosition struct {
// X is the logical x position.
X int32 `json:"x"`
// Y is the logical y position.
Y int32 `json:"y"`
}
ConfiguredPosition is the output position as set in the config file.
type KeyboardLayouts ¶
type KeyboardLayouts struct {
// Names is the XKB names of the configured layouts.
Names []string `json:"names"`
// CurrentIdx is the index of the currently active layout in Names.
CurrentIdx uint8 `json:"current_idx"`
}
KeyboardLayouts is the configured keyboard layouts.
type Layer ¶
type Layer struct {
// Background is the background layer.
Background string `json:"Background,omitempty"`
// Bottom is the bottom layer.
Bottom string `json:"Bottom,omitempty"`
// Top is the top layer.
Top string `json:"Top,omitempty"`
// Overlay is the overlay layer.
Overlay string `json:"Overlay,omitempty"`
}
Layer is the layer-shell layer.
type LayerSurface ¶
type LayerSurface struct {
// Namespace is the namespace provided by the layer-shell client.
Namespace string `json:"namespace"`
// Output is the name of the output the surface is on.
Output string `json:"output"`
// Layer is the layer that the surface is on.
Layer Layer `json:"layer"`
// KeyboardInteractivity is the surface's keyboard interactivity mode.
KeyboardInteractivity LayerSurfaceKeyboardInteractivity `json:"keyboard_interactivity"`
}
LayerSurface is the layer-shell surface.
type LayerSurfaceKeyboardInteractivity ¶
type LayerSurfaceKeyboardInteractivity struct {
// None tells that the surface cannot receive keyboard focus.
None string `json:"None,omitempty"`
// Exclusive tells that the surface receives keyboard focus whenever possible.
Exclusive string `json:"Exclusive,omitempty"`
// OnDemand tells that the surface receives keyboard focus on demand, e.g. when clicked.
OnDemand string `json:"OnDemand,omitempty"`
}
LayerSurfaceKeyboardInteractivity is the keyboard interactivity modes for a layer-shell surface.
type LogicalOutput ¶
type LogicalOutput struct {
// X is the logical x position.
X int `json:"x"`
// Y is the logical y position.
Y int `json:"y"`
// Width is the width in logical pixels.
Width int `json:"width"`
// Height is the height in logical pixels.
Height int `json:"height"`
// Scale is the scale factor.
Scale float64 `json:"scale"`
// Transform sets the transformation of the output.
Transform Transform `json:"transform"`
}
LogicalOutput is the logical output in the compositor's coordinate space.
type Match ¶
type Match struct {
// Title matches the title of the window.
Title string `json:"title,omitempty"`
// AppID matches the app-id of the window.
AppID string `json:"appId,omitempty"`
}
Match is used to match a window.
type Mode ¶
type Mode struct {
// Width is the width in physical pixels.
Width int `json:"width"`
// Height is the height in physical pixels.
Height int `json:"height"`
// RefreshRate is the refresh rate in millihertz.
RefreshRate int `json:"refresh_rate"`
// IsPreferred tells whether this mode is preferred by the monitor.
IsPreferred bool `json:"is_preferred"`
}
Mode is the output mode.
type ModeToSet ¶
type ModeToSet struct {
// Automatic tells that niri will pick the mode automatically.
Automatic string `json:"Automatic,omitempty"`
// Specific tells that niri should pick a specific mode.
Specific ConfiguredMode `json:"Specific,omitempty"`
}
ModeToSet is the output mode to set.
type NiriRequest ¶
type NiriRequest string
NiriRequest is the representation of a simple niri request.
The request is sent to the socket as a string, e.g. "Windows" returns all the current windows.
const ( // Outputs lists connected outputs Outputs NiriRequest = "Outputs" // Workspaces lists workspaces Workspaces NiriRequest = "Workspaces" // Windows lists open windows Windows NiriRequest = "Windows" // Layers lists open layer-shell surfaces Layers NiriRequest = "Layers" // ListKeyboardLayouts lists the configured keyboard layouts ListKeyboardLayouts NiriRequest = "KeyboardLayouts" // FocusedOutput prints information about the focused output FocusedOutput NiriRequest = "FocusedOutput" // FocusedWindow prints information about the focused window FocusedWindow NiriRequest = "FocusedWindow" // PickWindow to pick a window with the mouse and print information about it. Not applicable to nirimgr. PickWindow NiriRequest = "PickWindow" // PickColor to pick a color from the screen with the mouse. Not applicable to nirimgr. PickColor NiriRequest = "PickColor" // RunAction performs an action RunAction NiriRequest = "Action" // ChangeOutput changes output configuration temporarily ChangeOutput NiriRequest = "Output" // EventStream starts continuously receiving events from the compositor EventStream NiriRequest = "EventStream" // Version prints the version of the running niri instance Version NiriRequest = "Version" // RequestError requests an error from the running niri instance RequestError NiriRequest = "RequestError" // OverviewState prints the overview state OverviewState NiriRequest = "OverviewState" )
type Output ¶
type Output struct {
// Name is the name of the output.
Name string `json:"name"`
// Make is the textual description of the manufacturer.
Make string `json:"make"`
// Model is the textual description of the model.
Model string `json:"model"`
// Serial is the serial of the output, if known.
Serial string `json:"serial"`
// PhysicalSize is the physical width and height of the output in mm, if known.
PhysicalSize []int `json:"physical_size"`
// Modes is the available modes for the output.
Modes []Mode `json:"modes"`
// CurrentMode is the current mode. None if the output is disabled.
CurrentMode int `json:"current_mode"`
// VrrSupported tells whether the output supports variable refresh rate.
VrrSupported bool `json:"vrr_supported"`
// VrrEnabled tells whether the variable refresh rate is enabled on the output.
VrrEnabled bool `json:"vrr_enabled"`
// Logical is the logical output information. None if the output is not mapped to any logical output (e.g. if it's disabled).
Logical LogicalOutput `json:"logical"`
}
Output is the connected output.
type OutputAction ¶
type OutputAction struct {
// Off tells niri to turn off the output.
Off string `json:"Off,omitempty"`
// On tells niri to turn on the output.
On string `json:"On,omitempty"`
// Mode tells niri which output mode to set.
Mode struct {
// Mode is the mode to set, or "auto" for automatic selection.
//
// Run niri msg outputs to see the available modes.
Mode ModeToSet `json:"mode"`
} `json:"Mode"`
// Scale tells niri which output scale to set.
Scale struct {
// Scale is the scale factor to set, or "auto" for automatic selection.
Scale ScaleToSet `json:"scale"`
} `json:"Scale"`
// Transform tells niri which output transform to set.
Transform struct {
// Transform is the transform to set, counter-clockwise.
Transform Transform `json:"transform"`
} `json:"Transform"`
// Position tells niri which output position to set.
Position struct {
// Position is the position to set, or "auto" for automatic selection.
Position PositionToSet `json:"position"`
} `json:"Position"`
// Vrr tells niri which variable refresh rate to set.
Vrr struct {
// Vrr is the variable refresh rate mode to set.
Vrr VrrToSet `json:"vrr"`
} `json:"Vrr"`
}
OutputAction is the output actions that niri can perform.
type OutputConfigChanged ¶
type OutputConfigChanged struct {
// Applied tells if the target output was connected and the change was applied.
Applied string `json:"Applied"`
// OutputWasMissing tells if the target output was not found, the change will be applied when it's connected.
OutputWasMissing string `json:"OutputWasMissing"`
}
OutputConfigChanged is the output configuration change result.
type Overview ¶
type Overview struct {
// IsOpen tells whether the overview is currently open or not.
IsOpen bool `json:"is_open"`
}
Overview is the overview information.
type PickedColor ¶
type PickedColor struct {
// RGB is the color values as red, green, blue, each ranging from 0.0 to 1.0.
RGB float64 `json:"rgb"`
}
PickedColor is the color picked from the screen.
type PositionToSet ¶
type PositionToSet struct {
// Automatic tells niri to position the output automatically.
Automatic string `json:"Automatic,omitempty"`
// Specific tells niri to use a specific position.
Specific ConfiguredPosition `json:"Specific,omitempty"`
}
PositionToSet is the output position to set.
type Response ¶
type Response struct {
Ok map[string]json.RawMessage `json:"Ok"`
}
Response contains the response from the Niri Socket.
type Rule ¶
type Rule struct {
// Match list of matches to target a window.
Match []Match `json:"match,omitempty"`
// Exclude list of matches to target a window, to be excluded from the match.
Exclude []Match `json:"exclude,omitempty"`
// Actions defines the action to do on the matching window.
//
// This is a json.RawMessage on purpose, since we need to
// dynamically create the action struct.
Actions map[string]json.RawMessage `json:"actions,omitempty"`
}
Rule contains the matches, excludes and actions for a window.
type ScaleToSet ¶
type ScaleToSet struct {
// Automatic tells niri to pick the scale automatically.
Automatic string `json:"Automatic,omitempty"`
// Specific tells niri to set a specific scale.
Specific float64 `json:"Specific,omitempty"`
}
ScaleToSet is the output scale to set.
type Transform ¶
type Transform struct {
// Normal is untransformed.
Normal string `json:"Normal,omitempty"`
// Rotate90 is rotated by 90 deg.
Rotate90 string `json:"_90,omitempty"`
// Rotate180 is rotated by 180 deg.
Rotate180 string `json:"_180,omitempty"`
// Rotate270 is rotated by 270 deg.
Rotate270 string `json:"_270,omitempty"`
// Flipped is flipped horizontally.
Flipped string `json:"Flipped,omitempty"`
// Flipped90 is rotated by 90 deg and flipped horizontally.
Flipped90 string `json:"Flipped90,omitempty"`
// Flipped180 is flipped vertically.
Flipped180 string `json:"Flipped180,omitempty"`
// Flipped270 is rotated by 270 deg and flipped horizontally.
Flipped270 string `json:"Flipped270,omitempty"`
}
Transform is the output transformation, which goes counter-clockwise.
type VrrToSet ¶
type VrrToSet struct {
// Vrr tells whether to enable variable refresh rate or not.
Vrr bool `json:"vrr"`
// OnDemand tells to only enable when the output shows a window matching the variable-refresh-rate window rule.
OnDemand bool `json:"on_demand"`
}
VrrToSet is the output variable refresh rate to set.
type Window ¶
type Window struct {
// ID is the unique ID of this window.
//
// This ID remains constant while this window is open.
//
// Do not assume that window IDs will always increase without wrapping, or start at 1.
// That is an implementation detail subject to change. For example, IDs may change to be
// randomly generated for each new window.
ID uint64 `json:"id"`
// Title is the window title, if set.
Title string `json:"title"`
// AppID is the application ID, if set.
AppID string `json:"app_id"`
// Pid is the process ID that created the Wayland connection for this window, if known.
//
// Currently, windows created by xdg-desktop-portal-gnome will have a None PID, but this
// may change in the future.
Pid int `json:"pid"`
// WorkspaceID is the ID of the workspace this window is on, if any.
WorkspaceID uint64 `json:"workspace_id"`
// IsFocused tell whether this window is currently focused.
//
// There can either be one focused window, or zero (e.g. when a layer-shell surface has focus).
IsFocused bool `json:"is_focused"`
// IsFloating tells whether this window is currently floating.
//
// If the window isn't floating, then it's in the tiling layout.
IsFloating bool `json:"is_floating"`
// IsUrgent tells whether this window requests your attention.
IsUrgent bool `json:"is_urgent"`
// Matched tells if the window matches a rule defined by nirimgr rules.
//
// This is not a part of the Niri Window model.
Matched bool
}
Window contains the details of a window.
type Workspace ¶
type Workspace struct {
// ID is the unique ID of this workspace.
//
// This id remains constant regardless of the workspace moving around and across monitors.
// Do not assume that workspace IDs will always increase without wrapping, or start at 1.
// That is an implementation detail subject to change.
// For example, IDs may change to be randomly generated for each new workspace.
ID uint64 `json:"id"`
// Idx is the index of the workspace on this monitor.
//
// This is the same index you can use for requests like niri msg action focus-workspace.
// This index will change as you move and re-order workspace. It is merely the workspace's
// current position on its monitor. Workspaces on different monitors can have the same index.
// If you need a unique workspace id that doesn’t change, see Id.
Idx uint8 `json:"idx"`
// Name is the optional name of the workspace.
Name string `json:"name"`
// Output is the name of the output that the workspace is on.
//
// Can be None if no outputs are currently connected.
Output string `json:"output"`
// IsUrgent tells whether the workspace currently has an urgent window in its output.
IsUrgent bool `json:"is_urgent"`
// IsActive tells whether the workspace is currently active on its output.
//
// Every output has one active workspace, the one that is currently visible on that output.
IsActive bool `json:"is_active"`
// IsFocused tells whether the workspace is currently focused.
//
// There's only one focused workspace across all outputs.
IsFocused bool `json:"is_focused"`
// ActiveWindowID is the ID of the active window on this workspace, if any.
ActiveWindowID uint64 `json:"active_window_id"`
}
Workspace is the workspace.