1
0
mirror of https://github.com/kepler155c/opus synced 2024-11-16 05:34:49 +00:00
opus/sys/autorun/clipboard.lua
2017-10-15 19:55:05 -04:00

22 lines
493 B
Lua

_G.requireInjector()
local Util = require('util')
local multishell = _ENV.multishell
local textutils = _G.textutils
local data
multishell.hook('clipboard_copy', function(_, args)
data = args[1]
end)
multishell.addHotkey('shift-paste', function(_, args)
if type(data) == 'table' then
local s, m = pcall(textutils.serialize, data)
data = (s and m) or Util.tostring(data)
end
-- replace the event paste data with our internal data
args[1] = Util.tostring(data or '')
end)