Skip to content

Class pinnacle.output ​

Output management.

An output is the Wayland term for a monitor. It presents windows, your cursor, and other UI elements.

Outputs are uniquely identified by their name, a.k.a. the name of the connector they're plugged in to.

Functions ​

function get_all ​

function pinnacle.output.get_all()
    -> pinnacle.output.OutputHandle[]

Gets all outputs.

Returns ​

  1. pinnacle.output.OutputHandle[]

function get_all_enabled ​

function pinnacle.output.get_all_enabled()
    -> pinnacle.output.OutputHandle[]

Gets all enabled outputs.

Returns ​

  1. pinnacle.output.OutputHandle[]

function get_by_name ​

function pinnacle.output.get_by_name(name: string)
    -> pinnacle.output.OutputHandle | nil

Gets an output by its name (the connector it's plugged into).

Parameters ​

name - The output's name.
  ┃ string

Returns ​

  1. pinnacle.output.OutputHandle | nil

function get_focused ​

function pinnacle.output.get_focused()
    -> pinnacle.output.OutputHandle | nil

Gets the currently focused output.

This is currently defined as the most recent one that has had pointer motion.

Returns ​

  1. pinnacle.output.OutputHandle | nil

function for_each_output ​

function pinnacle.output.for_each_output(for_each: fun(output: pinnacle.output.OutputHandle))

Runs a function on all current and future outputs.

When called, this will do two things:

  1. Immediately run for_each with all currently connected outputs.
  2. Call for_each with any newly connected outputs.

Note that for_each will not run with outputs that have been unplugged and replugged. This is to prevent duplicate setup. Instead, the compositor keeps track of any tags and state the output had when unplugged and restores them on replug. This may change in the future.

Example ​

lua
 -- Add tags "1" through "5" to all outputs
require("pinnacle.output").for_each_output(function(output)
    local tags = Tag.add(output, "1", "2", "3", "4", "5")
    tags[1]:toggle_active()
end)

Parameters ​

for_each - The function that will be run for each output.
  ┃ fun(output: pinnacle.output.OutputHandle)

function connect_signal ​

function pinnacle.output.connect_signal(signals: pinnacle.output.OutputSignal)
    -> signal_handles: pinnacle.signal.SignalHandles

Connects to an output signal.

signals is a table containing the signal(s) you want to connect to along with a corresponding callback that will be called when the signal is signalled.

This function returns a table of signal handles with each handle stored at the same key used to connect to the signal. See SignalHandles for more information.

Example ​

lua
Output.connect_signal({
    connect = function(output)
        print("New output connected:", output.name)
    end
})

Parameters ​

signals - The signal you want to connect to
  ┃ pinnacle.output.OutputSignal

Returns ​

  1. signal_handles: pinnacle.signal.SignalHandles - Handles to every signal you connected to wrapped in a table, with keys being the same as the connected signal.

See also ​

Last updated: