luakit.unique - Luakit

# Luakit Documentation / Modules / luakit.unique

# Module `luakit.unique`

Single instance support
This module is only available from the UI process Lua state.

This module allows Lua code to detect an already-running instance of luakit and open requested links on that instance, instead of opening two separate and independent instances.

## Functions

### luakit.unique.new (id)

Set up an application with a shared identifier used to locate already-running instances. This must be called before calling `is_running` or `send_message`.

#### Parameters

- id
  Type: string
  The application identifier string to use.

### luakit.unique.is_running ()

Check whether an application using the identifier previously given to `unique.new` is already running.

#### Return Values

- boolean
  `true` if an application instance is already running.

### luakit.unique.send_message (message)

Send a message (which must be a string) to the primary instance of the application.

#### Parameters

- message
  Type: string
  The message to send to the primary instance.

## Signals

### "message"

Emitted only on the primary instance when a message is received from a secondary instance.

#### Parameters

- message
  Type: string
  The message sent with `unique.send_message()`.
- screen
  Type: screen
  An opaque piece of data that represents the screen of the currently focused window of the main instance.

## Attribution

#### Copyright

- 2011 Mason Larobina