mirror of
https://github.com/kepler155c/opus
synced 2024-11-09 18:29:57 +00:00
34 lines
625 B
Lua
34 lines
625 B
Lua
|
_G.clipboard = { internal, data }
|
||
|
|
||
|
function clipboard.getData()
|
||
|
return clipboard.data
|
||
|
end
|
||
|
|
||
|
function clipboard.setData(data)
|
||
|
clipboard.data = data
|
||
|
if data then
|
||
|
clipboard.useInternal(true)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
function clipboard.getText()
|
||
|
if clipboard.data then
|
||
|
return Util.tostring(clipboard.data)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
function clipboard.isInternal()
|
||
|
return clipboard.internal
|
||
|
end
|
||
|
|
||
|
function clipboard.useInternal(mode)
|
||
|
if mode ~= clipboard.mode then
|
||
|
clipboard.internal = mode
|
||
|
os.queueEvent('clipboard_mode', mode)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
multishell.addHotkey(20, function()
|
||
|
clipboard.useInternal(not clipboard.isInternal())
|
||
|
end)
|