This project is a simple desktop-like interface in the browser where you can open and interact with different applications like a Memory Game, a Chat application, a YouTube player, and a Task Manager.
You can view a live demo of the project here: Live Demo
Here are some screenshots of the desktop and its applications:
Full screenshot of the app with memory game open
The dock interface with application icons.
The status bar when memory game is open. We are also hovering our mouse over the battery to see the percentage.
To get a local copy up and running, follow these simple steps.
This project runs in the browser, so no special prerequisites are required.
- Clone the repo
git clone
- Open
index.html
in your browser
-
When an app is open, just like on macOS, the app name is displayed in the top left.
-
It displays the current date and time at the far right
-
It also shows the current battery percentage in an icon, and if you hover over it, we can see the percentage in numbers.
-
The battery defaults to 100% if we can't read the battery due to privacy or if the device does not have a battery to read.
-
Click on the icons in the dock to open the corresponding application.
-
You can drag the windows around and close them. When multiple windows are open, they stack on top of each other.
-
You can focus on any window by clicking its draggable bar, which will bring it to the front of the stack.
-
Also, we have some animations in the dock, and the app name is shown when hovering over an icon.
The Memory Game is a classic card game where the objective is to find and match pairs of cards.
- Click on the Memory Game icon to start the game.
- You will be prompted to choose the size of the game grid (options include 2x2, 2x4, and 4x4).
- Once the game grid is displayed, click on a card to reveal its image.
- Try to find the matching card by clicking on another card.
- The game continues until all pairs have been found.
- The game counts the number of attempts it takes to find all pairs and displays this number when the game is finished.
- Sound effects are played when cards are flipped and when pairs are found.
- The game can be reset at the end by clicking the "Reset Game" button.
- The game can also be played using the keyboard. Press tab once to focus on the game grid, then use the arrow keys to navigate between cards. Press space or enter to flip a card.
The chat application mimics the iMessage interface, displaying chat bubbles in different positions and colors based on whether the message was sent or received. It also includes sound effects for sending and receiving messages.
- Click on the Messages icon to start the chat application.
- If a username is stored in the local storage, the chat will initialize. If not, you will be prompted to enter a username. This username will be stored in the local storage for future sessions.
- Once the chat is initialized, you can type messages into the input field and then press enter to send them. Messages you send will appear on the right side of the chat interface in blue bubbles.
- Messages received from others will appear on the left side of the chat interface in gray bubbles.
- Sound effects will play when messages are sent and received.
- The chat interface is styled to mimic iMessage, with chat bubbles appearing in different positions and colors based on whether the message was sent or received.
- Sound effects play when messages are sent and received to enhance the user experience.
- The chat application uses a WebSocket connection to send and receive messages in real time.
- The application stores the username in the local storage, so you don't have to enter it every time you open the chat.
- The chat interface includes a message display area, a message input field, and a send button. The message display area automatically updated to show new messages.
- The application keeps track of the last 20 messages and displays them in the message display area.
The task manager provides an overview of all currently open windows in the application, grouped by their respective applications. It allows users to close individual windows or all windows of a specific application at once.
- Click on the Task Manager icon to open the task manager.
- The task manager interface displays a list of all open windows, grouped by application. Each group shows the name of the application and the number of open windows.
- Clicking on the name of an application will expand or collapse the list of open windows for that application.
- Each window in the list has a "Close" button that can be used to close the individual window.
- Each application group also has a "Close All" button that can be used to close all windows of that application.
- The task manager automatically updates every second to reflect the current state of the application.
- The task manager groups open windows by application, making it easy to see how many windows each application has open.
- The task manager allows users to close individual windows or all windows of a specific application at once.
- The task manager remembers the expanded/collapsed state of each application group, so if a group was expanded the last time the task manager was updated, it will remain expanded in the next update.
The Calculator app allows users to perform basic calculations, including addition, subtraction, multiplication, and division, within the application.
- Click on the Calculator icon to open the app.
- Use the displayed buttons to input numbers and arithmetic operations.
- Click on the
=
button to calculate the result. The result will be displayed in the input field at the top of the calculator. - To start a new calculation or clear the current input, click the
C
button.
- Supports basic operations including addition (
+
), subtraction (-
), multiplication (×
), and division (÷
). - The calculator features a grid of buttons representing digits and operations for easy input.
- Results are displayed immediately after pressing the
=
button. - Displays an error message in case of invalid input or calculation errors.
- A 9 character limit is in place to prevent digits from going out of frame
Game Center app is your destination for playing embedded HTML games directly in your web browser. With three games available, the interface automatically adjusts to the size of each game for a tailored experience.
- Click on the Game Center icon to open the app.
- Select from the available games by clicking on their preview.
- The game loads directly in the window, which resizes for optimal gameplay.
- To switch games, close the game. Then, reopen Game Center and select another.
- Includes popular titles like Flappy Bird, Mario Forever, and Fruit Ninja.
- The game window resizes according to the game's dimensions.
- Simple and intuitive interface for game selection and play.
The YouTube player allows users to load and play YouTube videos within the application.
- Click on the YouTube Player icon to open the YouTube player.
- Enter a YouTube video URL into the input field.
- Click the "Load Video" button to load the video. The video will be displayed in an iframe below the input field and button.
- The YouTube player supports any YouTube video URL. It extracts the video ID from the URL and uses it to load the video.
- The YouTube player uses an iframe to display the video, allowing users to watch the video without leaving the application.
- The iframe is initially hidden and is only displayed once a video is loaded.
- The YouTube player supports all standard YouTube video features, including autoplay, encrypted media, gyroscope, and picture-in-picture.
- The YouTube player also supports fullscreen mode (although outside of the PWD)
The main script (script.js
) listens for the DOMContentLoaded
event and then sets up event listeners on the application icons. When an icon is clicked, it opens the corresponding application in a new window.
Each application has its own .js
file. When an application is opened, its script is run inside the window. The status bar is also in its own .js
file which loads the status bar seperatly from everything else.
All assets are owned by me except for the messages icon, desktop background, apple logo in the top left and sound files for messages. All of these are from macOS, and are used purely for educational purposes (fair use). It is to style it to look like macOS running in a browser.
Sound effects for memory app are taken from youtube.
Games are embedded and source is from https://funhtml5games.org, https://scratch.mit.edu/ & https://www.retrogames.cc/