Skip to content

Class TagHandle

A tag handle.

This is a handle that allows manipulation of a tag.

This can be retrieved through the various get functions in the Tag module.

Fields

id

id: integer

Functions

method remove

function TagHandle:remove()

Remove this tag.

Example

lua
local tags = Tag.add(Output.get_by_name("HDMI-1"), "1", "2", "Buckle", "Shoe")

tags[2]:remove()
tags[4]:remove()
 -- "HDMI-1" now only has tags "1" and "Buckle"

method switch_to

function TagHandle:switch_to()

Activate this tag and deactivate all other ones on the same output.

Example

lua
 -- Assume the focused output has the following inactive tags and windows:
 --  - "1": Alacritty
 --  - "2": Firefox, Discord
 --  - "3": Steam
Tag.get("2"):switch_to() -- Displays Firefox and Discord
Tag.get("3"):switch_to() -- Displays Steam

method set_active

function TagHandle:set_active(active: boolean)

Set whether or not this tag is active.

Example

lua
 -- Assume the focused output has the following inactive tags and windows:
 --  - "1": Alacritty
 --  - "2": Firefox, Discord
 --  - "3": Steam
Tag.get("2"):set_active(true)  -- Displays Firefox and Discord
Tag.get("3"):set_active(true)  -- Displays Firefox, Discord, and Steam
Tag.get("2"):set_active(false) -- Displays Steam

Parameters

active: boolean

method toggle_active

function TagHandle:toggle_active()

Toggle this tag's active state.

Example

lua
 -- Assume the focused output has the following inactive tags and windows:
 --  - "1": Alacritty
 --  - "2": Firefox, Discord
 --  - "3": Steam
Tag.get("2"):toggle_active() -- Displays Firefox and Discord
Tag.get("2"):toggle_active() -- Displays nothing

method props

function TagHandle:props()
    -> TagProperties

Get all properties of this tag.

Returns

  1. TagProperties

method active

function TagHandle:active()
    -> boolean

Get whether or not this tag is being displayed.

Shorthand for handle:props().active.

Returns

  1. boolean

method name

function TagHandle:name()
    -> string

Get this tag's name.

Shorthand for handle:props().name.

Returns

  1. string

method output

function TagHandle:output()
    -> OutputHandle

Get the output this tag is on.

Shorthand for handle:props().output.

Returns

  1. OutputHandle

method windows

function TagHandle:windows()
    -> WindowHandle[]

Get the windows that have this tag.

Shorthand for handle:props().windows.

Returns

  1. WindowHandle[]