Module: tag

awesome tag API.

What is a tag?

In AwesomeWM, a tag is a group of clients. It can either be used as labels or as more classical workspaces depending on how they are configured.

Client geometry

  • A tag can be attached to multiple clients
  • A client can be attached to multiple tags
  • A tag can only be in 1 screen any given time, but can be moved
  • All clients attached to a tag must be in the same screen as the tag

Creating tags

The default config initializes tags like this:

awful.tag(
  { "1", "2", "3", "4", "5", "6", "7", "8", "9" },
  s,
  awful.layout.layouts[1]
)

If you wish to have tags with different properties, then awful.tag.add is a better choice:

awful.tag.add("First tag", {
    icon               = "/path/to/icon1.png",
    layout             = awful.layout.suit.tile,
    master_fill_policy = "master_width_factor",
    gap_single_client  = true,
    gap                = 15,
    screen             = s,
    selected           = true,
})

awful.tag.add("Second tag", {
    icon = "/path/to/icon2.png",
    layout = awful.layout.suit.max,
    screen = s,
})

Note: the example above sets “First tag” to be selected explicitly, because otherwise you will find yourself without any selected tag.

Accessing tags

To access the “current tags”, use

local tags = awful.screen.focused().selected_tags

See: awful.screen.focused

See: screen.selected_tags

To ignore the corner case where multiple tags are selected:

local t = awful.screen.focused().selected_tag

See: screen.selected_tag

To get all tags for the focused screen:

local tags = awful.screen.focused().tags

See: screen.tags

To get all tags:

local tags = root.tags()

To get the current tag of the focused client:

local t = client.focus and client.focus.first_tag or nil

See: client.focus See: client.first_tag

To get a tag from its name:

local t = awful.tag.find_by_name(awful.screen.focused(), "name")

Common keybindings code

