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

Craftbang - Multitasking Desktop Environment

Started by Kingdaro, 11 August 2013 - 05:43 PM
Kingdaro #1
Posted 11 August 2013 - 07:43 PM

CraftBang

CraftBang is a desktop environment with multitasking capabilities. It's clean, modern, customizable and allows you to not only access your favorite programs easily, but more than one at once with little hassle.


Screenshots
Spoiler


Download / More Info
Download the installer / updater: pastebin get reBqWcFr cb-update
GitHub Page (includes documentation): https://github.com/Kingdaro/CraftBang

Once you have the installer downloaded, you can run it at any time to get the newest version of CraftBang.
As always, comments and bug reports are appreciated. Enjoy!

Credits to GopherAtl for his Redirect API.

You are free to use this in any project you please.


**Note: This is NOT an operating system, and I will not be calling it an operating system. The only reason it resides in this forum is because it falls under the definition of what is known as an OS by this community. You are welcome to call it an OS, but I will never refer to it as such. It is a desktop environment, and it was created as a desktop environment.
Edited on 27 February 2014 - 09:25 PM
TheOddByte #2
Posted 11 August 2013 - 07:49 PM
Wow! This looks just simply amazing! :)/>
I really wish my computer was on now so I could test it..
Great that it has multitasking since that is always an nice feature :D/>
Kingdaro #3
Posted 11 August 2013 - 07:52 PM
Wow! This looks just simply amazing! :)/>/>
I really wish my computer was on now so I could test it..
Great that it has multitasking since that is always an nice feature :D/>/>
Yeah, it is, hence why it was my main goal in making this, heh. Glad you like it!

For the record, I would've done windowing, but I didn't feel it was necessary, as programs are usually better run in higher resolution. I wanted to take up the least amount of screen space I could, and give programs the space they really need.
Sammich Lord #4
Posted 11 August 2013 - 07:59 PM
Wow! This looks just simply amazing! :)/>/>
I really wish my computer was on now so I could test it..
Great that it has multitasking since that is always an nice feature :D/>/>
Yeah, it is, hence why it was my main goal in making this, heh. Glad you like it!

For the record, I would've done windowing, but I didn't feel it was necessary, as programs are usually better run in higher resolution. I wanted to take up the least amount of screen space I could, and give programs the space they really need.
I never got the point of windows. Most programs aren't designed for such a small resolution. So I agree with your choice of not going with windows.
Thib0704 #5
Posted 11 August 2013 - 08:10 PM
Wow! This looks just simply amazing! :)/>/>/>
I really wish my computer was on now so I could test it..
Great that it has multitasking since that is always an nice feature :D/>/>/>
Yeah, it is, hence why it was my main goal in making this, heh. Glad you like it!

For the record, I would've done windowing, but I didn't feel it was necessary, as programs are usually better run in higher resolution. I wanted to take up the least amount of screen space I could, and give programs the space they really need.
I never got the point of windows. Most programs aren't designed for such a small resolution. So I agree with your choice of not going with windows.

Good point.
The only way I think off to make windowed based application,
Is making an API for developers to get the width and height of the window!
But this mean developers would have to remake their program's. :(/>

Otherwise : Great app !
Kingdaro #6
Posted 11 August 2013 - 08:18 PM
Good point.
The only way I think off to make windowed based application,
Is making an API for developers to get the width and height of the window!
But this mean developers would have to remake their program's. :(/>/>/>

Otherwise : Great app !

