Browse Source

clipboard: Make the clipboard service work under the new service sys

This also adds a [.editorconfig](https://editorconfig.org/) and adds
apidoc.md to the gitignore.
pull/4/head
Amanda Cameron 6 months ago
parent
commit
5213835970
3 changed files with 21 additions and 9 deletions
  1. +5
    -0
      .editorconfig
  2. +1
    -0
      .gitignore
  3. +15
    -9
      service/clipboard.lua

+ 5
- 0
.editorconfig View File

@@ -0,0 +1,5 @@
root = true

[*.lua]
indent_style = space
indent_size = 1

+ 1
- 0
.gitignore View File

@@ -1,4 +1,5 @@
*.cpio
*.af
apidoc.md
/target
/doc

+ 15
- 9
service/clipboard.lua View File

@@ -1,11 +1,17 @@
local lc = computer.uptime()
_G.clip = ""
while true do
local eT = {coroutine.yield()}
if eT[1] == "clipboard" then
if computer.uptime() > lc + 5 then
_G.clip = ""
end
_G.clip = _G.clip .. eT[3]
end

function start()
return os.spawn(function()
local lc
while true do
local eT = {coroutine.yield()}
if eT[1] == "clipboard" then
if computer.uptime() > lc + 5 then
_G.clip = ""
end
lc = computer.uptime()
_G.clip = _G.clip .. eT[3]
end
end
end)
end

Loading…
Cancel
Save