1
0
mirror of https://github.com/kepler155c/opus synced 2024-12-28 09:30:34 +00:00
opus/sys/extensions/clipboard.lua

44 lines
777 B
Lua
Raw Normal View History

2017-09-06 01:21:43 +00:00
if _G.clipboard then
return
end
requireInjector(getfenv(1))
local Util = require('util')
_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)
2017-05-14 00:46:26 +00:00
if mode ~= clipboard.internal then
clipboard.internal = mode
os.queueEvent('clipboard_mode', mode)
end
end
2017-09-06 01:21:43 +00:00
if multishell and multishell.addHotkey then
multishell.addHotkey(20, function()
clipboard.useInternal(not clipboard.isInternal())
end)
end