This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Piorjade's profile picture

miniOS (well more of a window manager)

Started by Piorjade, 23 October 2016 - 12:10 PM
Piorjade #1
Posted 23 October 2016 - 02:10 PM
Well I made a window manager in a day, because I was sooo bored :P/>/>

It literally is only one file with about 360 (heh) lines :)/>/>

Screenshots:

Spoiler[attachment=2681:screenshot.PNG]

Features:
  • Press F1, enter the path to a file, press enter –> opens a window with that file
  • Maximize windows with the yellow button
  • Close windows
  • Minimize windows –> they run in the background (NOTE: currently no way of re-opening that window, I'll add that later…it's very easy)
  • Mouse, key and char events are only passed to the selected window
  • mouse events are correctly passed to the size of the window
  • mouse events won't be passed, if they are happening outside of the window (obviously…)
  • resize windows with the bottom right corner
  • move windows with the top border
  • Nothing else (—> miniOS)
Code:
GitHub

Download:
Pastebin

pastebin get qXqg8Weg /miniOS
Edited on 23 October 2016 - 09:04 PM
supernicejohn #2
Posted 23 October 2016 - 04:30 PM
Pretty much what I'm doing right now, just need to remember to correcrly map the mouse events… Thanks for mentioning!
HaddockDev #3
Posted 23 October 2016 - 08:27 PM
Seems nice, but how are programs going to be notified of size changes? Are they going to be fixed size?
(for example,
if miniOS then miniOS.Window[myWindowID].Size = {w=10,h=5} end --10x5 window 
)
If there is resizing functionality then, I have a suggestion! If you resize the window, scroll bars to look at windows!

Other than that, nice! I'm more fond of tabs though because you don't have to do all sorts of dark lua magic.
tl;dr i like tabs because im lazy and dont feel like handling anything except mouse clicks and key presses and that sort of stuff
Edited on 23 October 2016 - 06:30 PM
Piorjade #4
Posted 23 October 2016 - 11:02 PM
Seems nice, but how are programs going to be notified of size changes? Are they going to be fixed size?
(for example,
if miniOS then miniOS.Window[myWindowID].Size = {w=10,h=5} end --10x5 window 
)
If there is resizing functionality then, I have a suggestion! If you resize the window, scroll bars to look at windows!

Other than that, nice! I'm more fond of tabs though because you don't have to do all sorts of dark lua magic.
tl;dr i like tabs because im lazy and dont feel like handling anything except mouse clicks and key presses and that sort of stuff

Well I didn't do anything about notifying the program about resizes… I's kind of already happening when you call window.reposition() (–> the window gets smaller/bigger)… The only thing I can think of you can do, is handling term_resize in the program itself for whatever reason.

EDIT: I think I forgot to mention that you can resize windows by dragging the bottom right corner and move windows by dragging the top border? :P/>
Edited on 23 October 2016 - 09:00 PM
HaddockDev #5
Posted 25 October 2016 - 11:23 PM
Seems nice, but how are programs going to be notified of size changes? Are they going to be fixed size?
(for example,
if miniOS then miniOS.Window[myWindowID].Size = {w=10,h=5} end --10x5 window 
)
If there is resizing functionality then, I have a suggestion! If you resize the window, scroll bars to look at windows!

Other than that, nice! I'm more fond of tabs though because you don't have to do all sorts of dark lua magic.
tl;dr i like tabs because im lazy and dont feel like handling anything except mouse clicks and key presses and that sort of stuff

Well I didn't do anything about notifying the program about resizes… I's kind of already happening when you call window.reposition() (–> the window gets smaller/bigger)… The only thing I can think of you can do, is handling term_resize in the program itself for whatever reason.

EDIT: I think I forgot to mention that you can resize windows by dragging the bottom right corner and move windows by dragging the top border? :P/>

Yeah you did forget to mention it. Oh well. Don't forget, you somehow broke the shell API (or you did it on purpose, but its broken)
Well, to end me bumping this thread, last words: Time to start forking this and modding it so I could use/make this as an actual DE (¯\_(ツ)_/¯)
Edited on 25 October 2016 - 09:33 PM
Lyqyd #6
Posted 26 October 2016 - 12:05 AM
Moved to Operating Systems.
houseofkraft #7
Posted 12 November 2016 - 01:43 PM
You could make term.getSize change when you resize the window
HaddockDev #8
Posted 13 November 2016 - 09:54 PM
You could make term.getSize change when you resize the window
Most programs I've seen has some sort of variation of this at the top of the file:
local w,h = term.getSize()
So, I'm not sure if it would work.
Bomb Bloke #9
Posted 13 November 2016 - 10:20 PM
The idea is to queue a term_resize event, so that an observant script knows to call term.getSize() again.
Piorjade #10
Posted 23 November 2016 - 11:49 AM
The idea is to queue a term_resize event, so that an observant script knows to call term.getSize() again.

I think I did that…. too long no CC lmao.
Zecradox #11
Posted 29 April 2018 - 05:05 PM
Cool
Edited on 29 April 2018 - 04:22 PM