Here is a few useful shortcuts not part of the default rc.lua. Add these functions above – {{{ Key bindings:

Delete the current tag

local function delete_tag()
    local t = awful.screen.focused().selected_tag
    if not t then return end
    t:delete()
end

Create a new tag at the end of the list

local function add_tag()
    awful.tag.add("NewTag", {
        screen = awful.screen.focused(),
        layout = awful.layout.suit.floating }):view_only()
end

Rename the current tag

local function rename_tag()
    awful.prompt.run {
        prompt       = "New tag name: ",
        textbox      = awful.screen.focused().mypromptbox.widget,
        exe_callback = function(new_name)
            if not new_name or #new_name == 0 then return end

            local t = awful.screen.focused().selected_tag
            if t then
                t.name = new_name
            end
        end
    }
end

Move the focused client to a new tag

local function move_to_new_tag()
    local c = client.focus
    if not c then return end

    local t = awful.tag.add(c.class,{screen= c.screen })
    c:tags({t})
    t:view_only()
end

Copy the current tag at the end of the list

local function copy_tag()
    local t = awful.screen.focused().selected_tag
    if not t then return end

    local clients = t:clients()
    local t2 = awful.tag.add(t.name, awful.tag.getdata(t))
    t2:clients(clients)
    t2:view_only()
end

And, in the globalkeys table:

awful.key({ modkey,           }, "a", add_tag,
          {description = "add a tag", group = "tag"}),
awful.key({ modkey, "Shift"   }, "a", delete_tag,
          {description = "delete the current tag", group = "tag"}),
awful.key({ modkey, "Control"   }, "a", move_to_new_tag,
          {description = "add a tag with the focused client", group = "tag"}),
awful.key({ modkey, "Mod1"   }, "a", copy_tag,
          {description = "create a copy of the current tag", group = "tag"}),
awful.key({ modkey, "Shift"   }, "r", rename_tag,
          {description = "rename the current tag", group = "tag"}),

See the global keybindings for more information about the keybindings.

Some signal names are starting with a dot. These dots are artefacts from the documentation generation, you get the real signal name by removing the starting dot.

Usage example

Core components relationship

Acquire other objects from a tag
Class Property
client t:clients()
screen t.screen
Acquire a tag from other objects
Class Property
client c.tags
screen s.tags
screen s.selected_tag
screen s.selected_tags
Legend: c: a client object, t: a tag object, s: a screen object, k: an awful.key object, b: a awful.button object, n: a naughty.notification object

Info:

Constructors

awful.tag.add (name, props) Add a tag.

Static module functions

tag.instances () -> () Get the number of instances.
tag.disconnect_signal (name, func) Disconnect from a signal.
tag.emit_signal (name, ...) Emit a signal.
tag.connect_signal (name, func) Connect to a signal.
awful.tag.new (names[, screen=1], layout) -> table Create a set of tags and attach it to a screen.
awful.tag.find_fallback (screen, invalids) Find a suitable fallback tag.
awful.tag.history.update (obj) Update the tag history.
awful.tag.history.restore (screen, idx) Revert tag history.
awful.tag.find_by_name (s, name) -> () Find a tag by name.
awful.tag.incmwfact (add, t) Increase master width factor.
awful.tag.incgap (add, t) Increase the spacing between clients
awful.tag.togglemfpol (t) Toggle size fill policy for the master client(s) between “expand” and “master_width_factor”.
awful.tag.incnmaster (add[, t[, sensible=false]]) Increase the number of master windows.
awful.tag.incncol (add[, t[, sensible=false]]) Increase number of column windows.
awful.tag.viewnone ([screen]) View no tag.
awful.tag.viewidx (i[, screen]) Select a tag relative to the currently selected one.
awful.tag.viewnext (screen) View next tag.
awful.tag.viewprev (screen) View previous tag.
awful.tag.viewmore (tags[, screen[, maximum=#tags]]) View only a set of tags.
awful.tag.viewtoggle (t) Toggle selection of a tag
awful.tag.attached_connect_signal (screen[, signal[, Callback]]) Add a signal to all attached tags and all tags that will be attached in the future.

Object properties

name string Tag name.
selected boolean True if the tag is selected to be viewed.
activated boolean True if the tag is active and can be used.
index integer The tag index.
screen screen The tag screen.
master_width_factor number The tag master width factor.
layout layout or function The tag client layout.
layouts table The (proposed) list of available layouts for this tag.
volatile boolean Define if the tag must be deleted when the last client is untagged.
gap number The gap (spacing, also called useless_gap) between clients.
gap_single_client boolean Enable gaps for a single client.
master_fill_policy string Set size fill policy for the master client(s).
master_count integer Set the number of master windows.
icon path or surface Set the tag icon.
column_count integer Set the number of columns.

Object methods

:clients ([clients_table=nil]) -> () Get or set the clients attached to this tag.
:swap (tag2) Swap 2 tags.
:clear {[args]} Remove all tagged clients.
:delete ([fallback_tag=awful.tag.find_fallback()[, force=false]]) -> () Delete a tag.
:view_only () View only a tag.
:emit_signal (name, ...) Emit a signal. Inherited from gears.object
:connect_signal (name, func) Connect to a signal. Inherited from gears.object
:weak_connect_signal (name, func) Connect to a signal weakly. Inherited from gears.object

Signals

request::select When a tag requests to be selected.
request::default_layouts This signal is emitted to fill the list of default layouts.
request::layouts This signals is emitted when a tag needs layouts for the first time.
tagged When a client gets tagged with this tag.
untagged When a client gets untagged with this tag.
cleared When all clients are removed from the tag.
property::urgent True when a tagged client is urgent
property::urgent_count The number of urgent tagged clients
request::screen Emitted when a screen is removed.
removal-pending Emitted after request::screen if no new screen has been set.

Theme variables

beautiful.master_width_factor number The default master width factor
beautiful.useless_gap number The default gap.
beautiful.gap_single_client boolean Enable gaps for a single client.
beautiful.master_fill_policy string The default fill policy.
beautiful.master_count integer The default number of master windows.
beautiful.column_count integer The default number of columns.

Deprecated functions

awful.tag.move [deprecated] Move a tag to an absolute position in the screen[]:tags() table.
awful.tag.swap [deprecated] Swap 2 tags
awful.tag.delete [deprecated] Delete a tag.
awful.tag.gettags [deprecated] Get a list of all tags on a screen
awful.tag.setscreen [deprecated] Set a tag’s screen
awful.tag.getscreen [deprecated] Get a tag’s screen
awful.tag.selectedlist [deprecated] Return a table with all visible tags
awful.tag.selected [deprecated] Return only the first visible tag.
awful.tag.setmwfact [deprecated] Set master width factor.
awful.tag.getmwfact [deprecated] Get master width factor.
awful.tag.setlayout [deprecated] Set layout.
awful.tag.setvolatile [deprecated] Set if the tag must be deleted when the last client is untagged
awful.tag.getvolatile [deprecated] Get if the tag must be deleted when the last client closes
awful.tag.setgap [deprecated] Set the spacing between clients
awful.tag.getgap [deprecated] Get the spacing between clients.
awful.tag.setmfpol [deprecated] Set size fill policy for the master client(s)
awful.tag.getmfpol [deprecated] Get size fill policy for the master client(s)
awful.tag.setnmaster [deprecated]
awful.tag.getnmaster [deprecated] Get the number of master windows.
awful.tag.seticon [deprecated] Set the tag icon
awful.tag.geticon [deprecated] Get the tag icon
awful.tag.setncol [deprecated] Set number of column windows.
awful.tag.getncol [deprecated] Get number of column windows.
awful.tag.getidx [deprecated] Get a tag’s index in the gettags() table.
awful.tag.viewonly [deprecated] View only a tag.
awful.tag.getdata [deprecated] Get tag data table.
awful.tag.getproperty [deprecated] Get a tag property.
awful.tag.setproperty [deprecated] Set a tag property.
awful.tag.withcurrent [deprecated] Tag a client with the set of current tags.

Fields

tag.awful.tag.history.limit integer The number of elements kept in the history.
tag.awful.tag.layouts N/A An ordered list of layouts.


Constructors

awful.tag.add (name, props)

Add a tag.

This function allow to create tags from a set of properties:

local t = awful.tag.add("my new tag", {
    screen = screen.primary,
    layout = awful.layout.suit.max,
})

Parameters:

  • name The tag name, a string
  • props The tags inital properties, a table

Returns:

    The created tag

See also:

Static module functions

tag.instances () -> ()
Get the number of instances.

Returns:

    The number of tag objects alive.
tag.disconnect_signal (name, func)
Disconnect from a signal.

Parameters:

  • name string The name of the signal.
  • func function The callback that should be disconnected.
tag.emit_signal (name, ...)
Emit a signal.

Parameters:

  • name string The name of the signal.
  • ... Extra arguments for the callback functions. Each connected function receives the object as first argument and then any extra arguments that are given to emit_signal().
tag.connect_signal (name, func)
Connect to a signal.

Parameters:

  • name string The name of the signal.
  • func function The callback to call when the signal is emitted.
awful.tag.new (names[, screen=1], layout) -> table

Create a set of tags and attach it to a screen.

This is what’s performed by the default config:

Usage example

 -- Calling awful.tag.new
 awful.tag({ '1', '2', '3', '4', '5', '6', '7', '8', '9' }, screen[1], awful.layout.layouts[1])

It is also possible to set multiple layouts:

Usage example

 local some_layouts = {
     awful.layout.suit.fair,
     awful.layout.suit.spiral,
     awful.layout.suit.spiral.dwindle,
     awful.layout.suit.magnifier,
     awful.layout.suit.corner.nw,
 }

 -- Calling awful.tag.new
 awful.tag({ 'one', 'two', 'three', 'four', 'five' }, screen[1], some_layouts)

 -- Add some clients
 for _, t in ipairs(screen[1].tags) do
     for _ = 1, 5 do
         awful.spawn('xterm', {tag = t})
     end
 end

Parameters:

  • names table The tag name, in a table
  • screen screen or number The tag screen (defaults to screen 1). (default 1)
  • layout table The layout or layout table to set for this tags by default.

Returns:

    table A table with all created tags.
awful.tag.find_fallback (screen, invalids)
Find a suitable fallback tag.

Parameters:

  • screen The screen to look for a tag on. [awful.screen.focused()]
  • invalids A table of tags we consider unacceptable. [selectedlist(scr)]
awful.tag.history.update (obj)
Update the tag history.

Parameters:

  • obj Screen object.
awful.tag.history.restore (screen, idx)
Revert tag history.

Parameters:

  • screen The screen.
  • idx Index in history. Defaults to “previous” which is a special index toggling between last two selected sets of tags. Number (eg 1) will go back to the given index in history.
awful.tag.find_by_name (s, name) -> ()
Find a tag by name.

Parameters:

  • s screen The screen of the tag
  • name string The name of the tag

Returns:

    The tag found, or nil

Usage:

    -- For the current screen
    local t = awful.tag.find_by_name(awful.screen.focused(), "name")
    
    -- For a screen index
    local t = awful.tag.find_by_name(screen[1], "name")
    
    -- For all screens
    local t = awful.tag.find_by_name(nil, "name")
awful.tag.incmwfact (add, t)
Increase master width factor.

Parameters:

  • add Value to add to master width factor.
  • t The tag to modify, if null tag.selected() is used.

See also:

awful.tag.incgap (add, t)
Increase the spacing between clients

Parameters:

  • add Value to add to the spacing between clients
  • t The tag to modify, if null tag.selected() is used.

See also:

awful.tag.togglemfpol (t)
Toggle size fill policy for the master client(s) between “expand” and “master_width_factor”.

Parameters:

  • t tag The tag to modify, if null tag.selected() is used.

See also:

awful.tag.incnmaster (add[, t[, sensible=false]])
Increase the number of master windows.

Parameters:

  • add Value to add to number of master windows.
  • t The tag to modify, if null tag.selected() is used. (optional)
  • sensible boolean Limit nmaster based on the number of visible tiled windows? (default false)

See also:

awful.tag.incncol (add[, t[, sensible=false]])
Increase number of column windows.

Parameters:

  • add Value to add to number of column windows.
  • t The tag to modify, if null tag.selected() is used. (optional)
  • sensible boolean Limit column_count based on the number of visible tiled windows? (default false)
awful.tag.viewnone ([screen])

View no tag.

Usage example

 -- Calling awful.tag.new
 awful.tag({ 'one', 'two', 'three', 'four' }, screen[1])

 -- Manually select some tags (tag 1 was auto selected).
 screen[1].tags[3].selected = true
 screen[1].tags[4].selected = true

 -- Deselect all tags.
 awful.tag.viewnone()

Parameters:

  • screen int or screen The screen. (optional)
awful.tag.viewidx (i[, screen])
Select a tag relative to the currently selected one.

Note that this doesn’t work well with multiple selection.

Usage example

 -- Calling awful.tag.new
 awful.tag({ 'one', 'two', 'three', 'four' }, screen[1])

 screen[1].tags[2]:view_only()

 -- Select the tag relative to idx 2.
 awful.tag.viewidx(2)

 -- Select the tag relative to idx -2.
 awful.tag.viewidx(-2)

This is equivalent to screen.tags[i]:view_only()

Parameters:

  • i number The relative index to see.
  • screen screen The screen. (optional)

See also:

awful.tag.viewnext (screen)

View next tag. This is the same as tag.viewidx(1).

Note that this doesn’t work well with multiple selection.

Usage example

 -- Calling awful.tag.new
 awful.tag({ 'one', 'two', 'three', 'four' }, screen[1])

 screen[1].tags[3]:view_only()

 -- Select the next tag.
 awful.tag.viewnext()

 -- Select the next tag (again).
 awful.tag.viewnext()

Parameters:

See also:

awful.tag.viewprev (screen)

View previous tag. This is the same a tag.viewidx(-1).

Note that this doesn’t work well with multiple selection.

Usage example

 -- Calling awful.tag.new
 awful.tag({ 'one', 'two', 'three', 'four' }, screen[1])

 screen[1].tags[2]:view_only()

 -- Select the previous tag.
 awful.tag.viewprev()

 -- Select the previous tag (again).
 awful.tag.viewprev()

Parameters:

See also:

awful.tag.viewmore (tags[, screen[, maximum=#tags]])
View only a set of tags.

If maximum is set, there will be a limit on the number of new tag being selected. The tags already selected do not count. To do nothing if one or more of the tags are already selected, set maximum to zero.

Parameters:

  • tags table A table with tags to view only.
  • screen screen The screen of the tags. (optional)
  • maximum number The maximum number of tags to select. (default #tags)
awful.tag.viewtoggle (t)
Toggle selection of a tag

Parameters:

  • t tag Tag to be toggled

See also:

awful.tag.attached_connect_signal (screen[, signal[, Callback]])
Add a signal to all attached tags and all tags that will be attached in the future. When a tag is detached from the screen, its signal is removed.

Parameters:

  • screen screen The screen concerned, or all if nil.
  • signal string The signal name. (optional)
  • Callback function (optional)

Object properties

name string

Tag name.

Usage example

  -- Calling awful.tag.new
  awful.tag({ 'one', 'two', 'three', 'four' }, screen[1])

  screen[1].tags[2]:view_only()

  -- Change the name to New*tag*name.
  screen[1].tags[2].name = 'New*tag*name'

Signal:

  • property::name
selected boolean

True if the tag is selected to be viewed.

Usage example

  -- Calling awful.tag.new
  awful.tag({ 'one', 'two', 'three', 'four' }, screen[1])

  -- Change the selection.
  screen[1].tags[1].selected = not screen[1].tags[1].selected
  screen[1].tags[2].selected = true
  screen[1].tags[3].selected = true

Signal:

  • property::selected
activated boolean

True if the tag is active and can be used.

Signal:

  • property::activated
index integer

The tag index.

Usage example

 -- Calling awful.tag.new
 awful.tag({ 'one', 'two', 'three', 'four' }, screen[1])

 -- Send the first tag to index 3.
 screen[1].tags[1].index = 3

 -- Send the first tag to index 3.
 screen[1].tags[4].index = 1

The index is the position as shown in the awful.widget.taglist.

Signal:

  • property::index
screen screen

The tag screen.

Signal:

  • property::screen

See also:

master_width_factor number

The tag master width factor.

The master width factor is one of the 5 main properties used to configure the layout. Each layout interpret (or ignore) this property differenly.

See the layout suit documentation for information about how the master width factor is used.

Signal:

  • property::mwfact (deprecated)
  • property::master_width_factor

Type constraints:

  • number Between 0 and 1

See also:

layout layout or function

The tag client layout.

This property holds the layout. A layout can be either stateless or stateful. Stateless layouts are used by default by Awesome. They tile clients without any other overhead. They take an ordered list of clients and place them on the screen. Stateful layouts create an object instance for each tags and can store variables and metadata. Because of this, they are able to change over time and be serialized (saved).

Both types of layouts have valid usage scenarios.

Stateless layouts:

These layouts are stored in awful.layout.suit. They expose a table with 2 fields:

  • name (string): The layout name. This should be unique.
  • arrange (function): The function called when the clients need to be placed. The only parameter is a table or arguments returned by awful.layout.parameters

Stateful layouts:

The stateful layouts API is the same as stateless, but they are a function returining a layout instead of a layout itself. They also should have an is_dynamic = true property. If they don’t, awful.tag will create a new instance everytime the layout is set. If they do, the instance will be cached and re-used.

The client organized by the layout will fill the screen tiling_area section:

Usage example

Signal:

  • property::layout

Type constraints:

  • layout layout or function A layout table or a constructor function

See also:

layouts table · 1 permission
The (proposed) list of available layouts for this tag.

This property allows to define a subset (or superset) of layouts available in the “rotation table”. In the default configuration file, Mod4+Space and Mod4+Shift+Space are used to switch between tags. The awful.widget.layoutlist also uses this as its default layout filter.

By default, it will be the same as awful.layout.layouts unless there the a layout not present is used. If that’s the case they will be added at the front of the list.

See also:


Click to display more

Requested actions or permissions:

Class Permission Context Default Description
taglayoutsawfulgrantedWhen the layouts property is first called and there is no layouts, then that signal is called.
volatile boolean

Define if the tag must be deleted when the last client is untagged.

This is useful to create “throw-away” tags for operation like 50/50 (Windows “Aero Snap) side-by-side views. This keybinding code for this is:

local function aero_tag()
    local c = client.focus

    if not c then return end

    local c2 = awful.client.focus.history.list[2]

    if (not c2) or c2 == c then return end

    local t = awful.tag.add("Aero", {
        screen              = c.screen,
        volatile            = true,
        layout              = awful.layout.suit.tile,
        master_width_factor = 0.5
    })

    t:clients({c, c2})

    t:view_only()
end

Usage example

 -- Create a non-volatile and a volatile tag.
 awful.tag.add('Non-Volatile', {
     screen   = screen[1],
     layout   = awful.layout.suit.corner.nw,
     volatile = false,
 })

 awful.tag.add('Volatile', {
     screen   = screen[1],
     layout   = awful.layout.suit.corner.nw,
     volatile = true,
 })

 -- Add some clients.
 for _, t in ipairs(screen[1].tags) do
     for _ = 1, 5 do
         awful.spawn('xterm', {tag = t})
     end
 end

 -- Kill all clients.
 while #client.get() ~= 0 do
     client.get()[1]:kill()
 end

As you can see, the “Volatile” tag has been automatically discarded while the “Non-volatile” tag is still there (but with zero clients).

Signal:

  • property::volatile

See also:

gap number

The gap (spacing, also called useless_gap) between clients.

This property allow to waste space on the screen in the name of style, unicorns and readability.

Signal:

  • property::useless_gap

Type constraints:

  • number The value has to be greater than zero.

See also:

gap_single_client boolean

Enable gaps for a single client.

Signal:

  • property::gap_single_client

Type constraints:

  • boolean Enable gaps for a single client
master_fill_policy string

Set size fill policy for the master client(s).

Possible values:

  • expand: Take all the space
  • master_width_factor: Only take the ratio defined by the master_width_factor

Signal:

  • property::master_fill_policy

Type constraints:

  • string “expand” or “master_width_factor”
master_count integer

Set the number of master windows.

Usage example

 -- Create a tag with master count of 1 and tag with count of 2
 awful.tag.add('Master 1', {
     screen   = screen[1],
     layout   = awful.layout.suit.tile,
     master_count = 1,
 })

 awful.tag.add('Master 2', {
     screen   = screen[1],
     layout   = awful.layout.suit.tile,
     master_count = 2,
 })

 -- Add some clients.
 for _, t in ipairs(screen[1].tags) do
     for _ = 1, 5 do
         awful.spawn('xterm', {tag = t})
     end
 end

Signal:

  • property::nmaster (deprecated)
  • property::master_count

Type constraints:

  • integer nmaster Only positive values are accepted
icon path or surface

Set the tag icon.

Signal:

  • property::icon

Type constraints:

  • icon path or surface The icon
column_count integer

Set the number of columns.

Signal:

  • property::ncol (deprecated)
  • property::column_count

Type constraints:

  • ncol integer Has to be greater than 1

Object methods

:clients ([clients_table=nil]) -> ()
Get or set the clients attached to this tag.

Parameters:

  • clients_table table None or a table of clients to set as being tagged with this tag. (default nil)

Returns:

    A table with the clients attached to this tags.
:swap (tag2)

Swap 2 tags.

Usage example

 -- Calling awful.tag.new
 awful.tag({ 'one', 'two', 'three', 'four' }, screen[1])

 screen[1].tags[2]:view_only()

 -- Swap tag 2 with tag 4.
 screen[1].tags[2]:swap(screen[1].tags[4])

Parameters:

  • tag2 The second tag

See also:

:clear {[args]} · 2 signals
Remove all tagged clients.

Usage example

 -- Calling awful.tag.new
 awful.tag({ 'one', 'two' }, screen[1], some_layouts)

 -- Call :clear() on the first tag.
 screen[1].tags[1]:clear{}

end)

Parameters:

  • args The arguments.
    • fallback_tag tag A fallback tag.
    • allow_untagged boolean Allow the untagged clients to remain untagged. (default false)

Click to display more

Emit signals:

  • cleared After all clients have been untagged.
  • untagged For each currently tagged clients.
    • c client The untagged client.
:delete ([fallback_tag=awful.tag.find_fallback()[, force=false]]) -> ()

Delete a tag.

To delete the current tag:

Usage example

 -- Calling awful.tag.new
 awful.tag({ 'one', 'two', 'three', 'four' }, screen[1])

 screen[1].tags[2]:view_only()

 -- Delete the selected tag.
 mouse.screen.selected_tag:delete()

Parameters:

  • fallback_tag tag Tag to assign stickied tags to. (default awful.tag.find_fallback())
  • force boolean Move even non-sticky clients to the fallback tag. (default false)

Returns:

    Returns true if the tag is successfully deleted. If there are no clients exclusively on this tag then delete it. Any stickied clients are assigned to the optional ‘fallback_tag’. If after deleting the tag there is no selected tag, try and restore from history or select the first tag on the screen.

See also:

:view_only ()

View only a tag.

Usage example

 -- Calling awful.tag.new
 awful.tag({ 'one', 'two', 'three', 'four' }, screen[1])

 -- Manually select some tags (tag 1 was auto selected).
 screen[1].tags[3].selected = true
 screen[1].tags[4].selected = true

 -- Call :view_only() on the second tag.
 screen[1].tags[2]:view_only()

See also:

:emit_signal (name, ...) · Inherited from gears.object
Emit a signal.

Parameters:

  • name string The name of the signal.
  • ... Extra arguments for the callback functions. Each connected function receives the object as first argument and then any extra arguments that are given to emit_signal().
:connect_signal (name, func) · Inherited from gears.object
Connect to a signal.

Parameters:

  • name string The name of the signal.
  • func function The callback to call when the signal is emitted.
:weak_connect_signal (name, func) · Inherited from gears.object
Connect to a signal weakly.

This allows the callback function to be garbage collected and automatically disconnects the signal when that happens.

Warning: Only use this function if you really, really, really know what you are doing.

Parameters:

  • name string The name of the signal.
  • func function The callback to call when the signal is emitted.

Signals

request::select · 1 permission
When a tag requests to be selected.

Arguments:

  • context string The reason why it was called.

Click to display more

Requested actions or permissions:

Class Permission Context Default Description
tagselectewmhgrantedWhen the client request to be moved to a specific virtual desktop. AwesomeWM interprets virtual desktop as indexed tags.
request::default_layouts · 1 permission · Class level only
This signal is emitted to fill the list of default layouts.

It is emitted on the global tag class rather than individual tag objects. The default handler is part of rc.lua. New modules can also use this signal to dynamically add new layouts to the list of default layouts.

Arguments:

  • context string The context (currently always “startup”).

See also:


Click to display more

Requested actions or permissions:

Class Permission Context Default Description
tagdefault_layoutsstartupgrantedWhen AwesomeWM starts, it queries for default layout using this request.
request::layouts
This signals is emitted when a tag needs layouts for the first time.

If no handler implement it, it will fallback to the content added by request::default_layouts

Arguments:

  • context string The context (currently always “awful”).
  • hints table A, currently empty, table with hints.
tagged
When a client gets tagged with this tag.

Arguments:

  • c client The tagged client.
untagged
When a client gets untagged with this tag.

Arguments:

  • c client The untagged client.
cleared
When all clients are removed from the tag.

See also:

property::urgent
True when a tagged client is urgent

See also:

property::urgent_count
The number of urgent tagged clients

See also:

request::screen
Emitted when a screen is removed. This can be used to salvage existing tags by moving them to a new screen (or creating a virtual screen). By default, there is no handler for this request. The tags will be deleted. To prevent this, an handler for this request must simply set a new screen for the tag.

Arguments:

  • context string Why it was called.
removal-pending
Emitted after request::screen if no new screen has been set. The tag will be deleted, this is a last chance to move its clients before they are sent to a fallback tag. Connect to request::screen if you wish to salvage the tag.

Theme variables

beautiful.master_width_factor number
The default master width factor

Type constraints:

  • number (default: 0.5)

See also:

beautiful.useless_gap number
The default gap.

Type constraints:

  • number (default: 0)

See also:

beautiful.gap_single_client boolean
Enable gaps for a single client.

Type constraints:

  • boolean (default: true)

See also:

beautiful.master_fill_policy string

The default fill policy.

Possible values:

  • expand: Take all the space
  • master_width_factor: Only take the ratio defined by the master_width_factor

Type constraints:

  • string (default: “expand”)

See also:

beautiful.master_count integer
The default number of master windows.

Type constraints:

  • integer (default: 1)

See also:

beautiful.column_count integer
The default number of columns.

Type constraints:

  • integer (default: 1)

See also:

Deprecated functions

awful.tag.move [deprecated]
Move a tag to an absolute position in the screen[]:tags() table.

Parameters:

  • new_index Integer absolute position in the table to insert.
  • target_tag The tag that should be moved. If null, the currently selected tag is used.

See also:

awful.tag.swap [deprecated]
Swap 2 tags

Parameters:

  • tag1 The first tag
  • tag2 The second tag

See also:

awful.tag.delete [deprecated]
Delete a tag.

Parameters:

  • target_tag Optional tag object to delete. [selected()]
  • fallback_tag Tag to assign stickied tags to. [~selected()]

Returns:

    Returns true if the tag is successfully deleted, nil otherwise. If there are no clients exclusively on this tag then delete it. Any stickied clients are assigned to the optional ‘fallback_tag’. If after deleting the tag there is no selected tag, try and restore from history or select the first tag on the screen.

See also:

awful.tag.gettags [deprecated]
Get a list of all tags on a screen

Parameters:

Returns:

    A table with all available tags

See also:

awful.tag.setscreen [deprecated]
Set a tag’s screen

Parameters:

  • s Screen
  • t tag object

See also:

awful.tag.getscreen [deprecated]
Get a tag’s screen

Parameters:

  • t tag object (optional)

Returns:

    Screen number

See also:

awful.tag.selectedlist [deprecated]
Return a table with all visible tags

Parameters:

  • s Screen.

Returns:

    A table with all selected tags.

See also:

awful.tag.selected [deprecated]
Return only the first visible tag.

Parameters:

  • s Screen.

See also:

awful.tag.setmwfact [deprecated]
Set master width factor.

Parameters:

  • mwfact Master width factor.
  • t The tag to modify, if null tag.selected() is used.

See also:

awful.tag.getmwfact [deprecated]
Get master width factor.

Parameters:

  • t The tag. (optional)

See also:

awful.tag.setlayout [deprecated]
Set layout.

Parameters:

  • layout a layout table or a constructor function
  • t The tag to modify

Returns:

    The layout

See also:

awful.tag.setvolatile [deprecated]
Set if the tag must be deleted when the last client is untagged

Parameters:

  • volatile boolean If the tag must be deleted when the last client is untagged
  • t The tag to modify, if null tag.selected() is used.

See also:

awful.tag.getvolatile [deprecated]
Get if the tag must be deleted when the last client closes

Parameters:

  • t The tag to modify, if null tag.selected() is used.

Returns:

    boolean If the tag will be deleted when the last client is untagged

See also:

awful.tag.setgap [deprecated]
Set the spacing between clients

Parameters:

  • useless_gap The spacing between clients
  • t The tag to modify, if null tag.selected() is used.

See also:

awful.tag.getgap [deprecated]
Get the spacing between clients.

Parameters:

  • t tag The tag. (default tag.selected())
  • numclients int Number of (tiled) clients. Passing this will return 0 for a single client. You can override this function to change this behavior. (optional)

See also:

awful.tag.setmfpol [deprecated]
Set size fill policy for the master client(s)

Parameters:

  • policy string Can be set to “expand” (fill all the available workarea) or “master_width_factor” (fill only an area inside the master width factor)
  • t tag The tag to modify (default tag.selected())

See also:

awful.tag.getmfpol [deprecated]
Get size fill policy for the master client(s)

Parameters:

  • t tag The tag (default tag.selected())

Returns:

    string Possible values are “expand” (fill all the available workarea, default one) or “master_width_factor” (fill only an area inside the master width factor)

See also:

awful.tag.setnmaster [deprecated]

Parameters:

  • nmaster The number of master windows.
  • t The tag. (optional)

See also:

awful.tag.getnmaster [deprecated]
Get the number of master windows.

Parameters:

  • t The tag. (optional)

See also:

awful.tag.seticon [deprecated]
Set the tag icon

Parameters:

  • icon the icon to set, either path or image object
  • _tag the tag

See also:

awful.tag.geticon [deprecated]
Get the tag icon

Parameters:

  • _tag the tag

See also:

awful.tag.setncol [deprecated]
Set number of column windows.

Parameters:

  • ncol The number of column.
  • t The tag to modify, if null tag.selected() is used.

See also:

awful.tag.getncol [deprecated]
Get number of column windows.

Parameters:

  • t The tag. (optional)

See also:

awful.tag.getidx [deprecated]
Get a tag’s index in the gettags() table.

Parameters:

  • query_tag The tag object to find. [selected()]

Returns:

    The index of the tag, nil if the tag is not found.

See also:

awful.tag.viewonly [deprecated]
View only a tag.

Parameters:

  • t tag The tag object.

See also:

awful.tag.getdata [deprecated]
Get tag data table.

Do not use.

Parameters:

  • _tag tag The tag.

Returns:

    The data table.
awful.tag.getproperty [deprecated]
Get a tag property.

Use _tag.prop directly.

Parameters:

  • _tag tag The tag.
  • prop string The property name.

Returns:

    The property.
awful.tag.setproperty [deprecated]
Set a tag property. This properties are internal to awful. Some are used to draw taglist, or to handle layout, etc.

Use _tag.prop = value

Parameters:

  • _tag The tag.
  • prop The property name.
  • value The value.
awful.tag.withcurrent [deprecated]
Tag a client with the set of current tags.

Parameters:

  • c The client to tag.

Fields

tag.awful.tag.history.limit integer
The number of elements kept in the history.
tag.awful.tag.layouts N/A

An ordered list of layouts. awful.tag.layout Is usually defined in rc.lua. It store the list of layouts used when selecting the previous and next layouts. This is the default:

 -- Table of layouts to cover with awful.layout.inc, order matters.
 awful.layout.layouts = {
     awful.layout.suit.floating,
     awful.layout.suit.tile,
     awful.layout.suit.tile.left,
     awful.layout.suit.tile.bottom,
     awful.layout.suit.tile.top,
     awful.layout.suit.fair,
     awful.layout.suit.fair.horizontal,
     awful.layout.suit.spiral,
     awful.layout.suit.spiral.dwindle,
     awful.layout.suit.max,
     awful.layout.suit.max.fullscreen,
     awful.layout.suit.magnifier,
     awful.layout.suit.corner.nw,
     -- awful.layout.suit.corner.ne,
     -- awful.layout.suit.corner.sw,
     -- awful.layout.suit.corner.se,
 }
generated by LDoc 1.4.6 Last updated 2030-01-01 00:00:00