wip: update libcosmic (#93)
* wip: update libcosmic * fix: damge issue resolved by updating iced * fix: high cpu usage by time applet and app-list * refactor subscriptions to produce fewer events * refactor network applet to use less cpu * fix: text size * refactor: i18n for audio applet * refactor: power applet i18n setup * fix (battery): always send profile update * fix (battery): set toggler width to layout correctly * fix (app-list): backoff for restarts of toplevel subscription * fix (network): alignment * feat: ask for comfirmation before applying power applet actions * wip: integrate cosmic-config * update zbus * feat: update to use latest libcosmic * update iced * udpate deps * update deps * refactor: move applet helpers to this repo, outside of libcosmic. this should help alleviate some dependency hell * chore update deps * update deps * cleanup
This commit is contained in:
parent
8b46cc209f
commit
9ebd9b511a
48 changed files with 2841 additions and 1681 deletions
|
|
@ -1,19 +1,19 @@
|
|||
use calloop::channel::SyncSender;
|
||||
use cosmic::applet::cosmic_panel_config::PanelAnchor;
|
||||
use cosmic::applet::CosmicAppletHelper;
|
||||
use cosmic::iced::alignment::{Horizontal, Vertical};
|
||||
use cosmic::iced::mouse::{self, ScrollDelta};
|
||||
use cosmic::iced::wayland::actions::window::SctkWindowSettings;
|
||||
use cosmic::iced::wayland::{window::resize_window, InitialSurface};
|
||||
use cosmic::iced::widget::{column, container, row, text};
|
||||
use cosmic::iced::Color;
|
||||
use cosmic::iced::{
|
||||
subscription, widget::button, window, Application, Command, Event::Mouse, Length, Settings,
|
||||
Subscription,
|
||||
};
|
||||
use cosmic::iced_style::application::{self, Appearance};
|
||||
use cosmic::iced_style::Color;
|
||||
use cosmic::theme::Button;
|
||||
use cosmic::{Element, Theme};
|
||||
use cosmic_applet::cosmic_panel_config::PanelAnchor;
|
||||
use cosmic_applet::CosmicAppletHelper;
|
||||
use cosmic_protocols::workspace::v1::client::zcosmic_workspace_handle_v1;
|
||||
use std::cmp::Ordering;
|
||||
use wayland_backend::client::ObjectId;
|
||||
|
|
@ -25,10 +25,7 @@ use crate::wayland_subscription::{workspaces, WorkspacesUpdate};
|
|||
pub fn run() -> cosmic::iced::Result {
|
||||
let settings = Settings {
|
||||
initial_surface: InitialSurface::XdgWindow(SctkWindowSettings {
|
||||
iced_settings: cosmic::iced_native::window::Settings {
|
||||
size: (32, 32),
|
||||
..Default::default()
|
||||
},
|
||||
size: (32, 32),
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
|
|
@ -103,7 +100,7 @@ impl Application for IcedWorkspacesApplet {
|
|||
Layout::Row => (unit * self.workspaces.len().max(1) as u32, unit),
|
||||
Layout::Column => (unit, unit * self.workspaces.len().max(1) as u32),
|
||||
};
|
||||
return resize_window(window::Id::new(0), w, h);
|
||||
return resize_window(window::Id(0), w, h);
|
||||
}
|
||||
WorkspacesUpdate::Started(tx) => {
|
||||
self.workspace_tx.replace(tx);
|
||||
|
|
@ -141,6 +138,7 @@ impl Application for IcedWorkspacesApplet {
|
|||
.filter_map(|w| {
|
||||
let btn = button(
|
||||
text(w.0.clone())
|
||||
.size(14)
|
||||
.horizontal_alignment(Horizontal::Center)
|
||||
.vertical_alignment(Vertical::Center)
|
||||
.width(Length::Fill)
|
||||
|
|
@ -184,7 +182,7 @@ impl Application for IcedWorkspacesApplet {
|
|||
fn subscription(&self) -> Subscription<Message> {
|
||||
Subscription::batch(
|
||||
vec![
|
||||
workspaces(0).map(|(_, msg)| Message::WorkspaceUpdate(msg)),
|
||||
workspaces(0).map(|e| Message::WorkspaceUpdate(e.1)),
|
||||
subscription::events_with(|e, _| match e {
|
||||
Mouse(mouse::Event::WheelScrolled { delta }) => {
|
||||
Some(Message::WheelScrolled(delta))
|
||||
|
|
@ -197,7 +195,7 @@ impl Application for IcedWorkspacesApplet {
|
|||
}
|
||||
|
||||
fn theme(&self) -> Theme {
|
||||
self.theme
|
||||
self.theme.clone()
|
||||
}
|
||||
|
||||
fn close_requested(&self, _id: window::Id) -> Self::Message {
|
||||
|
|
@ -205,9 +203,9 @@ impl Application for IcedWorkspacesApplet {
|
|||
}
|
||||
|
||||
fn style(&self) -> <Self::Theme as application::StyleSheet>::Style {
|
||||
<Self::Theme as application::StyleSheet>::Style::Custom(|theme| Appearance {
|
||||
<Self::Theme as application::StyleSheet>::Style::Custom(Box::new(|theme| Appearance {
|
||||
background_color: Color::from_rgba(0.0, 0.0, 0.0, 0.0),
|
||||
text_color: theme.cosmic().on_bg_color().into(),
|
||||
})
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue