fix(input sources): button size
This commit is contained in:
parent
5ae7a29dc7
commit
c6dd730d78
2 changed files with 32 additions and 11 deletions
|
|
@ -63,5 +63,5 @@ pub fn run() -> cosmic::iced::Result {
|
||||||
config,
|
config,
|
||||||
layouts,
|
layouts,
|
||||||
};
|
};
|
||||||
cosmic::applet::run::<Window>(true, flags)
|
cosmic::applet::run::<Window>(false, flags)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ use cosmic::app::Core;
|
||||||
use cosmic::applet::{self};
|
use cosmic::applet::{self};
|
||||||
use cosmic::cosmic_config::{self, ConfigSet};
|
use cosmic::cosmic_config::{self, ConfigSet};
|
||||||
use cosmic::iced::wayland::popup::{destroy_popup, get_popup};
|
use cosmic::iced::wayland::popup::{destroy_popup, get_popup};
|
||||||
|
use cosmic::iced::widget::{column, row};
|
||||||
use cosmic::iced::window::Id;
|
use cosmic::iced::window::Id;
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
use cosmic::iced::{alignment, Alignment, Length};
|
use cosmic::iced::{alignment, Alignment, Length};
|
||||||
|
|
@ -16,7 +17,7 @@ use cosmic::iced_futures::Subscription;
|
||||||
use cosmic::iced_runtime::core::window;
|
use cosmic::iced_runtime::core::window;
|
||||||
use cosmic::iced_style::application;
|
use cosmic::iced_style::application;
|
||||||
use cosmic::prelude::*;
|
use cosmic::prelude::*;
|
||||||
use cosmic::widget;
|
use cosmic::widget::{self, horizontal_space, vertical_space};
|
||||||
use cosmic_comp_config::CosmicCompConfig;
|
use cosmic_comp_config::CosmicCompConfig;
|
||||||
use xkb_data::KeyboardLayouts;
|
use xkb_data::KeyboardLayouts;
|
||||||
|
|
||||||
|
|
@ -161,17 +162,37 @@ impl cosmic::Application for Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn view(&self) -> Element<Self::Message> {
|
fn view(&self) -> Element<Self::Message> {
|
||||||
let suggested = self.core.applet.suggested_padding(true);
|
let input_source_text = self.core.applet.text(
|
||||||
widget::button(
|
self.active_layouts
|
||||||
self.core.applet.text(
|
.first()
|
||||||
self.active_layouts
|
.map_or(String::new(), |l| l.layout.clone()),
|
||||||
.first()
|
);
|
||||||
.map_or(String::new(), |l| l.layout.clone()),
|
|
||||||
),
|
cosmic::widget::button(
|
||||||
|
row!(
|
||||||
|
column!(
|
||||||
|
input_source_text,
|
||||||
|
horizontal_space(Length::Fixed(
|
||||||
|
(self.core.applet.suggested_size(true).0
|
||||||
|
+ 2 * self.core.applet.suggested_padding(true))
|
||||||
|
as f32
|
||||||
|
))
|
||||||
|
)
|
||||||
|
.width(Length::Shrink)
|
||||||
|
.height(Length::Shrink)
|
||||||
|
.align_items(Alignment::Center),
|
||||||
|
vertical_space(Length::Fixed(
|
||||||
|
(self.core.applet.suggested_size(true).1
|
||||||
|
+ 2 * self.core.applet.suggested_padding(true)) as f32
|
||||||
|
))
|
||||||
|
)
|
||||||
|
.align_items(Alignment::Center)
|
||||||
|
.width(Length::Shrink)
|
||||||
|
.height(Length::Shrink),
|
||||||
)
|
)
|
||||||
.style(cosmic::theme::Button::AppletIcon)
|
|
||||||
.padding([suggested / 2, suggested])
|
|
||||||
.on_press(Message::TogglePopup)
|
.on_press(Message::TogglePopup)
|
||||||
|
.padding(self.core.applet.suggested_padding(true))
|
||||||
|
.style(cosmic::theme::Button::AppletIcon)
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue