taborder - Luakit

# Luakit Documentation / Modules / taborder

# Module `taborder`

Rules for where to put new tabs

When a new tab is opened in a window, a tab order function is called to determine where in the tab list it should be placed. window.new_tab() accepts a tab order function as parameter. If this is not sent, taborder.default is used if the new tab will be immediately switched to. Otherwise, i.e. if a background tab is opened, taborder.bgdefault is used.

A tab order function receives the current window, and the view that is being opened as parameters. In return, it gives the index at which the new tab should be put.

## Functions

### taborder.first ()

Tab order function: Always insert new tabs before all other tabs.

### taborder.last (w)

Tab order function: Always insert new tabs after all other tabs.

#### Parameters

- w
  Type: table
  The current window table.

### taborder.after_current (w)

Tab order function: Always insert new tabs after the current tab.

#### Parameters

- w
  Type: table
  The current window table.

### taborder.before_current (w)

Tab order function: Always insert new tabs before the current tab.

#### Parameters

- w
  Type: table
  The current window table.

### taborder.by_origin (w, newview)

Tab order function: Put new child tab next to the parent after unbroken chain of descendants. Logical way to use when one "queues" background-followed links.

#### Parameters

- w
  Type: table
  The current window table.
- newview
  Type: widget
  The new webview widget.

## Properties

### taborder.default

Type: any type
Read-write
Default tab order function: open regular tabs last.

### taborder.default_bg

Type: any type
Read-write
Default tab order function for background tabs: open by origin.

### taborder.kidsof

Type: any type
Read-write
Weak table to remember which tab was spawned from which parent. Note that family bonds are tied only if tabs are spawned within family rules, e.g. from by_origin. Tabs created elsewhere are orphans.

## Attribution

#### Copyright

- 2010 Henrik Hallberg