Usually, the way a windowing system works, is that you simply overwrite the term functions (or redirect the term to a drawable "buffer", like I've done) so that, for example, when a program calls term.getSize(), instead of returning the actual size of the screen, you overwrite it to return the size of the window.

This is probably what it'd look like in a "window" object:

local window = {}

--#  a bunch of bs

function window.getSize()
  return window.width, window.height
end

Or something along the lines.
Vilsol #7
Posted 11 August 2013 - 08:38 PM
Seems like you have taken the idea from my OS. I have already started working on window support. But its actually good that now we have a "competition" which will all come down to efficiency!

/me reads your code
Seems like you are a lot more experienced than me… so I guess I can just give up now…
Maybe you want to work on it together?
Edited on 11 August 2013 - 07:12 PM
Kingdaro #8
Posted 11 August 2013 - 09:57 PM
Maybe you want to work on it together?
I'm not open to making it a group thing, but anyone is welcome to fork the repo and contribute their own bits of code or CB-themed programs via pull requests.
GravityScore #9
Posted 12 August 2013 - 04:03 AM
Wow, absolutely awesome Kingdaro! My favourite OS in terms of actual practicality and usability by far! :D/> (PearOS is very nice graphically, but you can't do anything in it)

Few suggestions:
- It would be really cool if you monitored the shell's program stack somehow (through shell.run maybe), and whenever a program was added to the stack you open it in a new multitasking tab (like when running a program through LuaIDE).
- One problem I found was that the OS seems to crash if you do while true do print("hello") end or something similar, probably due to lack of yielding, not sure how to fix this, if you wanted to fix it.
- The computer doesn't seem to remember me setting a name? I set a name at startup, then quit it, then it asks again. Is this a bug of sorts?
- A more GUI centric installer would be nice :)/>
- Would hiding the global CraftBang functions from programs when you run them to avoid them messing with the OS be worth it? Are you intending to allow a developer to use them or not?
- Finally, did you plan to include any default programs with this OS? It would be cool, maybe have an option for downloading them in the installer, or add some form of quick download store for common programs on the forums. This would be awesome :D/>

Personally, I would try to keep this OS from being too feature bloated, so I wouldn't include an API, and have default programs for the OS an option in the installer, and just have a quick download store, with a few programs (not user submitted, or maybe have user submitted ones in a completely different section from the common useage ones if you wanted to make it communal) for easy download, so you don't have to go looking up the pastebin IDs all the time, and maybe a weekly/monthly/whenever you feel like it highlight if you're bored :P/>
Kingdaro #10
Posted 12 August 2013 - 01:49 PM
Wow, absolutely awesome Kingdaro! My favourite OS in terms of actual practicality and usability by far! :D/>/ (PearOS is very nice graphically, but you can't do anything in it)

Few suggestions:
- It would be really cool if you monitored the shell's program stack somehow (through shell.run maybe), and whenever a program was added to the stack you open it in a new multitasking tab (like when running a program through LuaIDE).
- One problem I found was that the OS seems to crash if you do while true do print("hello") end or something similar, probably due to lack of yielding, not sure how to fix this, if you wanted to fix it.
- The computer doesn't seem to remember me setting a name? I set a name at startup, then quit it, then it asks again. Is this a bug of sorts?
- A more GUI centric installer would be nice :)/>
- Would hiding the global CraftBang functions from programs when you run them to avoid them messing with the OS be worth it? Are you intending to allow a developer to use them or not?
- Finally, did you plan to include any default programs with this OS? It would be cool, maybe have an option for downloading them in the installer, or add some form of quick download store for common programs on the forums. This would be awesome :D/>

Personally, I would try to keep this OS from being too feature bloated, so I wouldn't include an API, and have default programs for the OS an option in the installer, and just have a quick download store, with a few programs (not user submitted, or maybe have user submitted ones in a completely different section from the common useage ones if you wanted to make it communal) for easy download, so you don't have to go looking up the pastebin IDs all the time, and maybe a weekly/monthly/whenever you feel like it highlight if you're bored :P/>

Thanks for the feedback, GS. Glad you like it!

- I actually tried to do that, but environments weren't really playing nice with me at the time. I might try it again sometime in the future though. (Then again, I could just overwrite it on coroutine resume, like I'm doing with os.pullEvent. Bleh.)
- That's…very odd. Though I'm pretty sure that's because the coroutine is resumed in writing to the buffer, and the coroutine hasn't stopped resuming for the buffer to draw to the screen. Not exactly sure how to fix that…hm.
- Not sure? Every computer I've tested it on never asked again once I've set the name. It's not an issue with preference saving or whatever, because it uses the computer's label. That's curious.
- I thought about it, and it's more effort than its worth, and not really necessary. :P/> (I'd do it if I could use my arealib though!)
- I was sort of iffy about hiding global CB functions myself. I had the idea that a programmer (or even a user) could screw up the system and your preferences bad with access to them. On the other side of the spectrum, having access to the global craftbang functions would allow programs to add new tasks, open dialogues, access craftbang's version, and a number of other neat helpful stuff. I'll think about it, I suppose.
- Default programs are definitely a yes! The terminal is actually one of them; you can just run it on its own in CraftOS by running craftbang/terminal.

