PoseiOS
- 8 Devlogs
- 27 Total hours
PoseiOS is an OS inspired by the greek god of the sea: Poseidon!
PoseiOS is an OS inspired by the greek god of the sea: Poseidon!
I added two new apps: a timer app and a simple browser.
The timer app currently only supports 5 minutes. It has a start, pause, and reset button.
The browser was somewhat easier to implement. I set up a input box and a button, and programmed the button to open the link or search query that was inputted into the search box. I’m planning on adding an iframe to showcase the website directly on the OS instead of opening a new tab!
Bug where selecting 3 app mean one will inevitably be opened and cant be unselected. Fix by allowing to only select one app at a time. So when an app is selected and another app is clicked on, the currently selected app would be deselected and the new app icon would be selected.
Fixed a bug where it said the title was undefined since when the loop finished, i = 2 which is more than the object index which had only 0 and 1 (before I added more to the object). To fix this, I changed “var” to “let” and it worked again. I learned that let allows i to have it own value every iteration. So I basically implemented the for loop wrong in Javascript (I thought that var and let would do the same thing, turns out it has its differences!).
PoseiOS V1 is finally complete!!!
It’s been a while since my last devlog. Most of the time was spent trying to fix a bunch of bugs in the javascript code.
clampWindowPos() that would determine the max x and y offset that the windows could have in order to stay in the viewport. The function calculates this by calculating half of the width and height of the window (since the window has transform: translate(-50%, -50%); which causes the center to be at half the width/height). Then, it calculates the minimum left value and the maximum left value that the window could move to and did the same for the top value. Finally the function return those values.Added poseidon.md, my first app!
element.classList.add("...");
width: fit-content so that I don’t have to guess the width of my div.Aesthetic tweak: Changed cursor grab to only show when hovering over handle instead of showing over the whole window).
Reduced repetition and improved scalability by turning open/close window into a generalized function that works for all windows, so I can call the function for future apps.
A lot of bugs and back-and-forth and commenting out code to add open-close function for the apps. I found out that I needed 2 parameters for the functions closeWindowOnClick and openWindowOnClick. First parameter is used for checking if the open button (app icon) or close button was selected/tapped, and second parameter is used for targeting the specific window that should be opened/closed. The parameters made me very confused because I would sometimes misinterpret the element as the button when the element parameter being passed was linked to the window.
Added an icon and CSS styling for my first app: poseidon.md
Added attributions to my README, for the bg image and the icons.
Called addWindowTapHandler() on line 19 instead of calling addWindowTapHandler() for each window directly to reduce redundancy.
Chose mousedown instead of click for event listener so that the window auto-focus when it is tapped immediately (if click is used then the window will only focus after mouse is up).
Add open and close window functions. You can open by clicking “PoseiOS” in the topbar, and close by clicking the “x” button.
Add left & right padding on top bar.
Fix text being highlighted when dragging windows by using user-select: none; cursor: grab;
I encountered a bug where u can drag window by selecting any part of it. I fixed this by changing the id to include “-handle” so that the javascript could recognize it (before the javascript was looking for “handle” instead of “-handle” which created the bug).
backdrop-blur andbackground-color: rgba(255, 255, 255, 0.1);
transform: translate(-50%, -50%);
I started off with some boilerplate code, creating and linking the HTML, CSS, and JS files.
I added some content on the webpage.
I added a background wallpaper for the WebOS.
I styled the site using CSS, but I haven’t added any Javascript yet.
I imported the Inter Font from Google fonts.
A new tag that I learned was using background-position in order to crop/position the background image so that it fit my preferences.