A desktop application developed using Rust and the Wry library to load the Kids A-Z website in a standalone window. This application is optimized for macOS, providing a custom application icon and a native user experience.
- Standalone Browser Window: Access the Kids A-Z website in a desktop application without needing a web browser.
- Custom Application Icon: Uses a custom Dock icon on macOS for an enhanced user experience.
- Cross-Platform Support: While optimized for macOS, it can be compiled and run on other platforms (custom icon functionality is macOS-specific).
Add screenshots of the application here.
-
Rust: Ensure that the Rust toolchain is installed. You can install it using:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
Wry Library Dependencies: Wry may require certain platform-specific libraries.
- macOS: Usually includes all necessary libraries.
-
Clone the Repository
git clone https://github.com/Haiyuan/kids-a-z.git cd kids-a-z
-
Prepare the Icon File
Make sure you have an
icon.icns
file in the root directory of the project for the custom application icon. -
Build the Project
cargo build --release
-
Create the macOS Application Bundle
To display the custom Dock icon correctly on macOS, you need to package the application as a
.app
bundle. You can manually create it using the following steps:# In the project root directory, create the necessary directory structure mkdir -p "Kids A-Z.app/Contents/MacOS" mkdir -p "Kids A-Z.app/Contents/Resources" # Copy the executable and resource files cp target/release/kids-a-z "Kids A-Z.app/Contents/MacOS/Kids A-Z" cp icon.icns "Kids A-Z.app/Contents/Resources/icon.icns" # Create the Info.plist file cat > "Kids A-Z.app/Contents/Info.plist" <<EOL <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDisplayName</key> <string>Kids A-Z</string> <key>CFBundleExecutable</key> <string>Kids A-Z</string> <key>CFBundleIdentifier</key> <string>com.yourcompany.kidsaz</string> <key>CFBundleName</key> <string>Kids A-Z</string> <key>CFBundleIconFile</key> <string>icon</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleVersion</key> <string>1.0</string> <key>CFBundleShortVersionString</key> <string>1.0</string> <key>NSHighResolutionCapable</key> <true/> </dict> </plist> EOL # Ensure the executable has the proper permissions chmod +x "Kids A-Z.app/Contents/MacOS/Kids A-Z"
You can also use the provided
bundle.sh
script to automate the steps above:./bundle.sh
The content of
bundle.sh
is as follows:#!/bin/bash APP_NAME="Kids A-Z" BINARY_NAME="kids-a-z" IDENTIFIER="com.yourcompany.kidsaz" VERSION="1.0" # Create application bundle directory structure mkdir -p "$APP_NAME.app/Contents/MacOS" mkdir -p "$APP_NAME.app/Contents/Resources" # Copy executable and resources cp "target/release/$BINARY_NAME" "$APP_NAME.app/Contents/MacOS/$APP_NAME" cp "icon.icns" "$APP_NAME.app/Contents/Resources/icon.icns" # Create Info.plist cat > "$APP_NAME.app/Contents/Info.plist" <<EOL <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDisplayName</key> <string>$APP_NAME</string> <key>CFBundleExecutable</key> <string>$APP_NAME</string> <key>CFBundleIdentifier</key> <string>$IDENTIFIER</string> <key>CFBundleName</key> <string>$APP_NAME</string> <key>CFBundleIconFile</key> <string>icon</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleVersion</key> <string>$VERSION</string> <key>CFBundleShortVersionString</key> <string>$VERSION</string> <key>NSHighResolutionCapable</key> <true/> </dict> </plist> EOL # Set executable permissions chmod +x "$APP_NAME.app/Contents/MacOS/$APP_NAME" echo "Application bundle created: $APP_NAME.app"
Note: Make sure to modify
BINARY_NAME
to match the name of your executable file. -
Run the Application
You can now run the application using:
open "Kids A-Z.app"
- After launching the application, it will load the Kids A-Z login page in a standalone window.
- You can use the website as you would in a browser but with the experience of a desktop application.
- Rust and Cargo: For building and managing the Rust project.
- Wry Library: For creating cross-platform WebView applications.
- macOS Specific Dependencies: Uses Cocoa framework for application bundling on macOS.
cargo run
.
├── Cargo.toml
├── src
│ └── main.rs
├── icon.icns
├── bundle.sh
└── README.md
Cargo.toml
: Configuration file for the Rust project.src/main.rs
: Main program source code.icon.icns
: Application icon file.bundle.sh
: Script to create the macOS application bundle.README.md
: Project documentation.
- Ensure that the
icon.icns
file exists in theKids A-Z.app/Contents/Resources/
directory. - Check that
CFBundleIconFile
inInfo.plist
is correctly set toicon
. - Make sure the
icon.icns
file is properly formatted. You can generate it using macOS'siconutil
tool.
- Ensure the executable has the proper permissions:
chmod +x "Kids A-Z.app/Contents/MacOS/Kids A-Z"
- Verify that
CFBundleExecutable
inInfo.plist
matches the name of the executable file.
Issues and pull requests are welcome. Before submitting, please ensure your code adheres to the project's coding standards and that you've performed necessary testing.
This project is licensed under the MIT License. See the LICENSE file for details.
- Thanks to the developers of Wry for providing robust cross-platform WebView support.
- Appreciation to all contributors who have helped improve this project.
Note: This project is intended for educational and research purposes only and is not affiliated with the official Kids A-Z. Please comply with the relevant user agreements and laws.