Selections¶
Synopsis¶
text = luakit.get_selection() text = luakit.get_selection(atom) luakit.set_selection(text) luakit.set_selection(text, atom)
Description¶
Functions that copies data to and from X window clipboards.
Arguments¶
atom is the name of X window atom. In other words it specifies which clipboard should be used. Only three atoms are supported:
"primary"- it is what most traditional X window programs use"secondary"- secondary selection"clipboard"- the clipboard (it is what most program use for Ctrl+C/Ctrl+X/Ctrl+V operations)
In fact luakit checks only the first character ofatomstring, soluakit.get_selection("clipboard")can be abbreviated toluakit.get_selection("c"). If no atom specified,"primary"is used.
text is a string to be coipied to clipboard.
Return value¶
luakit.get_selection() returns a string - a content of the given clipboard.luakit.set_selection() does not return anything.
Examples¶
bind.key({}, "p", function (w) w:navigate(luakit.get_selection()) end),
bind.key({}, "P", function (w) w:new_tab(luakit.get_selection()) end),
bind.buf("^y$", function (w) luakit.set_selection(w:get_current().uri) end),
bind.buf("^Y$", function (w) luakit.set_selection(w:get_current().uri, "clipboard") end),