Module luakit
Luakit core API
Functions
luakit.quit ()
Quit luakit immediately, without asking modules for confirmation.
luakit.get_selection (clipboard)
Get the contents of the X selection.
Parameters
-
clipboardType: stringThe name of the X clipboard to use (one of
"primary"
,"secondary"
or"clipboard"
).
Return Values
-
stringThe contents of the named selection.
luakit.set_selection (text, clipboard)
Set the contents of the X selection.
Parameters
-
textType: stringThe UTF-8 string to be copied to the named selection.
-
clipboardType: stringThe name of the X clipboard to use (one of
"primary"
,"secondary"
or"clipboard"
).
luakit.spawn (cmd, callback)
Spawn a process asynchronously.
Parameters
-
cmdType: stringThe command to execute. It is parsed with a simple shell-like parser.
-
callbackType: functionOptionalA callback function to execute when the spawned process is terminated. It receives two parameters
reason
andstatus
, which are the reason for the process exit and the exit status code respectively.reason
can be one of"exit"
, indicating normal termination;"signal"
, indicating the process was killed with a signal; and"unknown"
.
luakit.spawn_sync (cmd)
Spawn a process synchronously.
Parameters
-
cmdType: stringThe command to execute. It is parsed with a simple shell-like parser.
Return Values
-
numberThe exit status of the command.
-
stringA string containig data printed on
stdout
. -
stringA string containig data printed on
stderr
.
luakit.time ()
Get the time since Luakit startup.
Return Values
-
numberThe number of seconds Luakit has been running.
luakit.uri_encode (str)
Escape a string for use in a URI.
Parameters
-
strType: stringThe string to encode.
Return Values
-
stringThe escaped/encoded string.
luakit.uri_encode (str)
Unescape an escaped string used in a URI.
Returns the unescaped string, or nil
if the string contains illegal
characters.
Parameters
-
strType: stringThe string to decode.
Return Values
-
stringThe unescaped/decoded string, or
nil
on error. -
stringError message.
luakit.idle_add (cb)
Add a function to be called regularly when Luakit is idle. If the function
returns false
, or if an error is encountered during execution, the function
is automatically removed from the set of registered idle functions, and will
not be called again.
The provided callback function is not called with any arguments; to pass context to the callback function, use a closure.
Parameters
-
cbType: functionThe function to call when Luakit is idle.
luakit.idle_remove (cb)
Remove a function previously registered with idle_add
.
Parameters
-
cbType: functionThe function to removed from the set of idle callbacks.
Return Values
-
boolean
true
if the callback was present (and removed);false
if the callback was not found.
luakit.register_scheme (scheme)
Register a custom URI scheme.
Registering a scheme causes network requests to that scheme to be redirected to Lua code via the signal handling interface. A signal based on the scheme name will be emitted on a webview widget when it attempts to load a URI on the registered scheme. To return content to display, as well as an optional mime-type, connect to the signal and return a string with the content to display.
This interface is used to register the luakit://
scheme, but is not limited
to this prefix alone.
Example
Registering a scheme foo
will cause URIs beginning with foo://
to
be redirected to Lua code. A signal scheme-request::foo
will be emitted on
a webview in response to a foo://
load attempt, and should be handled to
provide contentt.
Parameters
-
schemeType: stringThe network scheme to register.
Properties
luakit.enable_spell_checking
false
luakit.spell_checking_languages
Each item in the table is a code of the form lang_COUNTRY
,
where lang
is an ISO-639 language code, in lowercase, and COUNTRY
is an ISO-3166 country code, in uppercase.
When setting a new value for this property, any unrecognized codes are discarded and a warning is logged, but no error is generated.
This property has a default value based on the user's locale. Setting this
value to {}
will reset it to the default value.
Signals
"page-created"
Emitted after the creation of a page
object; i.e. after
a new webview widget has been created in the UI process.
Usage
luakit.add_signal("page-created", function (page) -- Add more signals to page end)
Parameters
-
pageType: pageThe new page object.
Fields
luakit.config_dir
$XDG_CONFIG_HOME
).
luakit.data_dir
$XDG_DATA_HOME
).
luakit.cache_dir
$XDG_CACHE_HOME
).
luakit.verbose
true
if logging in verbose
or
debug
mode.
luakit.install_path
luakit.version
luakit.windows
Attribution
Authors
Copyright
- 2016 Aidan Holm
- 2010 Mason Larobina, Paweł Zuzelski