1
0
mirror of https://github.com/kepler155c/opus synced 2024-10-31 22:26:16 +00:00
opus/sys/autorun/clipboard.lua
kepler155c 7224d441ca
Ui enhancements 2.0 (#31)
* canvas overhaul

* minor tweaks

* list mode for overview

* bugfixes + tweaks for editor 2.0

* minor tweaks

* more editor work

* refactor + new transitions

* use layout() where appropriate and cleanup

* mouse triple click + textEntry scroll ind

* cleanup

* cleanup + theme editor

* color rework + cleanup

* changes for deprecated ui methods

* can now use named colors
2020-04-21 22:40:59 -06:00

27 lines
572 B
Lua

local Util = require('opus.util')
local kernel = _G.kernel
local keyboard = _G.device.keyboard
local os = _G.os
local textutils = _G.textutils
kernel.hook('clipboard_copy', function(_, args)
keyboard.clipboard = args[1]
end)
local function queuePaste()
local data = keyboard.clipboard
if type(data) == 'table' then
local s, m = pcall(textutils.serialize, data)
data = s and m or Util.tostring(data)
end
if data then
os.queueEvent('paste', data)
end
end
kernel.hook('clipboard_paste', queuePaste)
keyboard.addHotkey('shift-paste', queuePaste)