Reference

# Module `awful.tag`

Useful functions for tag manipulation.

Author:

Julien Danjou <julien@danjou.info>

Copyright© 2008 Julien Danjou

Release: v3.4.9

## Functions

add (name, props) | Add a tag.
attached_add_signal (screen, ...) | Add a signal to all attached tag and all tag that will be attached in the future.
delete (target_tag, fallback_tag) | Delete a tag.
find_fallback (screen, invalids, target) | Find a suitable fallback tag.
getdata (tag) | Get tag data table.
geticon (tag, t) | Get the tag icon
getidx (query_tag) | Get a tag's index in the screen[]:tags() table.
getmwfact (t) | Get master width factor.
getncol (t) | Get number of column windows.
getnmaster (t) | Get the number of master windows.
getproperty (tag, prop) | Get a tag property.
history.restore (screen, idx) | Revert tag history.
history.update (obj) | Update the tag history.
incmwfact (add, t) | Increase master width factor.
incncol (add, t) | Increase number of column windows.
incnmaster (add, t) | Increase the number of master windows.
move (new_index, target_tag) | Move a tag to an absolute position in the screen[]:tags() table.
new (names, screen, layout) | Create a set of tags and attach it to a screen.
selected (s) | Return only the first visible tag.
selectedlist (s) | Return a table with all visible tags
seticon (icon, tag) | Set the tag icon
setmwfact (mwfact, t) | Set master width factor.
setncol (ncol, t) | Set number of column windows.
setnmaster (nmaster, t) | Set the number of master windows.
setproperty (tag, prop, value) | Set a tag property.
viewidx (i, screen) | View a tag by its taglist index.
viewmore (tags, screen) | View only a set of tags.
viewnext (screen) | View next tag.
viewnone (screen, Optional) | View no tag.
viewonly (t) | View only a tag.
viewprev (screen) | View previous tag.
viewtoggle (t, tag) | Toggle selection of a tag
withcurrent (c, startup) | Tag a client with the set of current tags.

## Functions

add (name, props)
  Add a tag.

  ### Parameters

  - name: The tag name, a string
  - props: The tags properties, a table

  ### Return value:

  The created tag
attached_add_signal (screen, ...)
  Add a signal to all attached tag and all tag that will be attached in the future. When a tag is detach from the screen, its signal is removed.

  ### Parameters

  - screen: The screen concerned, or all if nil.
  - ...:
delete (target_tag, fallback_tag)
  Delete a tag.

  ### Parameters

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

  ### Return value:

  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.
find_fallback (screen, invalids, target)
  Find a suitable fallback tag.

  ### Parameters

  - screen: The screen number to look for a tag on. [mouse.screen]
  - invalids:
  - target: A table of tags we consider unacceptable. [selectedlist(scr)]
getdata (tag)
  Get tag data table.

  ### Parameters

  - tag: The Tag.

  ### Return value:

  The data table.
geticon (tag, t)
  Get the tag icon

  ### Parameters

  - tag:
  - t: the tag
getidx (query_tag)
  Get a tag's index in the screen[]:tags() table.

  ### Parameters

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

  ### Return value:

  The index of the tag, nil if the tag is not found.
getmwfact (t)
  Get master width factor.

  ### Parameters

  - t: Optional tag.
getncol (t)
  Get number of column windows.

  ### Parameters

  - t: Optional tag.
getnmaster (t)
  Get the number of master windows.

  ### Parameters

  - t: Optional tag.
getproperty (tag, prop)
  Get a tag property.

  ### Parameters

  - tag: The tag.
  - prop: The property name.

  ### Return value:

  The property.
history.restore (screen, idx)
  Revert tag history.

  ### Parameters

  - screen: The screen number.
  - 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.
history.update (obj)
  Update the tag history.

  ### Parameters

  - obj: Screen object.
incmwfact (add, t)
  Increase master width factor.

  ### Parameters

  - add: Value to add to master width factor.
  - t:
incncol (add, t)
  Increase number of column windows.

  ### Parameters

  - add: Value to add to number of column windows.
  - t:
incnmaster (add, t)
  Increase the number of master windows.

  ### Parameters

  - add: Value to add to number of master windows.
  - t:
move (new_index, target_tag)
  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:
new (names, screen, layout)
  Create a set of tags and attach it to a screen.

  ### Parameters

  - names: The tag name, in a table
  - screen: The tag screen, or 1 if not set.
  - layout: The layout or layout table to set for this tags by default.

  ### Return value:

  A table with all created tags.
selected (s)
  Return only the first visible tag.

  ### Parameters

  - s: Screen number.
selectedlist (s)
  Return a table with all visible tags

  ### Parameters

  - s: Screen number.

  ### Return value:

  A table with all selected tags.
seticon (icon, tag)
  Set the tag icon

  ### Parameters

  - icon: the icon to set, either path or image object
  - tag: the tag
setmwfact (mwfact, t)
  Set master width factor.

  ### Parameters

  - mwfact: Master width factor.
  - t:
setncol (ncol, t)
  Set number of column windows.

  ### Parameters

  - ncol: The number of column.
  - t:
setnmaster (nmaster, t)
  Set the number of master windows.

  ### Parameters

  - nmaster: The number of master windows.
  - t: Optional tag.
setproperty (tag, prop, value)
  Set a tag property. This properties are internal to awful. Some are used to draw taglist, or to handle layout, etc.

  ### Parameters

  - tag: The tag.
  - prop: The property name.
  - value: The value.
viewidx (i, screen)
  View a tag by its taglist index.

  ### Parameters

  - i: The relative index to see.
  - screen: Optional screen number.
viewmore (tags, screen)
  View only a set of tags.

  ### Parameters

  - tags: A table with tags to view only.
  - screen: Optional screen number of the tags.
viewnext (screen)
  View next tag. This is the same as tag.viewidx(1).

  ### Parameters

  - screen: The screen number.
viewnone (screen, Optional)
  View no tag.

  ### Parameters

  - screen:
  - Optional: screen number.
viewonly (t)
  View only a tag.

  ### Parameters

  - t: The tag object.
viewprev (screen)
  View previous tag. This is the same a tag.viewidx(-1).

  ### Parameters

  - screen: The screen number.
viewtoggle (t, tag)
  Toggle selection of a tag

  ### Parameters

  - t:
  - tag: Tag to be toggled
withcurrent (c, startup)
  Tag a client with the set of current tags.

  ### Parameters

  - c: The client to tag.
  - startup: Optional: don't do anything if true.