status-area: Support vertical panel
This commit is contained in:
parent
fba8596759
commit
56d3a754e2
1 changed files with 11 additions and 4 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
app::{self, Command},
|
app::{self, Command},
|
||||||
|
applet::cosmic_panel_config::PanelAnchor,
|
||||||
iced::{
|
iced::{
|
||||||
self,
|
self,
|
||||||
wayland::{
|
wayland::{
|
||||||
|
|
@ -172,8 +173,7 @@ impl cosmic::Application for App {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn view(&self) -> cosmic::Element<'_, Msg> {
|
fn view(&self) -> cosmic::Element<'_, Msg> {
|
||||||
// XXX connect open event
|
let children = self.menus.iter().map(|(id, menu)| {
|
||||||
iced::widget::row(self.menus.iter().map(|(id, menu)| {
|
|
||||||
match menu.icon_pixmap() {
|
match menu.icon_pixmap() {
|
||||||
Some(icon) if menu.icon_name() == "" => {
|
Some(icon) if menu.icon_name() == "" => {
|
||||||
self.core.applet.icon_button_from_handle(icon.clone())
|
self.core.applet.icon_button_from_handle(icon.clone())
|
||||||
|
|
@ -182,8 +182,15 @@ impl cosmic::Application for App {
|
||||||
}
|
}
|
||||||
.on_press(Msg::TogglePopup(*id))
|
.on_press(Msg::TogglePopup(*id))
|
||||||
.into()
|
.into()
|
||||||
}))
|
});
|
||||||
.into()
|
if matches!(
|
||||||
|
self.core.applet.anchor,
|
||||||
|
PanelAnchor::Left | PanelAnchor::Right
|
||||||
|
) {
|
||||||
|
iced::widget::column(children).into()
|
||||||
|
} else {
|
||||||
|
iced::widget::row(children).into()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn view_window(&self, _surface: window::Id) -> cosmic::Element<'_, Msg> {
|
fn view_window(&self, _surface: window::Id) -> cosmic::Element<'_, Msg> {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue