Skip to content

Commit

Permalink
Changing to my liking
Browse files Browse the repository at this point in the history
  • Loading branch information
leftas committed Nov 5, 2024
1 parent c9a0114 commit f0c1a62
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 22 deletions.
21 changes: 12 additions & 9 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,24 @@ impl Application for App {
.map(|_| self.updates.view().map(Message::Updates)),
)
.push(
self.workspaces
.view(&self.config.appearance.workspace_colors)
.map(Message::Workspaces),
Row::new()
.push(
self.workspaces
.view(&self.config.appearance.workspace_colors)
.map(Message::Workspaces),
)
.push_maybe(self.window_title.view().map(|v| v.map(Message::Title))),
)
.height(Length::Shrink)
.align_items(Alignment::Center)
.spacing(4);

let center = Row::new()
.push_maybe(self.window_title.view().map(|v| v.map(Message::Title)))
.push(
self.clock
.view(&self.config.clock.format)
.map(Message::Clock),
)
.spacing(4);

let right = Row::new()
Expand All @@ -212,11 +220,6 @@ impl Application for App {
)
.push(
Row::new()
.push(
self.clock
.view(&self.config.clock.format)
.map(Message::Clock),
)
.push_maybe(
self.privacy
.as_ref()
Expand Down
4 changes: 2 additions & 2 deletions src/modules/clock.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::style::left_header_pills;
use crate::style::header_pills;
use chrono::{DateTime, Local};
use iced::{
time::every,
Expand Down Expand Up @@ -34,7 +34,7 @@ impl Clock {
pub fn view(&self, format: &str) -> Element<Message> {
container(text(self.date.format(format).to_string()))
.padding([2, 8])
.style(left_header_pills)
.style(header_pills)
.into()
}

Expand Down
3 changes: 2 additions & 1 deletion src/modules/privacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use crate::{
privacy::{PrivacyData, PrivacyService},
ServiceEvent,
},
style::header_pills,
};
use iced::{
widget::{container, Row},
Expand Down Expand Up @@ -31,7 +32,7 @@ impl PrivacyData {
.style(|theme: &Theme| container::Appearance {
background: Some(theme.palette().background.into()),
text_color: Some(theme.extended_palette().danger.weak.color),
..Default::default()
..header_pills(theme)
})
.into(),
)
Expand Down
2 changes: 1 addition & 1 deletion src/modules/settings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ impl Settings {
)
.spacing(8),
)
.style(Button::custom(HeaderButtonStyle::Right))
.style(Button::custom(HeaderButtonStyle::Full))
.padding([2, 8])
.on_press(Message::ToggleMenu)
.into()
Expand Down
17 changes: 10 additions & 7 deletions src/modules/title.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::style::header_pills;
use crate::style::right_header_pills;
use hyprland::{data::Client, event_listener::AsyncEventListener, shared::HyprDataActiveOptional};
use iced::{
subscription::channel,
Expand Down Expand Up @@ -51,12 +51,15 @@ impl Title {
}

pub fn view(&self) -> Option<Element<Message>> {
self.value.as_ref().map(|value| {
container(text(value).size(12))
.padding([2, 7])
.style(header_pills)
.into()
})
self.value
.as_ref()
.or(Some("".to_string()).as_ref())
.map(|value| {
container(text(value).size(12))
.padding([4, 8])
.style(right_header_pills)
.into()
})
}

pub fn subscription(&self) -> Subscription<Message> {
Expand Down
4 changes: 2 additions & 2 deletions src/modules/workspaces.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
config::AppearanceColor,
style::{header_pills, WorkspaceButtonStyle},
style::{left_header_pills, WorkspaceButtonStyle},
};
use hyprland::{
event_listener::AsyncEventListener,
Expand Down Expand Up @@ -139,7 +139,7 @@ impl Workspaces {
.padding([4, 8])
.align_y(alignment::Vertical::Center)
.height(Length::Shrink)
.style(header_pills)
.style(left_header_pills)
.into()
}

Expand Down
14 changes: 14 additions & 0 deletions src/style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,20 @@ pub fn left_header_pills(theme: &Theme) -> container::Appearance {
}
}

pub fn right_header_pills(theme: &Theme) -> container::Appearance {
let palette = theme.palette();
container::Appearance {
background: Some(palette.background.into()),
border: Border {
width: 0.0,
radius: [0.0, 12.0, 12.0, 0.0].into(),
color: Color::TRANSPARENT,
},
text_color: Some(palette.text),
..Default::default()
}
}

pub enum HeaderButtonStyle {
Full,
Right,
Expand Down

0 comments on commit f0c1a62

Please sign in to comment.