Iced network applet (#31)
* builds and shows basic applet * feat: connect up subscriptions * feat: network applet mostly working
This commit is contained in:
parent
3be995a1d2
commit
9ef8098498
22 changed files with 1277 additions and 1172 deletions
|
|
@ -1,49 +1,23 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#[macro_use]
|
||||
extern crate relm4_macros;
|
||||
mod app;
|
||||
mod config;
|
||||
mod localize;
|
||||
mod network_manager;
|
||||
|
||||
pub mod task;
|
||||
pub mod ui;
|
||||
pub mod widgets;
|
||||
use log::info;
|
||||
|
||||
use gtk4::{glib, prelude::*, Orientation, Separator};
|
||||
use once_cell::sync::Lazy;
|
||||
use tokio::runtime::Runtime;
|
||||
use crate::config::{APP_ID, PROFILE, VERSION};
|
||||
use crate::localize::localize;
|
||||
|
||||
static RT: Lazy<Runtime> = Lazy::new(|| Runtime::new().expect("failed to build tokio runtime"));
|
||||
fn main() -> cosmic::iced::Result {
|
||||
// Initialize logger
|
||||
pretty_env_logger::init();
|
||||
info!("Iced Workspaces Applet ({})", APP_ID);
|
||||
info!("Version: {} ({})", VERSION, PROFILE);
|
||||
|
||||
fn main() {
|
||||
let _monitors = libcosmic::init();
|
||||
// Prepare i18n
|
||||
localize();
|
||||
|
||||
view! {
|
||||
window = libcosmic_applet::AppletWindow {
|
||||
set_title: Some("COSMIC Network Applet"),
|
||||
#[wrap(Some)]
|
||||
set_child: button = &libcosmic_applet::AppletButton {
|
||||
set_button_icon_name: "network-workgroup-symbolic",
|
||||
#[wrap(Some)]
|
||||
set_popover_child: main_box = >k4::Box {
|
||||
set_orientation: Orientation::Vertical,
|
||||
set_spacing: 10,
|
||||
set_margin_top: 20,
|
||||
set_margin_bottom: 20,
|
||||
set_margin_start: 24,
|
||||
set_margin_end: 24
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ui::current_networks::add_current_networks(&main_box, &button);
|
||||
main_box.append(&Separator::new(Orientation::Horizontal));
|
||||
ui::toggles::add_toggles(&main_box);
|
||||
let available_wifi_separator = Separator::new(Orientation::Horizontal);
|
||||
main_box.append(&available_wifi_separator);
|
||||
available_wifi_separator.hide();
|
||||
ui::available_wifi::add_available_wifi(&main_box, available_wifi_separator);
|
||||
window.show();
|
||||
|
||||
let main_loop = glib::MainLoop::new(None, false);
|
||||
main_loop.run();
|
||||
app::run()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue