refactor: make the graphics applet more like the mockup

This commit is contained in:
Ashley Wulber 2023-01-12 14:30:58 -05:00 committed by Ashley Wulber
parent c009d14eea
commit a253dee83a
13 changed files with 311 additions and 149 deletions

View file

@ -1,11 +1,34 @@
mod dbus;
mod graphics;
mod localize;
mod window;
use cosmic::{applet::CosmicAppletHelper, iced::Application};
use cosmic::{
applet::{cosmic_panel_config::PanelAnchor, CosmicAppletHelper},
iced::{wayland::InitialSurface, Application, Settings},
iced_native::layout::Limits,
};
use window::*;
pub fn main() -> cosmic::iced::Result {
let helper = CosmicAppletHelper::default();
Window::run(helper.window_settings())
let mut settings: Settings<()> = helper.window_settings();
match helper.anchor {
PanelAnchor::Top | PanelAnchor::Bottom => {
match &mut settings.initial_surface {
InitialSurface::LayerSurface(_) => todo!(),
InitialSurface::XdgWindow(w) => {
w.autosize = true;
w.size_limits = Limits::NONE
.min_height(1)
.max_height(200)
.min_width(1)
.max_width(1000);
}
};
}
_ => {}
};
Window::run(settings)
}