@@ -1,3 +1,11 @@
|
||||
//! Central module dispatch: name → [`WaybarModule::run`] lookup.
|
||||
//!
|
||||
//! The `dispatch` function is called by the IPC request handler with a module
|
||||
//! name (e.g. `"cpu"`, `"vol"`) and returns the rendered [`WaybarOutput`]. All
|
||||
//! per-module match arms are generated by [`for_each_watched_module!`];
|
||||
//! dispatch-only modules without a watch channel (power/game/btrfs) are
|
||||
//! listed manually.
|
||||
|
||||
use crate::config::Config;
|
||||
use crate::error::{FluxoError, Result as FluxoResult};
|
||||
use crate::output::WaybarOutput;
|
||||
@@ -6,8 +14,14 @@ use crate::state::AppReceivers;
|
||||
#[allow(unused_imports)]
|
||||
use crate::modules::WaybarModule;
|
||||
|
||||
/// Expands the module registry into a single [`dispatch`] match and a
|
||||
/// [`signaler_default_args`] lookup.
|
||||
macro_rules! gen_dispatch {
|
||||
($( { $feature:literal, $field:ident, $state:ty, [$($name:literal),+], [$($sig_name:literal),+], $module:path, $signal:ident, [$($default_arg:literal),*], $config:ident } )*) => {
|
||||
/// Look up a module by name and render its [`WaybarOutput`].
|
||||
///
|
||||
/// Returns [`FluxoError::Disabled`] when the module is disabled in
|
||||
/// config, and [`FluxoError::Ipc`] when the name is unknown.
|
||||
pub async fn dispatch(
|
||||
module_name: &str,
|
||||
#[allow(unused)] config: &Config,
|
||||
|
||||
Reference in New Issue
Block a user