mirror of
				https://github.com/kepler155c/opus
				synced 2025-10-30 23:23:03 +00:00 
			
		
		
		
	 7224d441ca
			
		
	
	7224d441ca
	
	
	
		
			
			* 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
		
			
				
	
	
		
			27 lines
		
	
	
		
			572 B
		
	
	
	
		
			Lua
		
	
	
	
	
	
			
		
		
	
	
			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)
 |