What to include, I'm not sure. Of course I won't be including too many programs to keep that lightweight feel, as you've said, but a couple of default shortcuts and nice apps to start people off definitely wouldn't hurt.

As for the store, that might work out pretty well, the more I think about it.
Negi #11
Posted 13 August 2013 - 06:35 AM
I like the whole thing, just that, for the logo, may you should replace the grass block by a crafting table. And give an option in the graphical interface for quick shutdown, like a status bar with "Shutdown", "Reboot" buttons and may a "Menu" were the user could register programs that he don't wants on his desktop and for which he wants to keep a shortcut.

Edit : I said that, 'cuz I have nothing else to say and that I don't like posting simple "Like it" messages.
Edited on 17 August 2013 - 02:02 AM
Kingdaro #12
Posted 13 August 2013 - 11:14 PM
I like the whole thing, just that, for the logo, may you should replace the grass block by a crafting table.
I had that thought too, but the "Craft" part of the name stems from "Minecraft", which more often than not, when not symbolized by the iconic title text, is symbolized by a dirt block, so there's my logic there.

And give an option in Pulse for quick shutdown, like a status bar with "Shutdown", "Reboot" buttons and may a "Menu" were the user could register programs that he don't wants on his desktop and for which he wants to keep a shortcut.
The taskbar is to be reserved for tasks. Nothing more, nothing less.

Also, for the record, "pulse" is only a program that turns a lamp on and off. I use it to test the persistence of timer events in programs.
DarkEspeon #13
Posted 14 August 2013 - 12:10 AM
I like the whole thing, just that, for the logo, may you should replace the grass block by a crafting table.
I had that thought too, but the "Craft" part of the name stems from "Minecraft", which more often than not, when not symbolized by the iconic title text, is symbolized by a dirt block, so there's my logic there.

And give an option in Pulse for quick shutdown, like a status bar with "Shutdown", "Reboot" buttons and may a "Menu" were the user could register programs that he don't wants on his desktop and for which he wants to keep a shortcut.
The taskbar is to be reserved for tasks. Nothing more, nothing less.

Also, for the record, "pulse" is only a program that turns a lamp on and off. I use it to test the persistence of timer events in programs.

Actually in 1.6 minecraft is now represented by a crafting table, so maybe switch it up?
Dave-ee Jones #14
Posted 14 August 2013 - 03:08 AM
Noice.
I like how you can choose the different 'shell tabs'. It's great!

Keep up the good work!
Grim Reaper #15
Posted 14 August 2013 - 11:38 AM
I don't really see what the big deal is about the logo for this program. So what if it's a block of dirt? If you're using this program, then you should probably be paying more attention to the functionality, not the logo.

Great program, though :)/>
Kingdaro #16
Posted 14 August 2013 - 04:15 PM
Heh, yeah. The logo is only there to make my post look pretty.

Thanks DE, AutoLocK and Grim.
DarkEspeon #17
Posted 14 August 2013 - 05:27 PM
So King, how did you make the tab system, I have never found out how to do that its a cool feature. I would love it if you could pm me and tell me how you did it. Thanks
Kingdaro #18
Posted 14 August 2013 - 06:31 PM
So King, how did you make the tab system, I have never found out how to do that its a cool feature. I would love it if you could pm me and tell me how you did it. Thanks
A PM isn't necessary. Free information for everyone!

So basically, I have a table of tasks. Tasks are, to me, what you refer to as a tab. A task has the following properties: position x and y, width, height, a name, and a "run" coroutine, which is the task's program. One of these task is marked as active, simply through an "activeTask" variable.

When a task is created, the run function that is converted into a coroutine is basically just a shell.run() on whatever program you run. The coroutine is created, and stored in the task as task.run.

In my main event loop, the first thing I do every loop is draw everything. This is where I draw the panel's tasks in the panel's table of tasks, one by one.

The next thing I do in the event loop is the usual os.pullEvent. I pass the results from os.pullEvent into every task, and every task resumes its coroutine with these results. I only pass input events (key, char, mouse_click, etc.) into the active task, and every other event to every task.

