This guide covers the technical details of the Notedeck Chrome component, which serves as the container and navigation framework for the Notedeck Nostr browser.
notedeck_chrome
├── Cargo.toml - Project manifest and dependencies
├── android/ - Android-specific code and configuration
│ └── ...
└── src/
├── notedeck.rs - Main application entry point
├── lib.rs - Library exports
├── theme.rs - Theme definitions and customization
├── preview.rs - UI component preview system
├── chrome.rs - Core Chrome UI implementation
├── fonts.rs - Font loading and configuration
├── app.rs - Application management
├── android.rs - Android-specific code
└── setup.rs - Application setup and configuration
The Chrome
struct (src/chrome.rs
) is the main container that:
- Maintains a list of applications
- Renders the sidebar
- Handles application switching
- Processes UI actions
The NotedeckApp
enum (src/app.rs
) represents different applications that can be managed by the Chrome:
Columns
- The main Damus columns interfaceDave
- The Dave applicationOther
- Generic container for other implementations of theApp
trait
The setup.rs
file handles initialization of:
- Font loading
- Theme setup
- Window configuration
- App icons
Notedeck Chrome follows a container-based architecture:
- The
Chrome
struct maintains a vector of applications - It controls which application is active via an index
- The sidebar is rendered with buttons for each application
- When an application is selected, it's updated within the container
Android integration relies on:
- Native Android UI integration via
GameActivity
- Custom keyboard height detection for improved mobile UX
- Configuration via external JSON files
The Android integration includes custom Java code to handle keyboard visibility changes:
KeyboardHeightProvider
- Detects keyboard height changesKeyboardHeightObserver
- Interface for keyboard eventsMainActivity
- Main Android activity with JNI integration
The theme system supports:
- Light and dark mode
- OLED-optimized dark mode for mobile
- Customizable text styles
- Font loading with multiple typefaces
# Run in debug mode
cargo run -- --debug
# Run in release mode
cargo run --release
The project includes tests for:
- Database path configuration
- Command-line argument parsing
- Column initialization
Run tests with:
cargo test
- Desktop: Uses the platform-specific data location or current directory
- Android: Uses the Android app's internal storage
- Custom paths can be specified via command-line arguments
- Enable the
debug-widget-callstack
feature to debug UI hierarchy - Enable the
debug-interactive-widgets
feature to highlight interactive areas - Android logging uses
tracing-logcat
for detailed diagnostics
notedeck.rs
is the entry point, which initializesNotedeck
setup.rs
configures the application environmentChrome
is created and populated with applications- The main UI loop renders the sidebar and active application
chrome.rs
- To modify the sidebar or app container behaviortheme.rs
- To update theming and colorssetup.rs
- To change startup configurationandroid.rs
- For Android-specific changes
- Implement the
notedeck::App
trait for your application - Add a new variant to the
NotedeckApp
enum if needed - Update the
Chrome::topdown_sidebar
method to add a button for your app - Add your app to the
Chrome
instance innotedeck.rs