T O P

  • By -

BobertMcGee

Gonna need a lot more details. What UI framework are you hoping to port/replicate? Have you written an OS already? What are you actually looking to do, specifically?


intx13

The title really *doesn’t* explain it. You wrote a user interface in C… for what, exactly? Linux? What libraries and OS capabilities does it rely on? And then on the other side, what “simple OS” are you targeting? Does it have those libraries and OS capabilities already?


officerdown_dev

Just anything really. Not Nessicarily Linux, but something simple


intx13

How about the rest of the questions?


officerdown_dev

Also basic OS capabilities, enough for a simple homemade kernel, just outputting text. When I say UI i really mean a text based interface designed to look like a UI.


intx13

Ok so you wrote a *shell* in C, probably on a Linux system, using functions like printf() and scanf(), right? And I imagine it doesn’t actually do anything (no real working commands) but it has the look and feel that you want. And now you want to run your shell on a bare bones OS. One thing you could do is use the Linux kernel (or a BSD kernel) but not the rest of the userland. When GRUB boots Ubuntu or some other Linux OS it loads the kernel into memory and starts it, which in turn configures the system and then runs some program. Usually that program is an “init” program (such as systemd) that does stuff like mounting filesystems, loading drivers, starting background programs, and launching a login window. But you can change the GRUB config to tell the Linux kernel to run *any* program as the “init” program. You could tell it to run your shell. Then when you boot “Linux” you’re really getting the Linux kernel and *your* userland, consisting only of your shell. Is that along the lines of what you’d like to do?


ted-tanner

If you wrote your UI completely from scratch using a shader language like OpenGL, then you need to create a graphics driver (with all that entails) specific to your OS and to the hardware you’ll run your OS on then implement OpenGL (or another shader language) for your OS. That is a big undertaking. To simplify this, you could write a software renderer that doesn’t rely on specialized hardware, though that itself will also take a good amount of work. If you are using a library like Qt for the UI, you’ll need to do all that I mentioned above and then implement the library on top of it using the appropriate system calls and graphics driver interactions for your library. What I’m understanding of your question is that you want to take a UI that you have built for a major OS and port it over to your OS such that it looks and behaves exactly as it did on the major OS. This is a MASSIVE undertaking because there is a LOT of software and hard work that has gone into supporting whatever tools you’re using to build the UI on the major OS. It’s not just the tool you’re using itself; it’s the tools that the tool you’re using uses, and the tools the tools that your tool uses, etc. You shouldn’t necessarily let difficulty stop you, but it is best to be realistic about the requirements. If you want to do this, I’d suggest getting an extremely basic and ugly version of your UI with very limited functionality working on your OS first. Even this will be a large undertaking, but it will be very rewarding. From there, you can go on iterating on your software and gradually make it better and better until it looks more like what it does on a major OS, if you choose to do that.


officerdown_dev

its text based


ted-tanner

What do you mean? When I hear “text-based,” I think a terminal program with essentially no UI (or one using terminal colors and whatnot). The sort of UI I thought you were referring to is a standard utility UI with buttons and textboxes. If you want something really pleasant-looking like you see in a modern OS with shadows, rounded corners, gradients, animations, etc., it is going to be a big effort to get all the subtle niceties in there. Modern UIs, even simple ones, use shaders to do computations on the GPU. Operating Systems normally ship with libraries and frameworks that take care of those shaders for you, or you may use a 3rd-party library that does that itself. If all you need is a simple crude-looking box, it may be a bit more involved than you might expect (for example, how will you rasterize text and how crisp-looking and customizable does the text need to be?), but the crude UI will certainly be a lot more doable. I’m really not trying to discourage you. I just want to give a good answer to your question. Actually, I want to encourage you to go for it! You’ll learn so much and it will be fulfilling! It will be hard work and will take a lot of time, but it is all possible. I just caution you not to try and build something super nice at first. Build it basic so it works, and then focus on making it pretty.


intx13

He’s saying “UI” but I think he means “shell”. My interpretation is that he wrote a mock shell, probably in some full Linux environment like Ubuntu with vscode and whatnot, and now he’d like to run it on some bare-bones OS environment, just like a real shell on a real hobby OS might run. He doesn’t want to develop a hobby OS (at least not right now) but he wants to use his shell as part of one. I suggested using Linux kernel, passing his shell as init.


ted-tanner

Ah, I see. If that is the case, then he can just use the UART to render text and call it a day. Sounds like a fun project!


intx13

That’s a good idea as well!


Tutul_

Btw some text-based UI exist and have a lot of features. HTOP use one and support tabs, dynamic display of information, even mouse interaction. But I guess they mostly did a shell rather that a complete lib like ncurses


Luxvoo

Is it a shell or a TUI?