Skip to content
Draft
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
906 changes: 697 additions & 209 deletions Cargo.lock

Large diffs are not rendered by default.

13 changes: 7 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ iced = { git = "https://github.com/MalpenZibo/iced", features = [
"svg",
"canvas"
] }
chrono = { version = "0.4", default-features = false, features = ["clock"] }
chrono = { version = "0.4", default-features = false, features = ["clock", "serde"] }
hyprland = "0.4.0-beta.2"
serde = { version = "1.0", default-features = false, features = [] }
sysinfo = "0.37"
Expand All @@ -45,10 +45,11 @@ freedesktop-icons = "0.4"
linicon-theme = "1.2.0"
serde_json = "1"
regex = "1.12.2"
serde_with = "3.12.0"
tokio-stream = "0.1.17"
uuid = { version = "1.16.0", features = ["v4"] }
clap = { version = "4.5", features = ["derive"] }
serde_with = { version = "3.12.0", default-features = false, features = ["macros"] }
tokio-stream = { version = "0.1", default-features = false }
uuid = { version = "1.16", default-features = false, features = ["v4"] }
clap = { version = "4.5", default-features = false, features = ["std", "derive"] }
shellexpand = { version = "3", features = ["path"] }
inotify = "0.11.0"
inotify = { version = "0.11.0", default-features = false, features = ["stream"] }
pin-project-lite = "0.2.16"
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }
Binary file modified assets/ashell_icon.ttf
Binary file not shown.
15 changes: 15 additions & 0 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use crate::{
privacy::Privacy,
settings::Settings,
system_info::SystemInfo,
tempo::Tempo,
tray::TrayModule,
updates::Updates,
window_title::WindowTitle,
Expand Down Expand Up @@ -64,6 +65,7 @@ pub struct App {
pub keyboard_submap: KeyboardSubmap,
pub tray: TrayModule,
pub clock: Clock,
pub tempo: Tempo,
pub privacy: Privacy,
pub settings: Settings,
pub media_player: MediaPlayer,
Expand All @@ -86,6 +88,7 @@ pub enum Message {
KeyboardSubmap(modules::keyboard_submap::Message),
Tray(modules::tray::Message),
Clock(modules::clock::Message),
Tempo(modules::tempo::Message),
Privacy(modules::privacy::Message),
Settings(modules::settings::Message),
MediaPlayer(modules::media_player::Message),
Expand Down Expand Up @@ -133,6 +136,7 @@ impl App {
keyboard_submap: KeyboardSubmap::default(),
tray: TrayModule::default(),
clock: Clock::new(config.clock),
tempo: Tempo::new(config.tempo),
privacy: Privacy::default(),
settings: Settings::new(config.settings),
media_player: MediaPlayer::new(config.media_player),
Expand Down Expand Up @@ -165,6 +169,7 @@ impl App {
self.keyboard_layout = KeyboardLayout::new(config.keyboard_layout);
self.keyboard_submap = KeyboardSubmap::default();
self.clock = Clock::new(config.clock);
self.tempo = Tempo::new(config.tempo);
self.settings
.update(modules::settings::Message::ConfigReloaded(config.settings));
self.media_player
Expand Down Expand Up @@ -338,6 +343,9 @@ impl App {
self.clock.update(message);
Task::none()
}
Message::Tempo(message) => match self.tempo.update(message) {
modules::tempo::Action::None => Task::none(),
},
Message::Privacy(msg) => {
self.privacy.update(msg);
Task::none()
Expand Down Expand Up @@ -528,6 +536,13 @@ impl App {
MenuSize::Medium,
*button_ui_ref,
),

Some((MenuType::Tempo, button_ui_ref)) => self.menu_wrapper(
id,
self.tempo.menu_view(&self.theme).map(Message::Tempo),
MenuSize::Large,
*button_ui_ref,
),
None => Row::new().into(),
},
None => Row::new().into(),
Expand Down
2 changes: 2 additions & 0 deletions src/components/icons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ pub enum StaticIcon {
DownloadSpeed,
UploadSpeed,
Copy,
LeftChevron,
RightChevron,
Keyboard,
Mouse,
Expand Down Expand Up @@ -181,6 +182,7 @@ impl Icon for StaticIcon {
StaticIcon::DownloadSpeed => "\u{f06f4}",
StaticIcon::UploadSpeed => "\u{f06f6}",
StaticIcon::Copy => "\u{f018f}",
StaticIcon::LeftChevron => "\u{f0141}",
StaticIcon::RightChevron => "\u{f0142}",
StaticIcon::Keyboard => "\u{f030c}",
StaticIcon::Mouse => "\u{f037d}",
Expand Down
37 changes: 37 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ pub struct Config {
#[serde(default)]
pub clock: ClockModuleConfig,
#[serde(default)]
pub tempo: TempoModuleConfig,
#[serde(default)]
pub settings: SettingsModuleConfig,
#[serde(default)]
pub appearance: Appearance,
Expand All @@ -70,6 +72,7 @@ impl Default for Config {
window_title: WindowTitleConfig::default(),
system_info: SystemInfoModuleConfig::default(),
clock: ClockModuleConfig::default(),
tempo: TempoModuleConfig::default(),
settings: SettingsModuleConfig::default(),
appearance: Appearance::default(),
media_player: MediaPlayerModuleConfig::default(),
Expand Down Expand Up @@ -299,6 +302,38 @@ impl Default for ClockModuleConfig {
}
}

#[derive(Deserialize, Clone, Debug)]
pub struct TempoModuleConfig {
#[serde(default = "default_clock_format")]
pub clock_format: String,
#[serde(default)]
pub weather_location: WeatherLocation,
}

#[derive(Deserialize, Default, Clone, Debug)]
pub enum WeatherLocation {
#[default]
Current,
City(String),
Coordinates {
latitude: f32,
longitude: f32,
},
}

fn default_clock_format() -> String {
"%a %d %b %R".to_string()
}

impl Default for TempoModuleConfig {
fn default() -> Self {
Self {
clock_format: default_clock_format(),
weather_location: WeatherLocation::default(),
}
}
}

fn default_shutdown_cmd() -> String {
"shutdown now".to_string()
}
Expand Down Expand Up @@ -677,6 +712,7 @@ pub enum ModuleName {
KeyboardSubmap,
Tray,
Clock,
Tempo,
Privacy,
Settings,
MediaPlayer,
Expand Down Expand Up @@ -709,6 +745,7 @@ impl<'de> Deserialize<'de> for ModuleName {
"KeyboardSubmap" => ModuleName::KeyboardSubmap,
"Tray" => ModuleName::Tray,
"Clock" => ModuleName::Clock,
"Tempo" => ModuleName::Tempo,
"Privacy" => ModuleName::Privacy,
"Settings" => ModuleName::Settings,
"MediaPlayer" => ModuleName::MediaPlayer,
Expand Down
1 change: 1 addition & 0 deletions src/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub enum MenuType {
Tray(String),
MediaPlayer,
SystemInfo,
Tempo,
}

#[derive(Clone, Debug)]
Expand Down
6 changes: 6 additions & 0 deletions src/modules/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub mod media_player;
pub mod privacy;
pub mod settings;
pub mod system_info;
pub mod tempo;
pub mod tray;
pub mod updates;
pub mod window_title;
Expand Down Expand Up @@ -289,6 +290,10 @@ impl App {
.view(id, &self.theme)
.map(|view| (view.map(Message::Tray), None)),
ModuleName::Clock => Some((self.clock.view(&self.theme).map(Message::Clock), None)),
ModuleName::Tempo => Some((
self.tempo.view(&self.theme).map(Message::Tempo),
Some(OnModulePress::ToggleMenu(MenuType::Tempo)),
)),
ModuleName::Privacy => self
.privacy
.view(&self.theme)
Expand Down Expand Up @@ -338,6 +343,7 @@ impl App {
),
ModuleName::Tray => Some(self.tray.subscription().map(Message::Tray)),
ModuleName::Clock => Some(self.clock.subscription().map(Message::Clock)),
ModuleName::Tempo => Some(self.tempo.subscription().map(Message::Tempo)),
ModuleName::Privacy => Some(self.privacy.subscription().map(Message::Privacy)),
ModuleName::MediaPlayer => {
Some(self.media_player.subscription().map(Message::MediaPlayer))
Expand Down
Loading