Common Development Tasks
Adding a New Icon
- Find the Unicode codepoint from the Nerd Fonts cheat sheet.
- Add it to
src/components/icons.rs:#![allow(unused)] fn main() { pub const MY_NEW_ICON: char = '\u{f0001}'; } - Build —
build.rsautomatically subsets the font to include the new glyph.
Adding a New Config Option
-
Add the field to the relevant config struct in
src/config.rs:#![allow(unused)] fn main() { #[derive(Deserialize, Clone, Debug)] #[serde(default)] pub struct MyModuleConfig { pub new_option: bool, // Add this } } -
Set a default value in the
Defaultimpl:#![allow(unused)] fn main() { impl Default for MyModuleConfig { fn default() -> Self { Self { new_option: false, } } } } -
Use the option in your module.
-
If the option should be hot-reloadable, handle it in the module’s
ConfigReloadedmessage.
Adding a D-Bus Integration
-
Create proxy definitions in a
dbus.rsfile:#![allow(unused)] fn main() { #[zbus::proxy( interface = "org.example.Service1", default_service = "org.example.Service", )] trait Service1 { #[zbus(property)] fn my_property(&self) -> zbus::Result<String>; } } -
Implement the
ReadOnlyServiceorServicetrait. -
Subscribe from a module. See Writing a New Service.
Working with the Theme
To add a new style or modify existing styles, edit src/theme.rs:
#![allow(unused)]
fn main() {
// Add a new button style method
pub fn my_button_style(&self) -> impl Fn(&Theme, Status) -> button::Style {
let opacity = self.opacity;
move |theme, status| {
// Return button::Style based on status and theme
}
}
}
Running Checks Before Committing
Always run the full check before pushing:
make check
This runs cargo fmt, cargo check, and cargo clippy -- -D warnings.
Debugging a Specific Module
To see debug output for a specific module:
# In config.toml
log_level = "warn,ashell::modules::my_module=debug"
Testing Config Hot-Reload
- Start ashell:
make start - Edit
~/.config/ashell/config.tomlin another terminal - Save — changes should appear immediately
- Check logs if changes don’t apply:
tail -f /tmp/ashell/*.log