Before resuming a coroutine, I redirect the terminal to the task's buffer, which is a fancy name for a screen that can be drawn on, but doesn't show until you actually draw that screen. The drawing operations of each task will show up in its buffer, and I draw the active task's buffer to the screen every loop.

As for the non-technical side of tasks, every time a task is added or removed, I change the task's x and width properties so they all stretch across the width of the panel.

I hope I explained everything well.
DarkEspeon #19
Posted 14 August 2013 - 09:42 PM
oh i never thought of using coroutines… thank you so much kingdaro. This gives me a few ideas of how i can do my own os eventually.
svdragster #20
Posted 17 August 2013 - 07:25 AM
Really nice job you did there! People really learn from your programs, also the documentation and replies help alot
Stevephan #21
Posted 17 August 2013 - 11:09 PM
Perfect. Just amazingly perfect. Good job, Doctor.
Mackan90096 #22
Posted 19 August 2013 - 07:36 AM
Wow.
This is just. amazing!

I never thought this was possible!
Tiin57 #23
Posted 19 August 2013 - 03:56 PM
Perfect. Just amazingly perfect. Good job, Doctor.

His name is actually Kingdaro; his title is The Doctor. Common mistake, no worries.

Excellent work here, King.
Sora Firestorm #24
Posted 27 August 2013 - 04:40 PM
I'm seriously loving this. There are a few things that I'd have done differently (mostly regarding the task panel), but that doesn't detract from how awesome CB is. Thanks for winnage!
CraftedCart #25
Posted 28 August 2013 - 04:03 AM
Not a bad os/ desktop environment, I just wish I had a (real life) computer to test it on.
Did you get the name from CrunchBang Linux (#!)
Kingdaro #26
Posted 28 August 2013 - 06:21 AM
Did you get the name from CrunchBang Linux (#!)
Yes I did.
gudenau #27
Posted 28 August 2013 - 12:54 PM
Can you make the icons something other than the blank square?
badjman #28
Posted 29 August 2013 - 02:36 PM
Did you get the name from CrunchBang Linux (#!)
Yes I did.

Have/are you using it right now? I am, and all you need is a right click pop-up menu x3
CraftedCart #29
Posted 29 August 2013 - 04:08 PM
Did you get the name from CrunchBang Linux (#!)
Yes I did.

Have/are you using it right now? I am, and all you need is a right click pop-up menu x3
No. iPad
Kingdaro #30
Posted 29 August 2013 - 05:46 PM
Have/are you using it right now? I am, and all you need is a right click pop-up menu x3
I was, but I got tired of having to edit my application menu whenever I installed a new application. I was also tired of Debian's many outdated but "stable" packages.

For what it is and what it aims to be, though, #! is great, and was ultimately my inspiration for making this. Took some elements here and there and added my own minimalist touch.

Can you make the icons something other than the blank square?
I might just need to include an image editor with CB eventually, since the default paint doesn't support transparency.

However my other program, Canvas, does and works decently well, but is still missing a lot of features that I wanted to add but never got around to. Perhaps when I do all of what I need to do with CB (fixing a couple of bugs with coroutine yielding, adding more intuitive and easy customization options, allow transparency for programs), I'll see to allowing icons for shortcuts.
AngryTubersLP #31
Posted 07 September 2013 - 09:29 PM
AMAZING!
Shnupbups #32
Posted 11 September 2013 - 11:29 PM
OMG I love this! It is THE most amazing shell I've seen! As for the image editor, you could ask nitrogenfingers for nPaintPro, which supports transparency.
Kingdaro #33
Posted 12 September 2013 - 07:19 AM
nPaintPro doesn't support custom image sizes, as far as I know.
nitrogenfingers #34
Posted 19 September 2013 - 12:48 PM
nPaintPro doesn't support custom image sizes, as far as I know.

npp does indeed support custom image sizes, but it does not support fixed image sizes.
Symmetryc #35
Posted 04 October 2013 - 07:34 PM
Can't believe it doesn't have more attention, really nice desktop environment :)/>.
Kingdaro #36
Posted 04 October 2013 - 07:49 PM
Can't believe it doesn't have more attention, really nice desktop environment :)/>/>.
Yeah, I'm way more inactive than other "CC Veterans" around here, so my programs don't get too much attention.

It's fine though, as long as I have fun doing what I love.
DigitalMisha #37
Posted 27 February 2014 - 07:09 PM
Can I use it for my OS? It will be main DE in LiveOS.
Alice #38
Posted 27 February 2014 - 08:40 PM
Can I use it for my OS? It will be main DE in LiveOS.
If it still works, can I do so too? :P/>
Kingdaro #39
Posted 27 February 2014 - 10:14 PM
Sure, go ahead.

And I'll go ahead and put a clear in the OP for anyone else who's interested in doing the same.
Alice #40
Posted 28 February 2014 - 03:12 AM
Thanks, I wouldn't want to even think about trying multitasking and was planning on making my OS a non-graphical shell computer. Now I can add in an optional deksktop environment
Edited on 28 February 2014 - 02:12 AM
DigitalMisha #41
Posted 28 February 2014 - 02:47 PM
And can I use a bit edited version of this DE?
Kingdaro #42
Posted 01 March 2014 - 01:08 AM
Sure! It wouldn't be your OS without your own personal touch, now would it? :P/>
AlkamlBan #43
Posted 27 April 2014 - 08:17 PM
how do you use bg and fg in your programs? and also how do you make the tabs go at the bottom and not the top? I am trying to recreate windows xp in computercraft(even though I have just a basic understanding of the lua language :(/> )
and I wanted to create that.
AlkamlBan #44
Posted 17 May 2014 - 11:50 AM
Hi Kingdaro, I just wanted to ask something. How do you make the tabs appear at the bottom. I mean you explained it above but because I am self taught I don't know how it exactly works. All I want is for you to explain in a simpler more human-like(<- WTF? :)/> ).
LDDestroier #45
Posted 03 May 2015 - 04:49 AM
I tried this OS and it looks AWESOME!! Problem is I can't use sketch, tron, ink, wysi, ice browser, or really very many programs. Please fix!

EDIT: Turns out Ice still doesn't work, but Sketch and WYSI work on a normal advance PC, not my pocket PC…still a problem. Also, CraftBang doesn't seem very well fitting to a pocket computer display, please fix that.
Edited on 03 May 2015 - 02:52 AM
tehComputerCrafter #46
Posted 18 October 2015 - 06:20 AM
Dont have any apps except for terminal :)/>
LDDestroier #47
Posted 19 October 2015 - 02:13 AM
Seriously, as far as graphical shells go, this is great! You should really consider updating it.
Edited on 19 October 2015 - 12:14 AM
Creator #48
Posted 19 October 2015 - 06:09 AM
Kingdaro has not been on the forums for a long time. I think he wrote in his GitHub that he is giving up on CC because he thinks MCN is a silly game. I might he wrong and I might be confusing him with another user, so don't tkat this as an absolute truth.
LDDestroier #49
Posted 20 October 2015 - 02:02 AM
Kingdaro has not been on the forums for a long time. I think he wrote in his GitHub that he is giving up on CC because he thinks MCN is a silly game. I might he wrong and I might be confusing him with another user, so don't tkat this as an absolute truth.

Seriously, as far as graphical shells go, this is great (and not silly)! [Someone] should really consider updating it.

2020 Hindsight: I need to stop repeating myself so much…
Edited on 01 January 2020 - 06:18 AM
bew78 #50
Posted 06 April 2016 - 06:52 AM
Does anyone has a Mirror of CraftBang ? thanks!
apemanzilla #51
Posted 23 April 2016 - 04:00 AM
Does anyone has a Mirror of CraftBang ? thanks!

Try this
LDDestroier #52
Posted 23 April 2016 - 04:17 AM

I think some links in the installer need to be changed, since it downloads from Kingdaro's repo.
apemanzilla #53
Posted 24 April 2016 - 01:57 AM

I think some links in the installer need to be changed, since it downloads from Kingdaro's repo.

Of course, but at least it's a mirror of the code.
LDDestroier #54
Posted 14 October 2016 - 02:51 AM
I made a modified installer to use ElfDecker's repo, and it crashes. I don't know why, as it all still downloads properly. Link.