mirror of
https://codeberg.org/waydeer/layer-shika.git
synced 2025-12-12 15:25:55 +00:00
| .. | ||
| declarative-config | ||
| multi-surface | ||
| simple-bar | ||
| .gitkeep | ||
| README.md | ||
layer-shika Examples
This directory contains comprehensive examples demonstrating the key features and use cases of layer-shika.
Quick Start
Each example is a standalone crate that can be run from anywhere in the workspace:
# From workspace root
cargo run -p simple-bar
cargo run -p multi-surface
cargo run -p declarative-config
# Or with logging
RUST_LOG=info cargo run -p simple-bar
# Or from the example directory
cd examples/simple-bar
cargo run
Building All Examples
From the workspace root:
cargo build --workspace
Or build a specific example:
cargo build -p simple-bar
cargo build -p multi-surface
cargo build -p declarative-config
Example Progression
Recommended learning path:
- simple-bar - Start here to understand the basics
- multi-surface - Learn about multiple surfaces and callbacks
- declarative-config - See the alternative configuration approach
Common Patterns
UI Files
Each example includes .slint files in its ui/ directory. These demonstrate:
- Window components for surfaces
- Property bindings for dynamic updates
- Callback definitions for event handling
Error Handling
All examples use layer-shika's Result<()> type for error handling with the ? operator.
Coming Soon
Additional examples demonstrating:
- Event loop integration (timers, channels, custom event sources)
- Multi-output support (multiple monitors) with different surfaces per output
- Advanced popup patterns
- Dynamic UI loading
Contributing Examples
When adding new examples:
- Create a new crate in
examples/<name>/ - Add to workspace members in root
Cargo.toml - Include
Cargo.toml,src/main.rs,ui/*.slint, andREADME.md - Follow the naming convention: kebab-case
- Add entry to this README with clear description
- Ensure code passes
cargo clippy --all-targets