Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix context menu styling #890

Merged
merged 2 commits into from
Oct 10, 2024
Merged
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
58 changes: 36 additions & 22 deletions Cargo.lock

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

36 changes: 12 additions & 24 deletions src/shell/element/resize_indicator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ impl Program for ResizeIndicatorInternal {
} else {
"go-down-symbolic"
})
.size(32)
.size(20)
.prefer_svg(true)
.apply(container)
.padding(2)
.padding(8)
.style(icon_container_style())
.width(Length::Shrink)
.apply(container)
Expand All @@ -106,10 +106,10 @@ impl Program for ResizeIndicatorInternal {
} else {
"go-next-symbolic"
})
.size(32)
.size(20)
.prefer_svg(true)
.apply(container)
.padding(4)
.padding(8)
.style(icon_container_style())
.width(Length::Shrink)
.apply(container)
Expand All @@ -120,23 +120,11 @@ impl Program for ResizeIndicatorInternal {
horizontal_space(36).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,10 +146,10 @@ impl Program for ResizeIndicatorInternal {
} else {
"go-previous-symbolic"
})
.size(32)
.size(20)
.prefer_svg(true)
.apply(container)
.padding(4)
.padding(8)
.style(icon_container_style())
.height(Length::Shrink)
.apply(container)
Expand All @@ -181,10 +169,10 @@ impl Program for ResizeIndicatorInternal {
} else {
"go-up-symbolic"
})
.size(32)
.size(20)
.prefer_svg(true)
.apply(container)
.padding(4)
.padding(8)
.style(icon_container_style())
.width(Length::Shrink)
.apply(container)
Expand Down
2 changes: 1 addition & 1 deletion src/shell/element/stack/tab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ impl<Message: TabMessage + 'static> Tab<Message> {
id,
app_icon: from_name(app_id.into()).size(16).icon(),
title: title.into(),
font: cosmic::font::FONT,
font: cosmic::font::default(),
close_message: None,
press_message: None,
right_click_message: None,
Expand Down
2 changes: 1 addition & 1 deletion src/shell/element/stack/tab_text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl TabText {
TabText {
width: Length::Shrink,
height: Length::Shrink,
font: cosmic::font::DEFAULT,
font: cosmic::font::default(),
font_size: 14.0,
selected,
text,
Expand Down
2 changes: 1 addition & 1 deletion src/shell/element/stack/tabs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ where
} else {
TabBackgroundTheme::ActiveDeactivated
})
.font(cosmic::font::FONT_SEMIBOLD)
.font(cosmic::font::semibold())
.active()
} else if i.checked_sub(1) == Some(active) {
tab.rule_style(rule).non_active()
Expand Down
5 changes: 1 addition & 4 deletions src/shell/element/stack_hover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ impl Program for StackHoverInternal {
.icon()
.into(),
horizontal_space(16).into(),
text(fl!("stack-windows"))
.font(cosmic::font::FONT)
.size(24)
.into(),
text::title3(fl!("stack-windows")).into(),
])
.align_items(Alignment::Center)
.apply(container)
Expand Down
5 changes: 1 addition & 4 deletions src/shell/element/swap_indicator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ impl Program for SwapIndicatorInternal {
.icon()
.into(),
horizontal_space(16).into(),
text(fl!("swap-windows"))
.font(cosmic::font::FONT)
.size(24)
.into(),
text::title3(fl!("swap-windows")).into(),
])
.align_items(Alignment::Center)
.apply(container)
Expand Down
15 changes: 8 additions & 7 deletions src/shell/element/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ use crate::{
},
};
use calloop::LoopHandle;
use cosmic::{
config::Density,
iced::{Color, Command},
};
use cosmic::iced::{Color, Command};
use smithay::{
backend::{
input::KeyState,
Expand Down Expand Up @@ -499,19 +496,23 @@ impl Program for CosmicWindowInternal {

fn view(&self) -> cosmic::Element<'_, Self::Message> {
let mut header = cosmic::widget::header_bar()
.start(cosmic::widget::horizontal_space(32))
.title(self.last_title.lock().unwrap().clone())
.on_drag(Message::DragStart)
.on_close(Message::Close)
.focused(self.window.is_activated(false))
.density(Density::Compact)
.on_double_click(Message::Maximize)
.on_right_click(Message::Menu);

if cosmic::config::show_minimize() {
header = header.on_minimize(Message::Minimize);
header = header
.on_minimize(Message::Minimize)
.start(cosmic::widget::horizontal_space(40)); // 32 + 8 spacing
}
if cosmic::config::show_maximize() {
header = header.on_maximize(Message::Maximize);
header = header
.on_maximize(Message::Maximize)
.start(cosmic::widget::horizontal_space(40)); // 32 + 8 spacing
}

header.into()
Expand Down
Loading
Loading