Skip to content

Commit

Permalink
fix(menu): styling
Browse files Browse the repository at this point in the history
  • Loading branch information
git-f0x committed Sep 28, 2024
1 parent afdb656 commit 0ba6b81
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 66 deletions.
40 changes: 20 additions & 20 deletions Cargo.lock

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

46 changes: 17 additions & 29 deletions src/shell/element/resize_indicator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl Program for ResizeIndicatorInternal {
text_color: Some(Color::from(theme.cosmic().accent.on)),
background: Some(Background::Color(theme.cosmic().accent_color().into())),
border: Border {
radius: 18.0.into(),
radius: 20.0.into(),
width: 0.0,
color: Color::TRANSPARENT,
},
Expand All @@ -86,18 +86,18 @@ impl Program for ResizeIndicatorInternal {
} else {
"go-down-symbolic"
})
.size(32)
.size(24)
.prefer_svg(true)
.apply(container)
.padding(2)
.padding(8)
.style(icon_container_style())
.width(Length::Shrink)
.apply(container)
.center_x()
.width(Length::Fill)
.into()
} else {
vertical_space(36).into()
vertical_space(40).into()
},
row(vec![
if edges.contains(ResizeEdge::LEFT) {
Expand All @@ -106,37 +106,25 @@ impl Program for ResizeIndicatorInternal {
} else {
"go-next-symbolic"
})
.size(32)
.size(24)
.prefer_svg(true)
.apply(container)
.padding(4)
.padding(8)
.style(icon_container_style())
.width(Length::Shrink)
.apply(container)
.center_y()
.height(Length::Fill)
.into()
} else {
horizontal_space(36).into()
horizontal_space(40).into()
},
row(vec![
text(&self.shortcut1)
.font(cosmic::font::FONT_SEMIBOLD)
.size(14)
.into(),
text(fl!("grow-window"))
.font(cosmic::font::FONT)
.size(14)
.into(),
text::heading(&self.shortcut1).into(),
text::body(fl!("grow-window")).into(),
horizontal_space(40).into(),
text(&self.shortcut2)
.font(cosmic::font::FONT_SEMIBOLD)
.size(14)
.into(),
text(fl!("shrink-window"))
.font(cosmic::font::FONT)
.size(14)
.into(),
text::heading(&self.shortcut2).into(),
text::body(fl!("shrink-window")).into(),
])
.apply(container)
.center_x()
Expand All @@ -158,18 +146,18 @@ impl Program for ResizeIndicatorInternal {
} else {
"go-previous-symbolic"
})
.size(32)
.size(24)
.prefer_svg(true)
.apply(container)
.padding(4)
.padding(8)
.style(icon_container_style())
.height(Length::Shrink)
.apply(container)
.center_y()
.height(Length::Fill)
.into()
} else {
horizontal_space(36).into()
horizontal_space(40).into()
},
])
.width(Length::Fill)
Expand All @@ -181,18 +169,18 @@ impl Program for ResizeIndicatorInternal {
} else {
"go-up-symbolic"
})
.size(32)
.size(24)
.prefer_svg(true)
.apply(container)
.padding(4)
.padding(8)
.style(icon_container_style())
.width(Length::Shrink)
.apply(container)
.center_x()
.width(Length::Fill)
.into()
} else {
vertical_space(36).into()
vertical_space(40).into()
},
])
.into()
Expand Down
2 changes: 1 addition & 1 deletion src/shell/element/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::{
};
use calloop::LoopHandle;
use cosmic::{
config::Density,
cosmic_theme::Density,
iced::{Color, Command},
};
use smithay::{
Expand Down
29 changes: 13 additions & 16 deletions src/shell/grabs/menu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ use std::sync::{

use calloop::LoopHandle;
use cosmic::{
iced::Background,
iced_core::{alignment::Horizontal, Border, Length, Pixels, Rectangle as IcedRectangle},
iced_widget::{self, horizontal_rule, text::Appearance as TextAppearance, Column, Row},
iced::{Alignment, Background},
iced_core::{alignment::Horizontal, Border, Length, Rectangle as IcedRectangle},
iced_widget::{self, text::Appearance as TextAppearance, Column, Row},
theme,
widget::{button, horizontal_space, icon::from_name, text},
widget::{button, divider, horizontal_space, icon::from_name, text},
Apply as _, Command,
};
use smithay::{
Expand Down Expand Up @@ -348,13 +348,10 @@ impl Program for ContextMenu {

Column::with_children(self.items.iter().enumerate().map(|(idx, item)| {
match item {
Item::Separator => horizontal_rule(1)
.style(theme::Rule::LightDivider)
.width(mode)
.into(),
Item::Separator => divider::horizontal::light().into(),
Item::Submenu { title, .. } => Row::with_children(vec![
horizontal_space(16).into(),
text(title).width(mode).into(),
text::body(title).width(mode).into(),
from_name("go-next-symbolic")
.size(16)
.prefer_svg(true)
Expand All @@ -363,7 +360,8 @@ impl Program for ContextMenu {
])
.spacing(8)
.width(width)
.padding([8, 24])
.padding([8, 16])
.align_items(Alignment::Center)
.apply(|row| item::SubmenuItem::new(row, idx))
.style(theme::Button::MenuItem)
.into(),
Expand All @@ -387,7 +385,7 @@ impl Program for ContextMenu {
} else {
horizontal_space(16).into()
},
text(title)
text::body(title)
.width(mode)
.style(if *disabled {
theme::Text::Custom(|theme| {
Expand All @@ -401,12 +399,11 @@ impl Program for ContextMenu {
theme::Text::Default
})
.into(),
horizontal_space(16).into(),
];
if let Some(shortcut) = shortcut.as_ref() {
components.push(
text(shortcut)
.line_height(Pixels(20.))
.size(14)
text::body(shortcut)
.horizontal_alignment(Horizontal::Right)
.width(Length::Shrink)
.style(theme::Text::Custom(|theme| {
Expand All @@ -419,14 +416,14 @@ impl Program for ContextMenu {
.into(),
);
}
components.push(horizontal_space(16).into());

Row::with_children(components)
.spacing(8)
.width(mode)
.align_items(Alignment::Center)
.apply(button::custom)
.width(width)
.padding([8, 24])
.padding([8, 16])
.on_press_maybe((!disabled).then_some(Message::ItemPressed(idx)))
.style(theme::Button::MenuItem)
.into()
Expand Down

0 comments on commit 0ba6b81

Please sign in to comment.