Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 67 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ i18n-embed = { version = "0.16", default-features = false, features = [
i18n-embed-fl = "0.10"
rust-embed = "8"
unic-langid = "0.9"
evdev = { version = "0.13.2", features = ["tokio"] }

[patch.crates-io]
# Patched softbuffer that uses wl_shm Argb8888 so the tiny-skia fallback
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
- System Information (CPU, RAM, Disk, IP address, Network speed, Temperature) with warn/alert thresholds
- Keyboard Layout with custom labels (Hyprland/Niri/MangoWC)
- Keyboard Submap (Hyprland/MangoWC)
- Keyboard Locks indicator (Caps Lock, Num Lock, Scroll Lock)
- System Tray with context menus
- Clock with calendar, weather, timezone cycling, and format cycling (Tempo)
- Privacy indicators (microphone, camera, and screenshare usage)
Expand Down
11 changes: 11 additions & 0 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::{
self,
custom_module::Custom,
keyboard_layout::KeyboardLayout,
keyboard_locks::KeyboardLocks,
keyboard_submap::KeyboardSubmap,
media_player::MediaPlayer,
notifications::Notifications,
Expand Down Expand Up @@ -62,6 +63,7 @@ pub struct App {
pub window_title: WindowTitle,
pub system_info: SystemInfo,
pub keyboard_layout: KeyboardLayout,
pub keyboard_locks: KeyboardLocks,
pub keyboard_submap: KeyboardSubmap,
pub tray: TrayModule,
pub tempo: Tempo,
Expand Down Expand Up @@ -132,6 +134,7 @@ impl App {
window_title: WindowTitle::new(config.window_title),
system_info: SystemInfo::new(config.system_info),
keyboard_layout: KeyboardLayout::new(config.keyboard_layout),
keyboard_locks: KeyboardLocks::new(config.keyboard_locks),
keyboard_submap: KeyboardSubmap::default(),
tray: TrayModule::new(config.tray),
tempo: Tempo::new(config.tempo),
Expand Down Expand Up @@ -197,6 +200,10 @@ impl App {
.map(Message::KeyboardLayout);

self.keyboard_submap = KeyboardSubmap::default();
self.keyboard_locks
.update(modules::keyboard_locks::Message::ConfigReloaded(
config.keyboard_locks,
));
self.tempo
.update(modules::tempo::Message::ConfigReloaded(config.tempo));
self.settings
Expand Down Expand Up @@ -342,6 +349,10 @@ impl App {
self.keyboard_submap.update(message);
Task::none()
}
Message::KeyboardLocks(message) => {
self.keyboard_locks.update(message);
Task::none()
}
Message::Tray(msg) => match self.tray.update(msg) {
modules::tray::Action::None => Task::none(),
modules::tray::Action::ToggleMenu(name, id, button_ui_ref) => {
Expand Down
1 change: 1 addition & 0 deletions src/app/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub enum Message {
WindowTitle(modules::window_title::Message),
SystemInfo(modules::system_info::Message),
KeyboardLayout(modules::keyboard_layout::Message),
KeyboardLocks(modules::keyboard_locks::Message),
KeyboardSubmap(modules::keyboard_submap::Message),
Tray(modules::tray::Message),
Tempo(modules::tempo::Message),
Expand Down
6 changes: 6 additions & 0 deletions src/components/icons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ pub enum StaticIcon {
LeftChevron,
RightChevron,
Keyboard,
CapsLock,
NumLock,
ScrollLock,
Mouse,
Gamepad,
KeyboardBatteryFull,
Expand Down Expand Up @@ -222,6 +225,9 @@ impl StaticIcon {
StaticIcon::LeftChevron => "\u{f0141}",
StaticIcon::RightChevron => "\u{f0142}",
StaticIcon::Keyboard => "\u{f030c}",
StaticIcon::CapsLock => "\u{f0a9b}",
StaticIcon::NumLock => "\u{f03a6}",
StaticIcon::ScrollLock => "\u{f0792}",
StaticIcon::Mouse => "\u{f037d}",
StaticIcon::Gamepad => "\u{f05ba}",
StaticIcon::KeyboardBatteryFull => "\u{c0000}",
Expand Down
37 changes: 37 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ pub struct Config {
pub appearance: Appearance,
pub media_player: MediaPlayerModuleConfig,
pub keyboard_layout: KeyboardLayoutModuleConfig,
pub keyboard_locks: KeyboardLocksModuleConfig,
pub animations: AnimationsConfig,
pub enable_esc_key: bool,
pub osd: OsdConfig,
Expand All @@ -69,6 +70,7 @@ impl Default for Config {
appearance: Appearance::default(),
media_player: MediaPlayerModuleConfig::default(),
keyboard_layout: KeyboardLayoutModuleConfig::default(),
keyboard_locks: KeyboardLocksModuleConfig::default(),
animations: AnimationsConfig::default(),
custom_modules: vec![],
enable_esc_key: false,
Expand Down Expand Up @@ -182,6 +184,39 @@ pub struct KeyboardLayoutModuleConfig {
pub labels: HashMap<String, String>,
}

#[derive(Deserialize, Clone, Copy, Debug, Default, PartialEq, Eq)]
pub enum LockVisibility {
AlwaysVisible,
#[default]
ActiveOnly,
}

#[derive(Deserialize, Clone, Debug, PartialEq, Eq)]
#[serde(default)]
pub struct LockIndicatorConfig {
pub enabled: bool,
pub visibility: LockVisibility,
pub icon: Option<String>,
}

#[derive(Deserialize, Clone, Debug, Default, PartialEq, Eq)]
#[serde(default)]
pub struct KeyboardLocksModuleConfig {
pub caps_lock: LockIndicatorConfig,
pub num_lock: LockIndicatorConfig,
pub scroll_lock: LockIndicatorConfig,
}

impl Default for LockIndicatorConfig {
fn default() -> Self {
Self {
enabled: true,
visibility: LockVisibility::ActiveOnly,
icon: None,
}
}
}

#[derive(Deserialize, Clone, Debug)]
#[serde(default)]
pub struct SystemInfoCpu {
Expand Down Expand Up @@ -1151,6 +1186,7 @@ pub enum ModuleName {
WindowTitle,
SystemInfo,
KeyboardLayout,
KeyboardLocks,
KeyboardSubmap,
Tray,
Tempo,
Expand Down Expand Up @@ -1182,6 +1218,7 @@ impl<'de> Deserialize<'de> for ModuleName {
"WindowTitle" => ModuleName::WindowTitle,
"SystemInfo" => ModuleName::SystemInfo,
"KeyboardLayout" => ModuleName::KeyboardLayout,
"KeyboardLocks" => ModuleName::KeyboardLocks,
"KeyboardSubmap" => ModuleName::KeyboardSubmap,
"Tray" => ModuleName::Tray,
"Notifications" => ModuleName::Notifications,
Expand Down
Loading