Advertisement
Guest User

MAXOS

a guest
Mar 27th, 2015
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.02 KB | None | 0 0
  1. local Args = {...}
  2. os.loadAPI("System/API/context")
  3. os.loadAPI("System/API/image")
  4. os.loadAPI("System/API/windows")
  5.  
  6. ----------------------ПОДКЛЮЧЕНИЕ МОНИТОРА-----------------------
  7. local function findPeripheral(whatToFind)
  8. local PeriList = peripheral.getNames()
  9. for i=1,#PeriList do
  10. if peripheral.getType(PeriList[i]) == whatToFind then
  11. return PeriList[i]
  12. end
  13. end
  14. end
  15.  
  16. --ПОИСК ПЕРИФЕРИИ
  17. local m = findPeripheral("monitor")
  18. if Args[1] == "m" then
  19. if m ~= nil then
  20. m = peripheral.wrap(m)
  21. if Args[2] ~= nil then
  22. m.setTextScale(tonumber(Args[2]))
  23. end
  24. term.redirect(m)
  25. end
  26. end
  27.  
  28. if not term.isColor() then error("This program will work only on advanced computer.") end
  29.  
  30. ----------------------ОБЪЯВЛЕНИЕ ПЕРЕМЕННЫХ----------------------
  31. local xSize, ySize = term.getSize()
  32. local centerX = math.floor(xSize/2)
  33. local centerY = math.floor(ySize/2)
  34. local appWidth = 10
  35. local appHeight = 6
  36.  
  37. local countOfAppsByX = math.floor((xSize-2)/(appWidth+2))
  38. local countOfAppsByY = math.floor((ySize-5)/(appHeight+1))
  39. local countOfAppsOnDesktop = countOfAppsByX*countOfAppsByY
  40.  
  41. local countOfDesktops = nil
  42.  
  43. local startDisplayAllAppsFromX = centerX - math.floor((countOfAppsByX*(appWidth+2)-2)/2) + 1
  44. local startDisplayAllAppsFromY = centerY - math.floor((countOfAppsByY*(appHeight+1)-1)/2) + 1
  45.  
  46. local currentDesktop = 1
  47. local currentBackground = colors.lightBlue
  48. local topBarColor = colors.gray
  49.  
  50. --МАССИВЫ ОБЪЕКТОВ
  51. local Obj = {}
  52. local ObjBottom = {}
  53. local ObjApp = {}
  54.  
  55. local clipboardName = nil
  56.  
  57. local workPath = ""
  58. local workPathHistory = {}
  59.  
  60. ----------------------ОБЪЯВЛЕНИЕ ФУНКЦИЙ----------------------
  61.  
  62. --СОЗДАНИЕ ОБЪЕКТОВ ПРИЛОЖЕНИЙ
  63. local function newObjApp(name,x1,y1,width,height,id)
  64. ObjApp[name]={}
  65. ObjApp[name]["x1"]=x1
  66. ObjApp[name]["y1"]=y1
  67. ObjApp[name]["x2"]=x1+width-1
  68. ObjApp[name]["y2"]=y1+height-1
  69. ObjApp[name]["id"] = id
  70. end
  71.  
  72. --СОЗДАНИЕ ДРУГИХ ОБЪЕКТОВ
  73. local function newObj(name,x1,y1,width,height)
  74. Obj[name]={}
  75. Obj[name]["x1"]=x1
  76. Obj[name]["y1"]=y1
  77. Obj[name]["x2"]=x1+width-1
  78. Obj[name]["y2"]=y1+height-1
  79. end
  80.  
  81. --ОБЪЕКТОВ НИЖНИХ КНОПОК
  82. local function newObjBottom(name,x1,y1,width,height)
  83. ObjBottom[name]={}
  84. ObjBottom[name]["x1"]=x1
  85. ObjBottom[name]["y1"]=y1
  86. ObjBottom[name]["x2"]=x1+width-1
  87. ObjBottom[name]["y2"]=y1+height-1
  88. end
  89.  
  90. --ОГРАНИЧЕНИЕ ДЛИНЫ СТРОКИ
  91. local function stringLimit(text,size)
  92. if string.len(text)<=size then return text end
  93. return string.sub(text,1,size-3).."..."
  94. end
  95.  
  96. --ПРОСТОЕ ОТОБРАЖЕНИЕ ТЕКСТА ПО КООРДИНАТАМ
  97. local function usualText(x,y,text)
  98. term.setCursorPos(x,y)
  99. term.write(text)
  100. end
  101.  
  102. --РИСОВАНИЕ КВАДРАТА С ЗАЛИВКОЙ
  103. local function square(x1,y1,width,height,color)
  104. local string = string.rep(" ",width)
  105. term.setBackgroundColor(color)
  106. for y=y1,(y1+height-1) do
  107. usualText(x1,y,string)
  108. end
  109. end
  110.  
  111. --ЗАЛИВКА ЭКРАНА ЦВЕТОМ
  112. local function clearScreen(color)
  113. term.setBackgroundColor(color)
  114. term.clear()
  115. end
  116.  
  117. --ОЧИСТКА ЭКРАНА И УСТАНОВКА КУРСОРА НА 1, 1
  118. local function prepareToExit()
  119. clearScreen(colors.black)
  120. term.setTextColor(colors.white)
  121. term.setCursorPos(1,1)
  122. end
  123.  
  124. --ПЛАВНОЕ ВКЛЮЧЕНИЕ ЭКРАНА
  125. local function fadeIn(time)
  126. clearScreen(colors.gray)
  127. sleep(time)
  128. clearScreen(colors.lightGray)
  129. sleep(time)
  130. clearScreen(colors.white)
  131. sleep(time)
  132. end
  133.  
  134. --ПЛАВНОЕ ЗАТУХАНИЕ ЭКРАНА
  135. local function fadeOut(time)
  136. clearScreen(colors.lightGray)
  137. sleep(time)
  138. clearScreen(colors.gray)
  139. sleep(time)
  140. clearScreen(colors.black)
  141. sleep(time)
  142. term.setCursorPos(1,1)
  143. term.setTextColor(colors.white)
  144. end
  145.  
  146. --ПОЛУЧЕНИЕ ФОРМАТА ФАЙЛА
  147. local function getFileFormat(name)
  148. local start,ending = string.find(name,"%.%w*$")
  149. if start == nil then
  150. return nil
  151. else
  152. return string.sub(name,start,ending)
  153. end
  154. end
  155.  
  156. --КОПИРОВАНИЕ ОБОЕВ РАБОЧЕГО СТОЛА В СИСТЕМНУЮ ПАПКУ
  157. local function setWallpaper(path)
  158. fs.delete("System/wallpaper.png")
  159. fs.copy(path,"System/wallpaper.png")
  160. end
  161.  
  162. --ФУНКЦИИ ДЛЯ РАБОТЫ С ФАЙЛАМИ И БУФЕРОМ ОБМЕНА
  163. local function copy(whatToCopy)
  164. fs.delete("System/clipboard.temp")
  165. fs.copy(whatToCopy,"System/clipboard.temp")
  166. end
  167.  
  168. local function paste(path,name)
  169. fs.delete(path.."/"..name)
  170. fs.copy("System/clipboard.temp",path.."/"..name)
  171. end
  172.  
  173. local function cut(path)
  174. fs.copy(path,"System/clipboard.temp")
  175. fs.delete(path)
  176. end
  177.  
  178. --ВЕРХНЯЯ ПОЕБОНЬКА С ЧАСИКАМИ
  179. local function topBar(topBarColor)
  180. local time = textutils.formatTime(os.time(),false)
  181. term.setBackgroundColor(topBarColor)
  182. term.setTextColor(colors.white)
  183. local string = " OS "..string.rep(" ",xSize-5-#time)..time.." "
  184. usualText(1,1,string)
  185. end
  186. newObj("OS",1,1,6,1)
  187.  
  188. --ФУНКЦИЯ ДЛЯ РЕОРГАНИЗАЦИИ ЭЛЕМЕНТОВ МАССИВА, ЧТОБ ПАПКИ В НАЧАЛЕ БЫЛИ, А ФАЙЛЫ В КОНЦЕ
  189. local function reorganizeFilesAndFolders(workPath,massivSudaPihay)
  190. local reorganizedMassiv = {}
  191.  
  192. for i=1,#massivSudaPihay do
  193. if fs.isDir(workPath.."/"..massivSudaPihay[i]) then
  194. reorganizedMassiv[#reorganizedMassiv+1] = massivSudaPihay[i]
  195. end
  196. end
  197. for i=1,#massivSudaPihay do
  198. if not fs.isDir(workPath.."/"..massivSudaPihay[i]) then
  199. reorganizedMassiv[#reorganizedMassiv+1] = massivSudaPihay[i]
  200. end
  201. end
  202.  
  203. return reorganizedMassiv
  204. end
  205.  
  206. --ФУНКЦИЯ ОТРИСОВКИ КОНКРЕТНО ВЫБРАННОГО ПРИЛОЖЕНИЯ ПО ИМЕНИ
  207. local function drawKonkretnoApp(x,y,name,background,id)
  208.  
  209. local xIconPos = x + 2
  210. if not fs.isDir(workPath.."/"..name) then
  211. local fileFormat = getFileFormat(name)
  212. if fileFormat == ".png" then
  213. image.draw(xIconPos,y,"System/Icons/image.png")
  214. elseif fileFormat == ".cfg" then
  215. image.draw(xIconPos,y,"System/Icons/config.png")
  216. elseif fileFormat == nil then
  217. if fs.exists("System/icons/"..name..".png") then
  218. image.draw(xIconPos,y,"System/Icons/"..name..".png")
  219. else
  220. image.draw(xIconPos,y,"System/Icons/default.png")
  221. end
  222. else
  223. image.draw(xIconPos,y,"System/Icons/default.png")
  224. end
  225. else
  226. image.draw(xIconPos,y,"System/Icons/folder.png")
  227. end
  228.  
  229. newObjApp(name,x,y,appWidth,appHeight,id)
  230.  
  231. name = stringLimit(name,10)
  232. term.setBackgroundColor(background)
  233. term.setTextColor(colors.black)
  234. usualText(math.floor(x+5-#name/2),y+5,name)
  235. end
  236.  
  237. --ФУНКЦИЯ ОТРИСОВКИ ВООБЩЕ ВСЕХ ПРИЛОЖЕНИЙ НА РАБОЧЕМ СТОЛЕ
  238. local function displayApps(workPath,currentDesktop,background)
  239.  
  240. --ОБНУЛЕНИЕ МАССИВОВ
  241. ObjApp = {}
  242. ObjBottom = {}
  243.  
  244. --ОТРИСОВКА ОБОЕВ
  245. clearScreen(background)
  246. if fs.exists("System/wallpaper.png") then
  247. image.draw(1,2,"System/wallpaper.png")
  248. end
  249.  
  250. --ОТРИСОВКА ВЕРХНЕЙ ШНЯГИ
  251. topBar(topBarColor)
  252.  
  253. --ПОЛУЧИТЬ МАССИВ СО ВСЕМИ ФАЙЛАМИ/ПАПКАМИ
  254. local files = fs.list(workPath)
  255. --РЕОРГАНИЗОВАТЬ МАССИВ, ЧТОБ ПАПКИ БЫЛИ В НАЧАЛЕ
  256. files = reorganizeFilesAndFolders(workPath,files)
  257.  
  258. local countOfFiles = #files
  259. countOfDesktops = math.ceil(countOfFiles/(countOfAppsByY*countOfAppsByX))
  260.  
  261. --ОТРИСОВКА НИЖНЕГО ГОВНА
  262. local bottomButtonsStartX = nil
  263. if #workPathHistory == 0 then
  264. bottomButtonsStartX = centerX - math.floor((countOfDesktops*2+1)/2)
  265. else
  266. bottomButtonsStartX = centerX - math.floor((countOfDesktops*2-1)/2)
  267. end
  268. local bottomY = ySize-1
  269. for i=1,countOfDesktops do
  270. local bottomX = bottomButtonsStartX + i * 2
  271. if currentDesktop == i then
  272. paintutils.drawPixel(bottomX,bottomY,colors.white)
  273. else
  274. paintutils.drawPixel(bottomX,bottomY,colors.lightGray)
  275. end
  276. newObjBottom(i,bottomX,bottomY,1,1)
  277. end
  278. if #workPathHistory>0 then
  279. paintutils.drawPixel(bottomButtonsStartX,bottomY,colors.white)
  280. term.setTextColor(colors.black)
  281. usualText(bottomButtonsStartX,bottomY,"<")
  282. newObj("<",bottomButtonsStartX,bottomY,1,1)
  283. end
  284.  
  285. --ОТРИСОВКА САМИХ ПРИЛОЖЕНИЙ
  286. local appCounter = 1 + currentDesktop * countOfAppsByY * countOfAppsByX - countOfAppsByY * countOfAppsByX
  287. for y = 1,countOfAppsByY do
  288. for x = 1,countOfAppsByX do
  289. if files[appCounter] ~= nil then
  290. drawKonkretnoApp(startDisplayAllAppsFromX+x*(appWidth+2)-(appWidth+2),startDisplayAllAppsFromY+y*(appHeight+1)-(appHeight+1),files[appCounter],background,appCounter)
  291. appCounter = appCounter + 1
  292. end
  293. end
  294. end
  295. end
  296.  
  297. ----------------------------------СТАРТ ПРОГРАММЫ----------------------------------------
  298.  
  299. --РИСУЕМ ВООБЩЕ ВСЕ ПРИЛОЖЕНИЯ
  300. displayApps(workPath,currentDesktop,currentBackground)
  301.  
  302. --НАЧАЛО ЕБЛИ МОЗГА
  303. local exitFromProgram = false
  304. while true do
  305.  
  306. if exitFromProgram then break end
  307. --СЧЕТЧИК ПРИЛОЖЕНИЙ, НАЧИНАЯ С 1 НА ТЕКУЩЕМ РАБОЧЕМ СТОЛЕ
  308. local appCounter = 1 + currentDesktop * countOfAppsByY * countOfAppsByX - countOfAppsByY * countOfAppsByX
  309.  
  310. local event,side,x,y = os.pullEvent()
  311. --ХУЙНЮШКА ДЛЯ МОНИТОРА, А ТО ХЕР ЕГО ЗНАЕТ, КАКИЕ ИВЕНТЫ ОНО ШЛЕТ
  312. if event == "monitor_touch" then side = 1 end
  313. if event == "mouse_click" or event == "monitor_touch" then
  314.  
  315. if side == 1 then
  316.  
  317. --ПЕРЕМЕННАЯ ВЫХОДА ИЗ ВСЕХ ЦИКЛОВ, ПАТАММУШТА ЛУА ГОВНО И НЕ ПОДДЕРЖИВАЕТ МНОЖЕСТВЕННЫЙ BREAK
  318. local exit1 = false
  319.  
  320. --ХУЙНЮШЕЧКА ДЛЯ КЛИКА "НАЗАД"
  321. if #workPathHistory > 0 then
  322. if x==Obj["<"]["x1"] and y==Obj["<"]["y1"] and #workPathHistory > 0 then
  323. --ТЫК
  324. term.setBackgroundColor(colors.blue)
  325. term.setTextColor(colors.white)
  326. usualText(Obj["<"]["x1"],Obj["<"]["y1"],"<")
  327. sleep(0.2)
  328. --НЕ ТЫК
  329. workPath = workPathHistory[#workPathHistory]
  330. workPathHistory[#workPathHistory] = nil
  331. currentDesktop = 1
  332. displayApps(workPath,currentDesktop,currentBackground)
  333. exit1 = true
  334. end
  335. end
  336.  
  337. --А ЭТО, КОРОЧ, ПЕРЕБОР ВСЕХ НИЖНИХ КНОПОЧЕК ДЛЯ ПЕРЕЛИСТЫВАНИЯ РАБОЧИХ СТОЛОВ
  338. for i=1,#ObjBottom do
  339. if exit1 then break end
  340. if x==ObjBottom[i]["x1"] and y==ObjBottom[i]["y1"] then
  341. currentDesktop = i
  342. displayApps(workPath,currentDesktop,currentBackground)
  343. exit1=true
  344. end
  345. end
  346.  
  347. --А ЭТО ВООБЩЕ У-У-У-У-У
  348. --ЗАБЕЙ, КОРОЧ
  349. --ПРОСТО ЗАБЕЙ
  350. --В ОБЩЕМ
  351. --ЭТО ТАКАЯ ХУЙНЯ, КОТОРАЯ ПЕРЕБИРАЕТ МАССИВЧИК С ОБЪЕКТАМИ ПРИЛОЖЕНИЙ
  352. --КОРОЧ, ЗАБЫЛ УЖЕ, ЧТО ЭТО
  353. for key,val in pairs(ObjApp) do
  354. if exit1 then break end
  355. for i=appCounter,(appCounter+countOfAppsOnDesktop-1) do
  356. if exit1 then break end
  357. if ObjApp[key]["id"] == i then
  358. if x>=ObjApp[key]["x1"] and x<=ObjApp[key]["x2"] and y>=ObjApp[key]["y1"] and y<=ObjApp[key]["y2"] then
  359. square(ObjApp[key]["x1"],ObjApp[key]["y1"],appWidth,appHeight,colors.blue)
  360. drawKonkretnoApp(ObjApp[key]["x1"],ObjApp[key]["y1"],key,colors.blue,ObjApp[key]["id"])
  361. sleep(0.2)
  362.  
  363. if not fs.isDir(workPath.."/"..key) then
  364. local fileFormat = getFileFormat(key)
  365.  
  366. if key ~= "OS" and key ~= "os" and fileFormat ~= ".png" then
  367. fadeOut(0)
  368. prepareToExit()
  369. shell.run(workPath.."/"..key)
  370. local xCursor,yCursor = term.getCursorPos()
  371. usualText(1,yCursor+1,"Press any key to continue.")
  372. while true do
  373. local event = os.pullEvent()
  374. if event == "mouse_click" or event == "monitor_touch" or event == "key" then break end
  375. end
  376. fadeIn(0)
  377.  
  378. elseif fileFormat == ".png" then
  379. fadeOut(0)
  380. shell.run("Photoshop "..workPath.."/"..key)
  381. fadeIn(0)
  382.  
  383. elseif key == "OS" or key == "os" then
  384. windows.error(math.floor(xSize/2-16),math.floor(ySize/2-4),{"Can't open OS"},{"Cause it's already","running."})
  385.  
  386. end
  387.  
  388. exit1 = true
  389. displayApps(workPath,currentDesktop,currentBackground)
  390. else
  391. workPathHistory[#workPathHistory+1] = workPath
  392. workPath = workPath.."/"..key
  393. appCounter = 1
  394. currentDesktop = 1
  395. exit1 = true
  396. displayApps(workPath,1,currentBackground)
  397. end
  398. end
  399. end
  400. end
  401. end
  402.  
  403. if x>=Obj["OS"]["x1"] and x<=Obj["OS"]["x2"] and y>=Obj["OS"]["y1"] and y<=Obj["OS"]["y2"] then
  404. term.setBackgroundColor(colors.blue)
  405. term.setTextColor(colors.white)
  406. usualText(1,1," OS ")
  407. local contextAction = context.menu(Obj["OS"]["x1"]+1,Obj["OS"]["y1"]+1,{"Made by ECS",true},"-",{"About"},"-",{"Reboot"},{"Shutdown"},"-",{"Use Craft OS"})
  408. if contextAction == "About" then
  409. fadeOut(0)
  410. shell.run("Applications/About")
  411. fadeIn(0)
  412. displayApps(workPath,currentDesktop,currentBackground)
  413. elseif contextAction == "Reboot" then
  414. fadeOut(0)
  415. os.reboot()
  416. elseif contextAction == "Shutdown" then
  417. fadeOut(0)
  418. os.shutdown()
  419. elseif contextAction == "Use Craft OS" then
  420. exitFromProgram = true
  421. prepareToExit()
  422. elseif contextAction == nil then
  423. displayApps(workPath,currentDesktop,currentBackground)
  424. end
  425. end
  426.  
  427. else
  428. local appSelected = false
  429. local exit1 = false
  430. for key,val in pairs(ObjApp) do
  431. if exit1 then break end
  432. for i=appCounter,(appCounter+countOfAppsOnDesktop-1) do
  433. if exit1 then break end
  434. if ObjApp[key]["id"] == i then
  435. if x>=ObjApp[key]["x1"] and x<=ObjApp[key]["x2"] and y>=ObjApp[key]["y1"] and y<=ObjApp[key]["y2"] then
  436. square(ObjApp[key]["x1"],ObjApp[key]["y1"],appWidth,appHeight,colors.blue)
  437. drawKonkretnoApp(ObjApp[key]["x1"],ObjApp[key]["y1"],key,colors.blue,ObjApp[key]["id"])
  438.  
  439. local fileFormat = getFileFormat(key)
  440. local contextAction = nil
  441. if fileFormat ~= ".png" then
  442. contextAction = context.menu(x,y,{"Edit",fs.isDir(workPath.."/"..key)},"-",{"Cut"},{"Copy"},{"Delete"},{"Rename"},"-",{"Send via Wi-Fi",true})
  443. else
  444. contextAction = context.menu(x,y,{"Edit",fs.isDir(workPath.."/"..key)},{"Set as wallpaper"},"-",{"Cut"},{"Copy"},{"Delete"},{"Rename"},"-",{"Send via Wi-Fi",true})
  445. end
  446.  
  447. if contextAction == "Edit" then
  448. exit = true
  449. fadeOut(0)
  450. prepareToExit()
  451. shell.run("edit "..workPath.."/"..key)
  452. fadeIn(0)
  453.  
  454. elseif contextAction == "Cut" then
  455. if fs.isReadOnly(workPath.."/"..key) then
  456. windows.error(math.floor(xSize/2-16),math.floor(ySize/2-4),{"Can't cut this."},{"This file is aviable","to read-only."})
  457. else
  458. cut(workPath.."/"..key)
  459. clipboardName = key
  460. end
  461.  
  462. elseif contextAction == "Copy" then
  463.  
  464. if fs.isReadOnly(workPath.."/"..key) then
  465. windows.error(math.floor(xSize/2-16),math.floor(ySize/2-4),{"Can't copy this."},{"This file is aviable","to read-only."})
  466. else
  467. copy(workPath.."/"..key)
  468. clipboardName = key
  469. end
  470.  
  471. elseif contextAction == "Delete" then
  472. if fs.isReadOnly(workPath.."/"..key) then
  473. windows.error(math.floor(xSize/2-16),math.floor(ySize/2-4),{"Can't delete this."},{"This file is aviable","to read-only."})
  474. else
  475. fs.delete(workPath.."/"..key)
  476. end
  477.  
  478. elseif contextAction == "Rename" then
  479. if fs.isReadOnly(workPath.."/"..key) then
  480. windows.error(math.floor(xSize/2-16),math.floor(ySize/2-4),{"Can't rename this."},{"This file is aviable","to read-only."})
  481. else
  482. local filePath = windows.input(math.floor(xSize/2-12),math.floor(ySize/2-3),"New name",15,{"Name",""})
  483. fs.move(workPath.."/"..key,workPath.."/"..filePath[1])
  484. end
  485.  
  486. elseif contextAction == "Set as wallpaper" then
  487. setWallpaper(workPath.."/"..key)
  488. end
  489.  
  490. exit1 = true
  491. appSelected = true
  492. displayApps(workPath,currentDesktop,currentBackground)
  493. end
  494. end
  495. end
  496. end
  497.  
  498. if y>=2 and appSelected == false then
  499.  
  500. local canNotGoBack = true
  501. if #workPathHistory > 0 then canNotGoBack = false end
  502. local isClipboardEmpty = true
  503. if clipboardName ~= nil then isClipboardEmpty = false end
  504.  
  505. local contextAction = context.menu(x,y,{"Back",canNotGoBack},"-",{"New file"},{"New folder"},{"Paste",isClipboardEmpty})
  506.  
  507. if contextAction == "New file" then
  508.  
  509. local filePath = windows.input(math.floor(xSize/2-12),math.floor(ySize/2-3),"New file",15,{"Name",""})
  510. fadeOut(0)
  511. prepareToExit()
  512. shell.run("edit "..workPath.."/"..filePath[1])
  513. fadeIn(0)
  514.  
  515. elseif contextAction == "New folder" then
  516.  
  517. local filePath = windows.input(math.floor(xSize/2-12),math.floor(ySize/2-3),"New folder",15,{"Name",""})
  518. fs.makeDir(workPath.."/"..filePath[1])
  519.  
  520. elseif contextAction == "Back" then
  521. workPath = workPathHistory[#workPathHistory]
  522. workPathHistory[#workPathHistory] = nil
  523.  
  524. elseif contextAction == "Paste" then
  525.  
  526. if clipboardName ~= nil and fs.exists("System/clipboard.temp") then
  527. paste(workPath,clipboardName)
  528. end
  529.  
  530. end
  531.  
  532. displayApps(workPath,currentDesktop,currentBackground)
  533. end
  534. end
  535. --ОТРИСУЕМ ВЕРХНЮЮ ПАНЕЛЬКУ С ЧАСИКАМИ ПОСЛЕ НАЖАТИЯ НА ЭКРАН
  536. topBar(topBarColor)
  537.  
  538. --ПОДДЕРЖКА КОЛЕСА МЫШИ, ПРОКРУЧИВАЮЩЕГО РАБОЧИЕ СТОЛЫ
  539. elseif event == "mouse_scroll" then
  540. if side == -1 then
  541. currentDesktop = currentDesktop + 1
  542. if currentDesktop > countOfDesktops then
  543. currentDesktop = countOfDesktops
  544. else
  545. displayApps(workPath,currentDesktop,currentBackground)
  546. end
  547. elseif side == 1 then
  548. currentDesktop = currentDesktop - 1
  549. if currentDesktop < 1 then
  550. currentDesktop = 1
  551. else
  552. displayApps(workPath,currentDesktop,currentBackground)
  553. end
  554. end
  555. end
  556. end
  557.  
  558. fadeOut(0)
  559. prepareToExit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement