Weby - a Custom Designed WebOS
This is a fully custom made WebOS that is fully functional on any web browser and I named it "Weby". The overall theme for the entire OS is blue because that is my favorite color and I feel like it matches my personality pretty well, too.
I made a loading screen with a sound effect that plays when you enter Weby. There is an introduction screen for a short greeting from me! Then, I included 3 so-called "apps": one that provides a little more information about me (like a bio), another app that showcases a couple of my projects that I've made (in a carousel view), and lastly, a couple of my favorite songs embedded through spotify.
If you're interested please feel free to check out my GitHub repository for Weby (as well as my other projects).
Below, I will also teach you guys how to make something similar to Weby! So be sure to follow along and don't be afraid to be creative!
Supplies
- Any code editor like Sublime Text or VS Code (I personally recommend VS Code just because of the capabilities and the ability to seamlessly link it with your GitHub repositories)
- Install Live Server in your code editor so you can launch your index.html file for preview while editing
- Have some basic knowledge of JavaScript, CSS, and HTML (but don't worry if you don't, we will be building together so you'll learn along the way)
- Get ready to personalize your own WebOS to make it however you want!
- A GitHub account (if you want to deploy this to the web instead of just localhost, if not you don't need one)
Setting Up
For the first step in making WebOS, we will be setting everything up. Inside your code editor, ensure you have these 3 files: index.html, style.css, and style.js. If you are cloning this into your GitHub repository and you want to set up a .gitignore file, you should do it now as well.
Now, have the basic template for your html code:
Inside your <head> include the following so your html code can reference you style.css and script.js files.
If you want to import any special fonts for your project this is also your time to do so. I would highly recommend going to Google Fonts, find your favorite font, select "get embedded code", and copy and paste it inside your <head> statement as well to import it. For me I imported the Lexend font:
Now we can also start editing in our style.css file with the elements we want our entire <body> to have, so essentially applying some features to the entire OS. For now I only have this:
Don't forget to call it inside your <head> in your html file like:
Now, we are ready to move on to making our intro window!
Making Our Intro Window
Here, you can do anything you want really. I decided that I wanted to take a profile picture I liked and put it as well as 3 links to my own socials. This was fairly simple but I did use some <div></div> in order to class certain elements within certain parts of the window.
You should utilize a lot of style.css in order to make the window look nicer, like applying border-radius and also a border. One important things is: make sure you are editing inside of <body>!
If you need a reference below is my index.html code for this part:
And here is my style.css code for my "welcomePop":
I used some movement styles in order to center the window to the middle of my screen because it would be easier for me to visualize the next part. I would highly recommend you to do the same as well.
So onto the next part, my favorite one!
Background + Top Bar
On this step I would highly encourage you to venture out into the web and find an image you think would fit best for your background of the OS. Keep in mind this will be one of the first things people see when they enter, so personalize it!
To add the background image into your WebOS, I would update the style/class used for the <body> tag. So in my case I went into style.css and changed my .bodyStyle:
I used background size and height in order to ensure that even if my background image wouldn't fit the window dimensions, the system would force my image to zoom in a little in order to fill in.
And now... for the top bar.
You can honestly have so many different features or words to put in the top bar, so it's honestly up to your imagination and creativity. I decided to put a live time in the right corner, the name of my OS in the middle, and just a little connected sign to the left.
Inside the html file, within <body> I had:
And the header class had these elements in my style.css:
Again, I would highly encourage you to not directly copy any of this and just tweak features to your liking! This will make your OS feel much more personalized and allow you to learn much more code during the process :)
Also, for those who are new to coding you might be wondering what is the id="timenow" inside my html file. Similar to the class="" function, id="" connects the index.html to your script.js. If we want functions such as button presses, closing and opening windows, etc we need to write all these functions in JavaScript as HTML and CSS are just for aesthetics and looks, they don't have capabilities to make interactions.
For the updating time I opted out of doing it within the script.js file, and I implemented the JavaScript code inside the index.html within <body> (towards the very end), using <script>. This functions the same as if you put the code inside of script.js but I just got a little lazy. Here is the code I used for updating time:
Now you have a background, intro window, and top bar! I wonder what could be next...
Close and Open Functionality + Enhancing Details
First off, let's make a close and open button for the intro window because people don't want the intro to be stuck on the screen forever right? Now, we will start to actually use id="" and implement it into script.js properly this time.
We have to make the close button graphics with HTML and CSS first though.
Inside html.index (within my welcome screen divider):
My style.css for it:
Great! Now we have a cool looking close button in our intro window. So now, since we have implemented an id for our button let's move into our script.js button.
But wait... where will the open button be? Well, for me I just put it as the "Weby" text present in my top bar, you can create a button or do the same as me! Here is my updated html code within my topbar:
We are finally good now with an open and close id in their respective places. Now inside our script.js we just need to ensure everytime we click close the window disappears, and then when we click wherever our open is the window will appear again:
The window should be able to close and open now!
We should also take this time to add some more detail into our top bar and intro window. For me I lowered the transparency for the colors and implemented some blur to make it more aesthetic. Here is my updated style code for both my top bar and intro window:
Feel free to look at other style elements and tweak all the features to your own fit. After this part you should have a pretty cool WebOS intro screen and everything should have a good aesthetic!
We will continue create our first app and app window next.
Creating First App + Drag Function
To create an icon and name for the icon, first think of an idea and the respective app picture for it! After you have an idea, you can create the app icon inside your WebOS first. Here is my code for it:
Don't worry about the id="" part as it will be for a little bit later. I also just made a style class for the icons so I wouldn't have to write their individual style elements for each app I wanted. So here is the style.css part below:
Now, similar to how we created the intro window before, we will do the same and make an app window with some personalized and unique content! Feel free to go wild here, there isn't a single correct app idea to make. For some reference, here is my app window html code:
Don't be intimidated by the code, it looks complex but really it's very simple to understand. Just try some code, keep formatting, and you'll slowly get it. You might notice that I included style="display: none;" at the very top of my window, this is because I don't want the app window to show up on initial reload. When you are editing at first, feel free to get rid of this style so you can actually see your window updating. After you finalized your window, I recommend adding it so users have to manually open the app just like a real OS.
Of course, we can't forget to do the open and close function for the app! For me my close button will be the same as my intro window, and my window open will be when an user clicks on the icon. So it's very important to have ids in the correct places and I would suggest you create unique names for them. Keep in mind the function codes will all be in script.js
Now, you app should be able to open and close! We are so close to finalizing our WebOS windows!
Let's go into some more detail and make the WebOS experience feel more surreal by adding the dragging ability for all the windows. This way all the users can move windows around by dragging them. All the work here would be done in script.js
Copy and paste this code:
What you just implemented is the basic JavaScript function in order to drag windows but of course now you need to call the function into your respective ids. So somewhere below call the drag element function on your intro window and app window we just created:
Take a moment and enjoy your draggable screens you made! It is feeling a lot more like an OS now!!!
Z-indexing (controlling Window Layers)
When you were dragging your windows, you might of realized that something didn't feel natural. Well, you're totally correct because the windows don't have layers orientation. What this means is that your most recently opened window isn't in the forefront as right now, all the windows follow a rigid layer pattern.
To solve this we need to head over to our script.js file and implement something known as Z-indexing:
So now you can implement the positioning by calling:
And also be sure to go back into your functions to open windows and add the handleWindowTap. For reference here is my updated welcome screen:
Be sure to do this for all the open functions you have right now and also in the near future.
At this point, you might also realize something, that we have to call both the drag function and z-indexing function for each window id each time, so if we want to create multiple apps it won't be very efficient. So therefore, we can create a function that does both functions in order to save time and optimize:
So now instead of calling each function separately all we have to do is to type:
How cool is that right? There are infinite possibilities here just continue to explore!
Make More Apps
We have essentially covered how to make the entire WebOS, so at this time you should go ahead and create more apps you want. I didn't show you how to create my other apps because this WebOS is supposed to be unique for you! But, of course, if you're interested in how to create my other windows feel free to check out my project on GitHub (linked in intro).
This is also a very good opportunity for self growth especially if you're new to coding. Don't be afraid to test more features, mess up, debug, and continue. The only way to grow is through repetition and have some fun with this!
Keep exploring, coding, and I can't wait to see what kind of OS you will make!
Creating Loading Screen
One last thing you can add to your WebOS is a loading screen. Of course, some people might prefer not to but I just feel like it's such a cool feature to have in mine! So if you want to create one follow along with me.
Try to image and make what the loading screen will look like and implement it into HTML. If you want also import a startup sound for your OS. Here is my code:
I also wanted to implementing dots that were moving so I had an id for it as well.
Here is my script.js code for all of this:
With this you should have an amazing WebOS with all the features and now even a loading screen! How far you've come! Also, once again, don't be afraid to get creative with the loading screen I liked to keep mine simple for the minimalistic effect, but you can do anything. Let your imagination and creativity run wild!
(Extra) Deploying to GitHub Pages
After you finish making your WebOS and finalized everything you can either keep it in localhost (only you can see it), or you can deploy it to the web (yes, the actually web). If you want the latter, I would highly recommend you host it on github pages if you already had a github repository while you were making your OS. There are a bunch of other methods too, such as hosting on Vercel, etc. It's all up to personal preference, but I will be showing you how to do it through Pages.
For me, I like to implement a workflow in order to make everything deploy smoothly. So inside your project folder, create a ".github" folder, and within that create a subfolder called "workflows". Now create a file called "deploy.yml" inside the "workflows" subfolder. Please make sure all everything is lowercase and spelt correctly because github is very case sensitive.
Now inside deploy.yml, you should have something like this:
For the part where it says "path: './Code', please change the pathway to wherever your index.html and all your other code is stored. Again, make sure all the lower and upper case is correct as github is super case sensitive.
Now, commit the message and inside your github repository click on the "Actions" tab and you should see a yellow dot. After a while it should deploy and you would get a link to your pages, meaning your OS is officially deployed into the web so anyone can see!
If you do happen to run into problems when using your OS through the deployed link (picture not appearing, sound not playing), please go back into your code and ensure all the path names have the correct spelling and also cases. This is due to html and css files not being case sensitive, while GitHub is super strict on it.
Enjoy your officially launched WebOS and show it to the whole world! I can't wait to see where your creativity leads you to!
Keep coding, and, most importantly, keep having fun! :)