Use libcomsic-applet in status-area, network, graphics
This commit is contained in:
parent
aac43de65d
commit
765e3af815
13 changed files with 154 additions and 330 deletions
|
|
@ -1,3 +1,4 @@
|
|||
use cascade::cascade;
|
||||
use gtk4::{glib, prelude::*};
|
||||
|
||||
mod dbus_service;
|
||||
|
|
@ -14,24 +15,12 @@ fn main() {
|
|||
// XXX Implement DBus service somewhere other than applet?
|
||||
glib::MainContext::default().spawn_local(status_notifier_watcher::start());
|
||||
|
||||
let provider = gtk4::CssProvider::new();
|
||||
provider.load_from_data(include_bytes!("style.css"));
|
||||
gtk4::StyleContext::add_provider_for_display(
|
||||
>k4::gdk::Display::default().expect("Could not connect to a display."),
|
||||
&provider,
|
||||
gtk4::STYLE_PROVIDER_PRIORITY_APPLICATION,
|
||||
);
|
||||
|
||||
let status_area = StatusArea::new();
|
||||
gtk4::Window::builder()
|
||||
.decorated(false)
|
||||
.child(&status_area)
|
||||
.resizable(false)
|
||||
.width_request(1)
|
||||
.height_request(1)
|
||||
.css_classes(vec!["root_window".to_string()])
|
||||
.build()
|
||||
.show();
|
||||
cascade! {
|
||||
libcosmic_applet::AppletWindow::new();
|
||||
..set_child(Some(&status_area));
|
||||
..show();
|
||||
};
|
||||
|
||||
let main_loop = glib::MainLoop::new(None, false);
|
||||
main_loop.run();
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ struct Menu {
|
|||
|
||||
#[derive(Default)]
|
||||
pub struct StatusMenuInner {
|
||||
menu_button: DerefCell<gtk4::MenuButton>,
|
||||
menu_button: DerefCell<libcosmic_applet::AppletButton>,
|
||||
vbox: DerefCell<gtk4::Box>,
|
||||
item: DerefCell<StatusNotifierItemProxy<'static>>,
|
||||
dbus_menu: DerefCell<DBusMenuProxy<'static>>,
|
||||
|
|
@ -43,17 +43,10 @@ impl ObjectImpl for StatusMenuInner {
|
|||
gtk4::Box::new(gtk4::Orientation::Vertical, 0);
|
||||
};
|
||||
|
||||
let popover = cascade! {
|
||||
gtk4::Popover::new();
|
||||
..set_child(Some(&vbox));
|
||||
};
|
||||
|
||||
let menu_button = cascade! {
|
||||
gtk4::MenuButton::new();
|
||||
..add_css_class("panel_icon");
|
||||
..set_has_frame(false);
|
||||
libcosmic_applet::AppletButton::new();
|
||||
..set_parent(obj);
|
||||
..set_popover(Some(&popover));
|
||||
..set_popover_child(Some(&vbox));
|
||||
};
|
||||
|
||||
self.menu_button.set(menu_button);
|
||||
|
|
@ -88,7 +81,7 @@ impl StatusMenu {
|
|||
.await?;
|
||||
let obj = glib::Object::new::<Self>(&[]).unwrap();
|
||||
let icon_name = item.icon_name().await?;
|
||||
obj.inner().menu_button.set_icon_name(&icon_name);
|
||||
obj.inner().menu_button.set_button_icon_name(&icon_name);
|
||||
|
||||
let menu = item.menu().await?;
|
||||
let menu = DBusMenuProxy::builder(&connection)
|
||||
|
|
|
|||
|
|
@ -1,33 +0,0 @@
|
|||
.loading-overlay {
|
||||
background-color: #2f2f2f;
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
image.panel_icon {
|
||||
padding-left: 0px;
|
||||
padding-right: 0px;
|
||||
padding-top: 0px;
|
||||
padding-bottom: 0px;
|
||||
}
|
||||
|
||||
button.panel_icon {
|
||||
border-radius: 12px;
|
||||
transition: 100ms;
|
||||
padding: 4px;
|
||||
border-color: transparent;
|
||||
background: transparent;
|
||||
outline-color: transparent;
|
||||
}
|
||||
|
||||
button.panel_icon:hover {
|
||||
border-radius: 12px;
|
||||
transition: 100ms;
|
||||
padding: 4px;
|
||||
border-color: rgba(255, 255, 255, 0.1);
|
||||
outline-color: rgba(255, 255, 255, 0.1);
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
window.root_window {
|
||||
background: transparent;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue