Skip to content

Class OutputMode ​

A resolution and refresh rate an output can run at, from output:modes() or output.mode.

A mode is a plain table, new on each read. Changing its fields changes nothing; assign a mode to output.mode to switch.

lua
for _, mode in ipairs(output:modes()) do
	print(mode.size.width .. "x" .. mode.size.height .. " at " .. mode.refresh / 1000 .. " Hz"
		.. (mode.current and " (current)" or "") .. (mode.preferred and " (preferred)" or ""))
end

Properties ​

mode.size: Sizesize ​

The resolution in physical pixels.

mode.refresh: integerrefresh ​

The refresh rate in millihertz. 60000 is 60 Hz, 143998 is just under 144 Hz.

  • In a table assigned to output.mode, leaving it out or 0 takes the highest refresh at that size.

mode.current: booleancurrent ​

Whether the output is using this mode now.

mode.preferred: booleanpreferred ​

Whether this is the mode the monitor asks for, usually its native resolution.

  • Under the nested backend and on a virtual output, the one mode is both current and preferred.