Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local oterm = term.current()
- local osize = {term.getSize()}
- local nwindow = window.create(oterm,1,1,osize[1],osize[2]-1,true)
- local notifqueue = {}
- term.setBackgroundColor(colors.gray)
- term.clear()
- term.setCursorPos(1,osize[2])
- term.setBackgroundColor(colors.red)
- term.setTextColor(colors.black)
- write('O')
- local noteHide = false
- _G.note = {}
- term.redirect(nwindow)
- local nsize = {term.getSize()}
- local function newNotFunc(msg)
- if msg ~= '' then
- table.insert(notifqueue,msg)
- end
- end
- local function getNotFunc()
- return notifqueue
- end
- local function getOpNotFunc()
- return noteHide
- end
- _G.note.getVisible = getOpNotFunc
- _G.note.get = getNotFunc
- _G.note.send = newNotFunc
- term.setBackgroundColor(colors.black)
- term.clear()
- local function shellIso()
- shell.run('shell')
- os.shutdown()
- end
- local function clickDet()
- while true do
- local ev = {os.pullEvent('mouse_click')}
- if ev[4] == osize[2] then
- if ev[3] == 1 then
- os.shutdown()
- end
- if ev[3] == osize[1]-2 then
- local mxPos = {term.getCursorPos()}
- if noteHide then
- noteHide = false
- paintutils.drawFilledBox(osize[1]-1,osize[2]-2,osize[1]-12,osize[2]-14)
- term.setCursorPos(mxPos[1],mxPos[2])
- else
- noteHide = true
- end
- end
- end
- if noteHide then
- if notifqueue[13-(ev[4]-(osize[2]-14))] then
- table.remove(notifqueue,13-(ev[4]-(osize[2]-14)))
- end
- end
- end
- end
- local months = {
- ['Jan'] = 1,
- ['Feb'] = 2,
- ['Mar'] = 3,
- ['Apr'] = 4,
- ['May'] = 5,
- ['Jun'] = 6,
- ['Jul'] = 7,
- ['Aug'] = 8,
- ['Sep'] = 9,
- ['Oct'] = 10,
- ['Nov'] = 11,
- ['Dec'] = 12,
- }
- local function barDisp()
- while true do
- sleep()
- local date = os.date()
- local hour = tonumber(string.sub(date,12,13))
- local hourP = false
- if hour > 12 then
- hour = hour - 12
- hourP = true
- end
- local sPos = {oterm.getCursorPos()}
- local sColor = oterm.getTextColor()
- oterm.setCursorPos(osize[1]-22,osize[2])
- oterm.setBackgroundColor(colors.gray)
- oterm.setTextColor(colors.white)
- oterm.write(hour..':')
- oterm.write(string.sub(date,15,16)..' ')
- if hourP then
- oterm.write('PM')
- else
- oterm.write('AM')
- end
- oterm.write(' ')
- oterm.write(months[string.sub(date,5,7)]..'/'..string.sub(date,9,10)..'/'..string.sub(date,-2,-1)..' ')
- oterm.setCursorPos(osize[1]-2,osize[2])
- if #notifqueue > 0 then
- oterm.setBackgroundColor(colors.red)
- oterm.setTextColor(colors.white)
- oterm.write(string.char(19))
- else
- oterm.setBackgroundColor(colors.lightGray)
- oterm.setTextColor(colors.gray)
- oterm.write('.')
- end
- if noteHide then
- oterm.setBackgroundColor(colors.lightGray)
- for num = 1,13 do
- oterm.setCursorPos(osize[1]-22,osize[2]-num-1)
- oterm.write(' ')
- end
- for num = 1,13 do
- oterm.setCursorPos(osize[1]-22,osize[2]-num-1)
- if notifqueue[num] then
- oterm.write(string.sub(notifqueue[num],1,22))
- end
- end
- end
- oterm.setTextColor(sColor)
- oterm.setCursorPos(sPos[1],sPos[2])
- end
- end
- parallel.waitForAll(shellIso,clickDet,barDisp)
Add Comment
Please, Sign In to add comment