This commit is contained in:
2026-09-13 19:47:01 +01:00
parent 14c3bb0495
commit ec43d7b57a
12 changed files with 602 additions and 5 deletions
+2
View File
@@ -16,6 +16,7 @@ pub struct BarbarConfig {
#[derive(serde::Deserialize, Serialize, Clone, Copy, Debug)]
#[serde(rename_all = "lowercase")]
pub enum Modules {
Audio,
Clock,
Weather,
Workspaces,
@@ -24,6 +25,7 @@ pub enum Modules {
impl Modules {
pub fn to_string(&self) -> &str {
match self {
Modules::Audio => "audio",
Modules::Clock => "clock",
Modules::Weather => "weather",
Modules::Workspaces => "workspaces",
+4 -1
View File
@@ -3,11 +3,13 @@
//! Keeps the bar surface's geometry and renderer flags in one place, so `core`
//! only reads config and hands the result straight to the daemon.
use iced::Pixels;
use iced::{Font, Pixels};
use iced_layershell::reexport::{Anchor, KeyboardInteractivity};
use iced_layershell::settings::{LayerShellSettings, Settings, StartMode};
use serde::{Deserialize, Serialize};
/// Bar text font, matching quickshell's `CaskaydiaCove NFM`.
const DEFAULT_FONT: &str = "CaskaydiaCove NFM";
/// Bar height in logical px when `[display].height` is omitted.
const DEFAULT_HEIGHT: u32 = 36;
/// Default text size in logical px.
@@ -75,6 +77,7 @@ impl Display {
pub fn settings(&self) -> Settings {
Settings {
layer_settings: self.layer_settings(),
default_font: Font::with_name(DEFAULT_FONT),
default_text_size: Pixels(self.default_text_size),
antialiasing: self.antialiasing,
..Default::default()
@@ -2,8 +2,10 @@
mod datetime;
mod hyprland;
mod pipewire;
mod weather;
pub use datetime::*;
pub use hyprland::*;
pub use pipewire::*;
pub use weather::*;
@@ -0,0 +1,36 @@
//! PipeWire audio messages.
use crate::Service;
/// Route key a module subscribes under to receive the audio state.
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
pub enum PipewireMsg {
State,
}
impl PipewireMsg {
/// Route key a module subscribes under to receive this service's state.
pub fn key(self) -> Service {
Service(match self {
Self::State => "pipewire.state",
})
}
}
/// One audio node's level, as PipeWire reports it.
#[derive(Clone, Copy, PartialEq, Debug, Default)]
pub struct AudioNode {
/// Linear volume fraction: 1.0 is 100%, above 1.0 is boost.
pub volume: f32,
/// Node is muted; `volume` is still the level it will unmute to.
pub muted: bool,
}
/// Default sink and default source state, published whenever either changes.
#[derive(Clone, Copy, PartialEq, Debug, Default)]
pub struct PipewireState {
/// Default playback device.
pub sink: AudioNode,
/// Default capture device.
pub source: AudioNode,
}