Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---------------- libs
- local c = require("computer")
- local co = require("component")
- local gpu = co.gpu
- local lg = require("linegui")
- local term = require("term")
- local event = require("event")
- local shell = require("shell")
- local fs = require("filesystem")
- ---------------- variables
- local ln,ht = gpu.getResolution()
- local colors = {}
- local shut = true
- ---------------- file infos
- if fs.exists("lineOS/colors") then
- cols = io.open("lineOS/colors","r")
- for var in cols:lines() do table.insert(colors, var) end
- cols:close()
- else
- cols = io.open("lineOS/colors","w")
- cols:write("0x6060ff\n")
- cols:write("0x4040ff\n")
- cols:write("0x5050ff\n")
- for var in cols:lines() do table.insert(colors,var) end
- cols:close()
- end
- ---------------- shorts
- sc=term.setCursor
- wr=term.write
- sb=gpu.setBackground
- sf=gpu.setForeground
- fi=gpu.fill
- gre=gpu.getResolution
- ---------------- preps
- os.sleep(2)
- gggg=false
- term.clear()
- ---------------- functions
- function desktop()
- local a=sb(tonumber(colors[1]))
- term.clear()
- sb(tonumber(colors[2]))
- fi(1,ht-1,ln,2," ")
- lg.colortext(2,ht,"Пуск",0xffffff)
- end
- function midday()
- os.execute("/lineOS/midday")
- os.execute("/core")
- end
- function start()
- starteri = true
- local gasy = sb(tonumber(colors[3]))
- lg.drawbox(1,ht-12,20,11, tonumber(colors[3]))
- sc(1,ht-12) wr("Выключение")
- sc(1,ht-11) wr("Перезагрузка")
- sc(1,ht-10) wr("Выход в Shell")
- sc(1,ht-9) wr("Файловый менеджер")
- while starteri do
- local typer,_,x,y = event.pull(1)
- if typer=="touch" then
- if x<20 and y==ht-12 then
- starteri=false
- shut=false
- shutdown=true
- elseif x>20 or y<13 then
- starteri=false
- desktop()
- elseif x<20 and y==ht-11 then
- starteri=false
- shut=false
- reboot=true
- elseif x<20 and y==ht-10 then
- starteri=false
- gggg=true
- term.clear()
- elseif x<20 and y==ht-9 then
- term.clear()
- midday()
- end
- end
- sb(gasy)
- end
- end
- ----------------- clicks
- function click(_,_,x,y)
- local type,_,x,y = event.pull(1)
- if type == "touch" then
- if x<20 and y>ht-2 then
- start()
- end
- end
- end
- ------------------ main
- desktop()
- ------------------
- while shut==true do
- --os.sleep(1)
- sc(ln-20,ht) wr(os.date())
- click()
- if gggg==true then
- break
- end
- end
- term.clear()
- ------------------
- if reboot then c.shutdown(true) end
- if shutdown then
- c.shutdown()
- else
- sb(a)
- term.clear()
- end
- ------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement