fix(menu): styling
Also improves the styling of resize indicators, and removes the unnecessary `.density()` method call for the SSD header.
This commit is contained in:
parent
be38da47e9
commit
b7a34bdd1e
11 changed files with 70 additions and 81 deletions
|
|
@ -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)
|
||||
|
|
@ -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)
|
||||
|
|
@ -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()
|
||||
|
|
@ -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)
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
@ -503,7 +500,6 @@ impl Program for CosmicWindowInternal {
|
|||
.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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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::{
|
||||
|
|
@ -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)
|
||||
|
|
@ -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(),
|
||||
|
|
@ -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| {
|
||||
|
|
@ -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| {
|
||||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -3707,7 +3707,7 @@ impl Shell {
|
|||
cosmic::icon_theme::set_default(toolkit.icon_theme.clone());
|
||||
}
|
||||
|
||||
let mut container = cosmic::config::COSMIC_TK.lock().unwrap();
|
||||
let mut container = cosmic::config::COSMIC_TK.write().unwrap();
|
||||
if &*container != &toolkit {
|
||||
*container = toolkit;
|
||||
drop(container);
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ impl<P: Program + Send + Clone + 'static> Clone for IcedElementInternal<P> {
|
|||
}
|
||||
let mut renderer = cosmic::Renderer::TinySkia(IcedGraphicsRenderer::new(
|
||||
Backend::new(),
|
||||
cosmic::font::DEFAULT,
|
||||
cosmic::font::default(),
|
||||
Pixels(16.0),
|
||||
));
|
||||
let mut debug = Debug::new();
|
||||
|
|
@ -246,7 +246,7 @@ impl<P: Program + Send + 'static> IcedElement<P> {
|
|||
let size = size.into();
|
||||
let mut renderer = cosmic::Renderer::TinySkia(IcedGraphicsRenderer::new(
|
||||
Backend::new(),
|
||||
cosmic::font::DEFAULT,
|
||||
cosmic::font::default(),
|
||||
Pixels(16.0),
|
||||
));
|
||||
let mut debug = Debug::new();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue