Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Linear Operating System
- Desktop
- ]]
- if fs.exists("linear/system/desktopConfig.ls") then
- --[[ load config ]]
- local handle = assert(fs.open("linear/system/desktopConfig.ls", "r"), "Failed to load desktop configuration")
- local input = handle.readAll()
- handle.close()
- local deskVar = textutils.unserialize(input)
- deskVar.mBarC = menuBarC
- deskVar.timeFormat = timeForm
- --[[ draw desktop ]]
- clear(1,1)
- local backgroundImage = paintutils.loadImage("linear/system/imgs/defaultBg.lsg")
- paintutils.drawImage(backgroundImage,1,2)
- pos(1,1)
- bCol(menuBarC)
- cLine()
- else --if the config does NOT exist
- local makeConfig = fs.open("linear/system/desktopConfig.ls", "w")
- makeConfig.close()
- local function step2()
- clear(1,1)
- centerPrint("Time Format")
- print("")
- centerPrint("Do you want the clock in 12hr or 24hrs?")
- print("")
- clear(1,1)
- bCol(colors.green)
- pos(12,8)
- print(" ")
- pos(12,9)
- print(" 12hr ")
- pos(12,10)
- print(" ")
- pos(11,10)
- bCol(colors.gray)
- print("?")
- bCol(colors.white)
- bCol(colors.cyan)
- pos(32,8)
- print(" ")
- pos(32,9)
- print(" 24hr ")
- pos(32,10)
- print(" ")
- while true do
- if event == "mouse_click" then
- if x>12 and x<22 and y>7 and y<11 and button==1 then
- local target = {}
- target.timeFormat = twelveHR
- local output = textutils.serialize(target)
- target.close()
- local handle = assert(fs.open("linear/system/desktopConfig.ls", "w"), "Failed to load desktop configuration")
- handle.write(output)
- handle.close()
- shell.run("linear/system/desktop.ls")
- elseif x>31 and x<42 and y>7 and y<11 and button ==1 then
- local target = {}
- target.timeFormat = twenty4HR
- local output = textutils.serialize(target)
- target.close()
- local handle = assert(fs.open("linear/system/desktopConfig.ls", "w"), "Failed to load desktop configuration")
- handle.write(output)
- handle.close()
- shell.run("linear/system/desktop.ls")
- end
- end
- end
- end
- clear(1,3)
- centerPrint("Welcome to Linear OS")
- print("")
- print("")
- centerPrint("Choose a Menu Bar color")
- print("")
- print("[BLUE] [RED] [GREEN] [CYAN] [ORANGE]")
- while true do
- local event, button, x, y = os.pullEventRaw()
- if event == "mouse_click" then
- if x>1 and x<6 and y==6 and button==1 then
- local target = {}
- target.mBarC = colors.blue
- output = textutils.serialize(target)
- target.close()
- handle = assert(fs.open("linear/system/desktopConfig.ls", "w"), "Failed to load desktop configuration")
- handle.write(output)
- handle.close()
- step2()
- elseif x>8 and x<12 and y==6 and button==1 then
- local target = {}
- target.mBarC = colors.red
- local output = textutils.serialize(target)
- target.close()
- local handle = assert(fs.open("linear/system/desktopConfig.ls", "w"), "Failed to load desktop configuration")
- handle.write(output)
- handle.close()
- step2()
- elseif x>14 and x<20 and y==6 and button==1 then
- local target = {}
- target.mBarC = colors.green
- local output = textutils.serialize(target)
- target.close()
- local handle = assert(fs.open("linear/system/desktopConfig.ls", "w"), "Failed to load desktop configuration")
- handle.write(output)
- handle.close()
- step2()
- elseif x>22 and x<27 and y==6 and button==1 then
- local target = {}
- target.mBarC = colors.cyan
- local output = textutils.serialize(target)
- target.close()
- local handle = assert(fs.open("linear/system/desktopConfig.ls", "w"), "Failed to load desktop configuration")
- handle.write(output)
- handle.close()
- step2()
- elseif x>29 and x<36 and y==6 and button==1 then
- local target = {}
- target.mBarC = colors.orange
- local output = textutils.serialize(target)
- target.close()
- local handle = assert(fs.open("linear/system/desktopConfig.ls", "w"), "Failed to load desktop configuration")
- handle.write(output)
- handle.close()
- step2()
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement