update libcosmic
This commit is contained in:
parent
2c74a551c7
commit
903a5589a3
19 changed files with 2261 additions and 1877 deletions
1452
Cargo.lock
generated
1452
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -17,7 +17,6 @@ use cosmic::iced;
|
||||||
use cosmic::iced::wayland::actions::window::SctkWindowSettings;
|
use cosmic::iced::wayland::actions::window::SctkWindowSettings;
|
||||||
use cosmic::iced::wayland::popup::destroy_popup;
|
use cosmic::iced::wayland::popup::destroy_popup;
|
||||||
use cosmic::iced::wayland::popup::get_popup;
|
use cosmic::iced::wayland::popup::get_popup;
|
||||||
use cosmic::iced::wayland::SurfaceIdWrapper;
|
|
||||||
use cosmic::iced::widget::mouse_listener;
|
use cosmic::iced::widget::mouse_listener;
|
||||||
use cosmic::iced::widget::{column, row};
|
use cosmic::iced::widget::{column, row};
|
||||||
use cosmic::iced::Settings;
|
use cosmic::iced::Settings;
|
||||||
|
|
@ -39,7 +38,6 @@ use cosmic::{Element, Theme};
|
||||||
use cosmic_protocols::toplevel_info::v1::client::zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1;
|
use cosmic_protocols::toplevel_info::v1::client::zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1;
|
||||||
use freedesktop_desktop_entry::DesktopEntry;
|
use freedesktop_desktop_entry::DesktopEntry;
|
||||||
use iced::widget::container;
|
use iced::widget::container;
|
||||||
use iced::widget::horizontal_space;
|
|
||||||
use iced::Alignment;
|
use iced::Alignment;
|
||||||
use iced::Background;
|
use iced::Background;
|
||||||
use iced::Length;
|
use iced::Length;
|
||||||
|
|
@ -380,10 +378,78 @@ impl Application for CosmicAppList {
|
||||||
Command::none()
|
Command::none()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn view(&self, id: SurfaceIdWrapper) -> Element<Message> {
|
fn view(&self, id: window::Id) -> Element<Message> {
|
||||||
match id {
|
if let Some(Toplevel {
|
||||||
SurfaceIdWrapper::LayerSurface(_) => unimplemented!(),
|
toplevels,
|
||||||
SurfaceIdWrapper::Window(_) => {
|
desktop_info,
|
||||||
|
..
|
||||||
|
}) = self.toplevel_list.iter().find(|t| t.popup == Some(id))
|
||||||
|
{
|
||||||
|
let is_favorite = self.config.favorites.contains(&desktop_info.id)
|
||||||
|
|| self.config.favorites.contains(&desktop_info.name);
|
||||||
|
|
||||||
|
let mut content = column![
|
||||||
|
iced::widget::text(&desktop_info.name).horizontal_alignment(Horizontal::Center),
|
||||||
|
cosmic::widget::button(Button::Text)
|
||||||
|
.custom(vec![iced::widget::text(fl!("new-window")).into()])
|
||||||
|
.on_press(Message::Exec(desktop_info.exec.clone())),
|
||||||
|
]
|
||||||
|
.padding(8)
|
||||||
|
.spacing(4)
|
||||||
|
.align_items(Alignment::Center);
|
||||||
|
if !toplevels.is_empty() {
|
||||||
|
let mut list_col = column![];
|
||||||
|
for (handle, info) in toplevels {
|
||||||
|
let title = if info.title.len() > 20 {
|
||||||
|
format!("{:.24}...", &info.title)
|
||||||
|
} else {
|
||||||
|
info.title.clone()
|
||||||
|
};
|
||||||
|
list_col = list_col.push(
|
||||||
|
cosmic::widget::button(Button::Text)
|
||||||
|
.custom(vec![iced::widget::text(title).into()])
|
||||||
|
.on_press(Message::Activate(handle.clone())),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
content = content.push(divider::horizontal::light());
|
||||||
|
content = content.push(list_col);
|
||||||
|
content = content.push(divider::horizontal::light());
|
||||||
|
}
|
||||||
|
content = content.push(if is_favorite {
|
||||||
|
cosmic::widget::button(Button::Text)
|
||||||
|
.custom(vec![iced::widget::text(fl!("unfavorite")).into()])
|
||||||
|
.on_press(Message::UnFavorite(desktop_info.id.clone()))
|
||||||
|
} else {
|
||||||
|
cosmic::widget::button(Button::Text)
|
||||||
|
.custom(vec![iced::widget::text(fl!("favorite")).into()])
|
||||||
|
.on_press(Message::Favorite(desktop_info.id.clone()))
|
||||||
|
});
|
||||||
|
|
||||||
|
content = match toplevels.len() {
|
||||||
|
0 => content,
|
||||||
|
1 => content.push(
|
||||||
|
cosmic::widget::button(Button::Text)
|
||||||
|
.custom(vec![iced::widget::text(fl!("quit")).into()])
|
||||||
|
.on_press(Message::Quit(desktop_info.id.clone())),
|
||||||
|
),
|
||||||
|
_ => content.push(
|
||||||
|
cosmic::widget::button(Button::Text)
|
||||||
|
.custom(vec![iced::widget::text(&fl!("quit-all")).into()])
|
||||||
|
.on_press(Message::Quit(desktop_info.id.clone())),
|
||||||
|
),
|
||||||
|
};
|
||||||
|
// return Container::new(Container::new(content.width(Length::Shrink).height(Length::Shrink)).style(
|
||||||
|
// cosmic::Container::Custom(|theme| container::Appearance {
|
||||||
|
// text_color: Some(theme.cosmic().on_bg_color().into()),
|
||||||
|
// background: Some(theme.extended_palette().background.base.color.into()),
|
||||||
|
// border_radius: 12.0,
|
||||||
|
// border_width: 0.0,
|
||||||
|
// border_color: Color::TRANSPARENT,
|
||||||
|
// }),
|
||||||
|
// )).into();
|
||||||
|
return self.applet_helper.popup_container(content).into();
|
||||||
|
}
|
||||||
|
|
||||||
let (favorites, running) = self.toplevel_list.iter().fold(
|
let (favorites, running) = self.toplevel_list.iter().fold(
|
||||||
(Vec::new(), Vec::new()),
|
(Vec::new(), Vec::new()),
|
||||||
|(mut favorites, mut running),
|
|(mut favorites, mut running),
|
||||||
|
|
@ -457,9 +523,8 @@ impl Application for CosmicAppList {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO tooltip on hover
|
// TODO tooltip on hover
|
||||||
let icon_button = mouse_listener(
|
let icon_button =
|
||||||
icon_button.width(Length::Shrink).height(Length::Shrink),
|
mouse_listener(icon_button.width(Length::Shrink).height(Length::Shrink))
|
||||||
)
|
|
||||||
.on_right_release(Message::Popup(desktop_info.id.clone()));
|
.on_right_release(Message::Popup(desktop_info.id.clone()));
|
||||||
let icon_button = if let Some(tracker) = self.rectangle_tracker.as_ref() {
|
let icon_button = if let Some(tracker) = self.rectangle_tracker.as_ref() {
|
||||||
tracker.container(*id, icon_button).into()
|
tracker.container(*id, icon_button).into()
|
||||||
|
|
@ -511,82 +576,6 @@ impl Application for CosmicAppList {
|
||||||
content.into()
|
content.into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SurfaceIdWrapper::Popup(p) => {
|
|
||||||
if let Some(Toplevel {
|
|
||||||
toplevels,
|
|
||||||
desktop_info,
|
|
||||||
..
|
|
||||||
}) = self.toplevel_list.iter().find(|t| t.popup == Some(p))
|
|
||||||
{
|
|
||||||
let is_favorite = self.config.favorites.contains(&desktop_info.id)
|
|
||||||
|| self.config.favorites.contains(&desktop_info.name);
|
|
||||||
|
|
||||||
let mut content = column![
|
|
||||||
iced::widget::text(&desktop_info.name)
|
|
||||||
.horizontal_alignment(Horizontal::Center),
|
|
||||||
cosmic::widget::button(Button::Text)
|
|
||||||
.custom(vec![iced::widget::text(fl!("new-window")).into()])
|
|
||||||
.on_press(Message::Exec(desktop_info.exec.clone())),
|
|
||||||
]
|
|
||||||
.padding(8)
|
|
||||||
.spacing(4)
|
|
||||||
.align_items(Alignment::Center);
|
|
||||||
if !toplevels.is_empty() {
|
|
||||||
let mut list_col = column![];
|
|
||||||
for (handle, info) in toplevels {
|
|
||||||
let title = if info.title.len() > 20 {
|
|
||||||
format!("{:.24}...", &info.title)
|
|
||||||
} else {
|
|
||||||
info.title.clone()
|
|
||||||
};
|
|
||||||
list_col = list_col.push(
|
|
||||||
cosmic::widget::button(Button::Text)
|
|
||||||
.custom(vec![iced::widget::text(title).into()])
|
|
||||||
.on_press(Message::Activate(handle.clone())),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
content = content.push(divider::horizontal::light());
|
|
||||||
content = content.push(list_col);
|
|
||||||
content = content.push(divider::horizontal::light());
|
|
||||||
}
|
|
||||||
content = content.push(if is_favorite {
|
|
||||||
cosmic::widget::button(Button::Text)
|
|
||||||
.custom(vec![iced::widget::text(fl!("unfavorite")).into()])
|
|
||||||
.on_press(Message::UnFavorite(desktop_info.id.clone()))
|
|
||||||
} else {
|
|
||||||
cosmic::widget::button(Button::Text)
|
|
||||||
.custom(vec![iced::widget::text(fl!("favorite")).into()])
|
|
||||||
.on_press(Message::Favorite(desktop_info.id.clone()))
|
|
||||||
});
|
|
||||||
|
|
||||||
content = match toplevels.len() {
|
|
||||||
0 => content,
|
|
||||||
1 => content.push(
|
|
||||||
cosmic::widget::button(Button::Text)
|
|
||||||
.custom(vec![iced::widget::text(fl!("quit")).into()])
|
|
||||||
.on_press(Message::Quit(desktop_info.id.clone())),
|
|
||||||
),
|
|
||||||
_ => content.push(
|
|
||||||
cosmic::widget::button(Button::Text)
|
|
||||||
.custom(vec![iced::widget::text(&fl!("quit-all")).into()])
|
|
||||||
.on_press(Message::Quit(desktop_info.id.clone())),
|
|
||||||
),
|
|
||||||
};
|
|
||||||
// return Container::new(Container::new(content.width(Length::Shrink).height(Length::Shrink)).style(
|
|
||||||
// cosmic::Container::Custom(|theme| container::Appearance {
|
|
||||||
// text_color: Some(theme.cosmic().on_bg_color().into()),
|
|
||||||
// background: Some(theme.extended_palette().background.base.color.into()),
|
|
||||||
// border_radius: 12.0,
|
|
||||||
// border_width: 0.0,
|
|
||||||
// border_color: Color::TRANSPARENT,
|
|
||||||
// }),
|
|
||||||
// )).into();
|
|
||||||
return self.applet_helper.popup_container(content).into();
|
|
||||||
}
|
|
||||||
horizontal_space(Length::Units(1)).into()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn subscription(&self) -> Subscription<Message> {
|
fn subscription(&self) -> Subscription<Message> {
|
||||||
Subscription::batch(vec![
|
Subscription::batch(vec![
|
||||||
|
|
@ -614,7 +603,7 @@ impl Application for CosmicAppList {
|
||||||
self.theme
|
self.theme
|
||||||
}
|
}
|
||||||
|
|
||||||
fn close_requested(&self, _id: SurfaceIdWrapper) -> Self::Message {
|
fn close_requested(&self, _id: window::Id) -> Self::Message {
|
||||||
Message::Ignore
|
Message::Ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,5 @@ libpulse-binding = "2.26.0"
|
||||||
libpulse-glib-binding = "2.25.0"
|
libpulse-glib-binding = "2.25.0"
|
||||||
tokio = { version = "1.20.1", features=["full"] }
|
tokio = { version = "1.20.1", features=["full"] }
|
||||||
libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["tokio", "wayland", "applet"] }
|
libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["tokio", "wayland", "applet"] }
|
||||||
sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit", rev = "69bffe5" }
|
|
||||||
log = "0.4.14"
|
log = "0.4.14"
|
||||||
pretty_env_logger = "0.4.0"
|
pretty_env_logger = "0.4.0"
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
use cosmic::iced::wayland::SurfaceIdWrapper;
|
|
||||||
use cosmic::iced::widget;
|
use cosmic::iced::widget;
|
||||||
use cosmic::iced_native::alignment::Horizontal;
|
use cosmic::iced_native::alignment::Horizontal;
|
||||||
use cosmic::iced_native::layout::Limits;
|
use cosmic::iced_native::layout::Limits;
|
||||||
|
|
@ -97,7 +96,7 @@ impl Application for Audio {
|
||||||
self.theme
|
self.theme
|
||||||
}
|
}
|
||||||
|
|
||||||
fn close_requested(&self, _id: SurfaceIdWrapper) -> Self::Message {
|
fn close_requested(&self, _id: window::Id) -> Self::Message {
|
||||||
Message::Ignore
|
Message::Ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -268,15 +267,13 @@ impl Application for Audio {
|
||||||
pulse::connect().map(Message::Pulse)
|
pulse::connect().map(Message::Pulse)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn view(&self, id: SurfaceIdWrapper) -> Element<Message> {
|
fn view(&self, id: window::Id) -> Element<Message> {
|
||||||
match id {
|
if id == window::Id::new(0) {
|
||||||
SurfaceIdWrapper::LayerSurface(_) => unimplemented!(),
|
self.applet_helper
|
||||||
SurfaceIdWrapper::Window(_) => self
|
|
||||||
.applet_helper
|
|
||||||
.icon_button(&self.icon_name)
|
.icon_button(&self.icon_name)
|
||||||
.on_press(Message::TogglePopup)
|
.on_press(Message::TogglePopup)
|
||||||
.into(),
|
.into()
|
||||||
SurfaceIdWrapper::Popup(_) => {
|
} else {
|
||||||
let audio_disabled = matches!(self.pulse_state, PulseState::Disconnected(_));
|
let audio_disabled = matches!(self.pulse_state, PulseState::Disconnected(_));
|
||||||
let out_f64 = VolumeLinear::from(
|
let out_f64 = VolumeLinear::from(
|
||||||
self.current_output
|
self.current_output
|
||||||
|
|
@ -398,7 +395,6 @@ impl Application for Audio {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn revealer(
|
fn revealer(
|
||||||
open: bool,
|
open: bool,
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ edition = "2021"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
once_cell = "1.16.0"
|
once_cell = "1.16.0"
|
||||||
libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["tokio", "wayland", "applet"] }
|
libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["tokio", "wayland", "applet"] }
|
||||||
sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit", rev = "69bffe5" }
|
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
zbus = { version = "3.5", default-features = false, features = ["tokio"] }
|
zbus = { version = "3.5", default-features = false, features = ["tokio"] }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ use crate::upower_kbdbacklight::{
|
||||||
use cosmic::applet::{CosmicAppletHelper, APPLET_BUTTON_THEME};
|
use cosmic::applet::{CosmicAppletHelper, APPLET_BUTTON_THEME};
|
||||||
use cosmic::iced::alignment::Horizontal;
|
use cosmic::iced::alignment::Horizontal;
|
||||||
use cosmic::iced::wayland::popup::{destroy_popup, get_popup};
|
use cosmic::iced::wayland::popup::{destroy_popup, get_popup};
|
||||||
use cosmic::iced::wayland::SurfaceIdWrapper;
|
|
||||||
use cosmic::iced::{
|
use cosmic::iced::{
|
||||||
widget::{column, container, row, slider, text},
|
widget::{column, container, row, slider, text},
|
||||||
window, Alignment, Application, Command, Length, Subscription,
|
window, Alignment, Application, Command, Length, Subscription,
|
||||||
|
|
@ -213,15 +212,13 @@ impl Application for CosmicBatteryApplet {
|
||||||
}
|
}
|
||||||
Command::none()
|
Command::none()
|
||||||
}
|
}
|
||||||
fn view(&self, id: SurfaceIdWrapper) -> Element<Message> {
|
fn view(&self, id: window::Id) -> Element<Message> {
|
||||||
match id {
|
if id == window::Id::new(0) {
|
||||||
SurfaceIdWrapper::LayerSurface(_) => unimplemented!(),
|
self.applet_helper
|
||||||
SurfaceIdWrapper::Window(_) => self
|
|
||||||
.applet_helper
|
|
||||||
.icon_button(&self.icon_name)
|
.icon_button(&self.icon_name)
|
||||||
.on_press(Message::TogglePopup)
|
.on_press(Message::TogglePopup)
|
||||||
.into(),
|
.into()
|
||||||
SurfaceIdWrapper::Popup(_) => {
|
} else {
|
||||||
let name = text(fl!("battery")).size(18);
|
let name = text(fl!("battery")).size(18);
|
||||||
let description = text(
|
let description = text(
|
||||||
if "battery-full-charging-symbolic" == self.icon_name
|
if "battery-full-charging-symbolic" == self.icon_name
|
||||||
|
|
@ -358,9 +355,7 @@ impl Application for CosmicBatteryApplet {
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.padding([0, 12]),
|
.padding([0, 12]),
|
||||||
button(APPLET_BUTTON_THEME)
|
button(APPLET_BUTTON_THEME)
|
||||||
.custom(vec![text(fl!("power-settings"))
|
.custom(vec![text(fl!("power-settings")).width(Length::Fill).into()])
|
||||||
.width(Length::Fill)
|
|
||||||
.into()])
|
|
||||||
.on_press(Message::OpenBatterySettings)
|
.on_press(Message::OpenBatterySettings)
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.padding([8, 24])
|
.padding([8, 24])
|
||||||
|
|
@ -371,7 +366,6 @@ impl Application for CosmicBatteryApplet {
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn subscription(&self) -> Subscription<Message> {
|
fn subscription(&self) -> Subscription<Message> {
|
||||||
Subscription::batch(vec![
|
Subscription::batch(vec![
|
||||||
|
|
@ -406,7 +400,7 @@ impl Application for CosmicBatteryApplet {
|
||||||
self.theme
|
self.theme
|
||||||
}
|
}
|
||||||
|
|
||||||
fn close_requested(&self, _id: SurfaceIdWrapper) -> Self::Message {
|
fn close_requested(&self, _id: window::Id) -> Message {
|
||||||
Message::Ignore
|
Message::Ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ once_cell = "1.16.0"
|
||||||
bluer = { version = "0.15", features = ["bluetoothd", "id"] }
|
bluer = { version = "0.15", features = ["bluetoothd", "id"] }
|
||||||
futures-util = "0.3.21"
|
futures-util = "0.3.21"
|
||||||
libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["wayland", "applet", "tokio"] }
|
libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["wayland", "applet", "tokio"] }
|
||||||
sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit", rev = "69bffe5" }
|
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
pretty_env_logger = "0.4"
|
pretty_env_logger = "0.4"
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ use cosmic::{
|
||||||
iced::{
|
iced::{
|
||||||
wayland::{
|
wayland::{
|
||||||
popup::{destroy_popup, get_popup},
|
popup::{destroy_popup, get_popup},
|
||||||
SurfaceIdWrapper,
|
|
||||||
},
|
},
|
||||||
widget::{column, container, row, scrollable, text, Column},
|
widget::{column, container, row, scrollable, text, Column},
|
||||||
Alignment, Application, Color, Command, Length, Subscription,
|
Alignment, Application, Color, Command, Length, Subscription,
|
||||||
|
|
@ -275,7 +274,7 @@ impl Application for CosmicBluetoothApplet {
|
||||||
}
|
}
|
||||||
Command::none()
|
Command::none()
|
||||||
}
|
}
|
||||||
fn view(&self, id: SurfaceIdWrapper) -> Element<Message> {
|
fn view(&self, id: window::Id) -> Element<Message> {
|
||||||
let button_style = Button::Custom {
|
let button_style = Button::Custom {
|
||||||
active: |t| iced_style::button::Appearance {
|
active: |t| iced_style::button::Appearance {
|
||||||
border_radius: BorderRadius::from(0.0),
|
border_radius: BorderRadius::from(0.0),
|
||||||
|
|
@ -286,14 +285,12 @@ impl Application for CosmicBluetoothApplet {
|
||||||
..t.hovered(&Button::Text)
|
..t.hovered(&Button::Text)
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
match id {
|
if id == window::Id::new(0) {
|
||||||
SurfaceIdWrapper::LayerSurface(_) => unimplemented!(),
|
self.applet_helper
|
||||||
SurfaceIdWrapper::Window(_) => self
|
|
||||||
.applet_helper
|
|
||||||
.icon_button(&self.icon_name)
|
.icon_button(&self.icon_name)
|
||||||
.on_press(Message::TogglePopup)
|
.on_press(Message::TogglePopup)
|
||||||
.into(),
|
.into()
|
||||||
SurfaceIdWrapper::Popup(_) => {
|
} else {
|
||||||
let mut known_bluetooth = column![];
|
let mut known_bluetooth = column![];
|
||||||
for dev in self.bluer_state.devices.iter().filter(|d| {
|
for dev in self.bluer_state.devices.iter().filter(|d| {
|
||||||
!self
|
!self
|
||||||
|
|
@ -527,7 +524,6 @@ impl Application for CosmicBluetoothApplet {
|
||||||
self.applet_helper.popup_container(content).into()
|
self.applet_helper.popup_container(content).into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn subscription(&self) -> Subscription<Message> {
|
fn subscription(&self) -> Subscription<Message> {
|
||||||
bluetooth_subscription(0).map(|e| Message::BluetoothEvent(e.1))
|
bluetooth_subscription(0).map(|e| Message::BluetoothEvent(e.1))
|
||||||
|
|
@ -537,7 +533,7 @@ impl Application for CosmicBluetoothApplet {
|
||||||
self.theme
|
self.theme
|
||||||
}
|
}
|
||||||
|
|
||||||
fn close_requested(&self, _id: SurfaceIdWrapper) -> Self::Message {
|
fn close_requested(&self, _id: window::Id) -> Self::Message {
|
||||||
Message::Ignore
|
Message::Ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ edition = "2021"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
zbus = "3.4"
|
zbus = "3.4"
|
||||||
libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["tokio", "wayland", "applet"] }
|
libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["tokio", "wayland", "applet"] }
|
||||||
sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit", rev = "69bffe5" }
|
|
||||||
once_cell = "1"
|
once_cell = "1"
|
||||||
# Application i18n
|
# Application i18n
|
||||||
i18n-embed = { version = "0.13.4", features = ["fluent-system", "desktop-requester"] }
|
i18n-embed = { version = "0.13.4", features = ["fluent-system", "desktop-requester"] }
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ use crate::fl;
|
||||||
use crate::graphics::{get_current_graphics, set_graphics, Graphics};
|
use crate::graphics::{get_current_graphics, set_graphics, Graphics};
|
||||||
use cosmic::applet::CosmicAppletHelper;
|
use cosmic::applet::CosmicAppletHelper;
|
||||||
use cosmic::iced::wayland::popup::{destroy_popup, get_popup};
|
use cosmic::iced::wayland::popup::{destroy_popup, get_popup};
|
||||||
use cosmic::iced::wayland::SurfaceIdWrapper;
|
|
||||||
use cosmic::iced_native::alignment::Horizontal;
|
use cosmic::iced_native::alignment::Horizontal;
|
||||||
use cosmic::iced_native::Alignment;
|
use cosmic::iced_native::Alignment;
|
||||||
use cosmic::iced_style::application::{self, Appearance};
|
use cosmic::iced_style::application::{self, Appearance};
|
||||||
|
|
@ -121,7 +120,7 @@ impl Application for Window {
|
||||||
Message::CurrentGraphics(match cur_graphics {
|
Message::CurrentGraphics(match cur_graphics {
|
||||||
Ok(g) => Some(g),
|
Ok(g) => Some(g),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
dbg!(err);
|
eprintln!("{err}");
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -184,10 +183,9 @@ impl Application for Window {
|
||||||
Command::none()
|
Command::none()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn view(&self, id: SurfaceIdWrapper) -> Element<Message> {
|
fn view(&self, id: window::Id) -> Element<Message> {
|
||||||
match id {
|
if id == window::Id::new(0) {
|
||||||
SurfaceIdWrapper::LayerSurface(_) => unimplemented!(),
|
match self.applet_helper.anchor {
|
||||||
SurfaceIdWrapper::Window(_) => match self.applet_helper.anchor {
|
|
||||||
PanelAnchor::Left | PanelAnchor::Right => self
|
PanelAnchor::Left | PanelAnchor::Right => self
|
||||||
.applet_helper
|
.applet_helper
|
||||||
.icon_button("input-gaming-symbolic")
|
.icon_button("input-gaming-symbolic")
|
||||||
|
|
@ -219,8 +217,8 @@ impl Application for Window {
|
||||||
.width(Length::Shrink)
|
.width(Length::Shrink)
|
||||||
.height(Length::Shrink)
|
.height(Length::Shrink)
|
||||||
.into(),
|
.into(),
|
||||||
},
|
}
|
||||||
SurfaceIdWrapper::Popup(_) => {
|
} else {
|
||||||
let content_list = vec![
|
let content_list = vec![
|
||||||
button(APPLET_BUTTON_THEME)
|
button(APPLET_BUTTON_THEME)
|
||||||
.custom(vec![row![
|
.custom(vec![row![
|
||||||
|
|
@ -260,9 +258,7 @@ impl Application for Window {
|
||||||
.into(),
|
.into(),
|
||||||
button(APPLET_BUTTON_THEME)
|
button(APPLET_BUTTON_THEME)
|
||||||
.custom(vec![row![
|
.custom(vec![row![
|
||||||
column![
|
column![text(format!("{} {}", fl!("nvidia"), fl!("graphics"))).size(14),]
|
||||||
text(format!("{} {}", fl!("nvidia"), fl!("graphics"))).size(14),
|
|
||||||
]
|
|
||||||
.width(Length::Fill),
|
.width(Length::Fill),
|
||||||
icon(
|
icon(
|
||||||
match self.graphics_mode {
|
match self.graphics_mode {
|
||||||
|
|
@ -387,19 +383,19 @@ impl Application for Window {
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn close_requested(&self, id: SurfaceIdWrapper) -> Self::Message {
|
fn close_requested(&self, id: window::Id) -> Self::Message {
|
||||||
match id {
|
if id != window::Id::new(0) {
|
||||||
SurfaceIdWrapper::LayerSurface(_) | SurfaceIdWrapper::Window(_) => unimplemented!(),
|
Message::PopupClosed(id)
|
||||||
SurfaceIdWrapper::Popup(id) => Message::PopupClosed(id),
|
} else {
|
||||||
|
unimplemented!();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn style(&self) -> <Self::Theme as application::StyleSheet>::Style {
|
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(|theme| Appearance {
|
||||||
background_color: Color::from_rgba(0.0, 0.0, 0.0, 0.0),
|
background_color: Color::from_rgba(0.0, 0.0, 0.0, 0.0),
|
||||||
text_color: theme.cosmic().on_bg_color().into(),
|
text_color: theme.cosmic().background.on.into(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ cosmic-dbus-networkmanager = { git = "https://github.com/pop-os/dbus-settings-bi
|
||||||
# cosmic-dbus-networkmanager = { path = "../../../dbus-settings-bindings/networkmanager" }
|
# cosmic-dbus-networkmanager = { path = "../../../dbus-settings-bindings/networkmanager" }
|
||||||
futures-util = "0.3.21"
|
futures-util = "0.3.21"
|
||||||
libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["wayland", "applet", "tokio"] }
|
libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["wayland", "applet", "tokio"] }
|
||||||
sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit", rev = "69bffe5" }
|
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
zbus = { version = "3.7", default-features = false }
|
zbus = { version = "3.7", default-features = false }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,7 @@ use cosmic::iced_style;
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
applet::CosmicAppletHelper,
|
applet::CosmicAppletHelper,
|
||||||
iced::{
|
iced::{
|
||||||
wayland::{
|
wayland::popup::{destroy_popup, get_popup},
|
||||||
popup::{destroy_popup, get_popup},
|
|
||||||
SurfaceIdWrapper,
|
|
||||||
},
|
|
||||||
widget::{column, container, row, scrollable, text, text_input, Column},
|
widget::{column, container, row, scrollable, text, text_input, Column},
|
||||||
Alignment, Application, Color, Command, Length, Subscription,
|
Alignment, Application, Color, Command, Length, Subscription,
|
||||||
},
|
},
|
||||||
|
|
@ -34,7 +31,8 @@ use crate::{
|
||||||
|
|
||||||
pub fn run() -> cosmic::iced::Result {
|
pub fn run() -> cosmic::iced::Result {
|
||||||
let helper = CosmicAppletHelper::default();
|
let helper = CosmicAppletHelper::default();
|
||||||
CosmicNetworkApplet::run(helper.window_settings())
|
let settings = helper.window_settings();
|
||||||
|
CosmicNetworkApplet::run(settings)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
@ -338,7 +336,7 @@ impl Application for CosmicNetworkApplet {
|
||||||
}
|
}
|
||||||
Command::none()
|
Command::none()
|
||||||
}
|
}
|
||||||
fn view(&self, id: SurfaceIdWrapper) -> Element<Message> {
|
fn view(&self, id: window::Id) -> Element<Message> {
|
||||||
let button_style = Button::Custom {
|
let button_style = Button::Custom {
|
||||||
active: |t| iced_style::button::Appearance {
|
active: |t| iced_style::button::Appearance {
|
||||||
border_radius: BorderRadius::from(0.0),
|
border_radius: BorderRadius::from(0.0),
|
||||||
|
|
@ -349,14 +347,12 @@ impl Application for CosmicNetworkApplet {
|
||||||
..t.hovered(&Button::Text)
|
..t.hovered(&Button::Text)
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
match id {
|
if id == window::Id::new(0) {
|
||||||
SurfaceIdWrapper::LayerSurface(_) => unimplemented!(),
|
self.applet_helper
|
||||||
SurfaceIdWrapper::Window(_) => self
|
|
||||||
.applet_helper
|
|
||||||
.icon_button(&self.icon_name)
|
.icon_button(&self.icon_name)
|
||||||
.on_press(Message::TogglePopup)
|
.on_press(Message::TogglePopup)
|
||||||
.into(),
|
.into()
|
||||||
SurfaceIdWrapper::Popup(_) => {
|
} else {
|
||||||
let mut vpn_ethernet_col = column![];
|
let mut vpn_ethernet_col = column![];
|
||||||
let mut known_wifi = column![];
|
let mut known_wifi = column![];
|
||||||
for conn in &self.nm_state.active_conns {
|
for conn in &self.nm_state.active_conns {
|
||||||
|
|
@ -487,9 +483,7 @@ impl Application for CosmicNetworkApplet {
|
||||||
| DeviceState::NeedAuth => {
|
| DeviceState::NeedAuth => {
|
||||||
btn.on_press(Message::ActivateKnownWifi(known.ssid.clone()))
|
btn.on_press(Message::ActivateKnownWifi(known.ssid.clone()))
|
||||||
}
|
}
|
||||||
DeviceState::Activated => {
|
DeviceState::Activated => btn.on_press(Message::Disconnect(known.ssid.clone())),
|
||||||
btn.on_press(Message::Disconnect(known.ssid.clone()))
|
|
||||||
}
|
|
||||||
_ => btn,
|
_ => btn,
|
||||||
};
|
};
|
||||||
known_wifi = known_wifi.push(row![btn].align_items(Alignment::Center));
|
known_wifi = known_wifi.push(row![btn].align_items(Alignment::Center));
|
||||||
|
|
@ -693,7 +687,6 @@ impl Application for CosmicNetworkApplet {
|
||||||
self.applet_helper.popup_container(content).into()
|
self.applet_helper.popup_container(content).into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn subscription(&self) -> Subscription<Message> {
|
fn subscription(&self) -> Subscription<Message> {
|
||||||
network_manager_subscription(0).map(|(_, event)| Message::NetworkManagerEvent(event))
|
network_manager_subscription(0).map(|(_, event)| Message::NetworkManagerEvent(event))
|
||||||
|
|
@ -703,7 +696,7 @@ impl Application for CosmicNetworkApplet {
|
||||||
self.theme
|
self.theme
|
||||||
}
|
}
|
||||||
|
|
||||||
fn close_requested(&self, _id: SurfaceIdWrapper) -> Self::Message {
|
fn close_requested(&self, _id: window::Id) -> Self::Message {
|
||||||
Message::Ignore
|
Message::Ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
use cosmic::applet::{CosmicAppletHelper, APPLET_BUTTON_THEME};
|
use cosmic::applet::{CosmicAppletHelper, APPLET_BUTTON_THEME};
|
||||||
use cosmic::iced::wayland::{
|
use cosmic::iced::wayland::{
|
||||||
popup::{destroy_popup, get_popup},
|
popup::{destroy_popup, get_popup},
|
||||||
SurfaceIdWrapper,
|
|
||||||
};
|
};
|
||||||
use cosmic::iced::{
|
use cosmic::iced::{
|
||||||
widget::{button, column, row, text, Row, Space},
|
widget::{button, column, row, text, Row, Space},
|
||||||
|
|
@ -65,7 +64,7 @@ impl Application for Notifications {
|
||||||
self.theme
|
self.theme
|
||||||
}
|
}
|
||||||
|
|
||||||
fn close_requested(&self, _id: SurfaceIdWrapper) -> Self::Message {
|
fn close_requested(&self, _id: window::Id) -> Self::Message {
|
||||||
Message::Ignore
|
Message::Ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -112,15 +111,13 @@ impl Application for Notifications {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn view(&self, id: SurfaceIdWrapper) -> Element<Message> {
|
fn view(&self, id: window::Id) -> Element<Message> {
|
||||||
match id {
|
if id == window::Id::new(0) {
|
||||||
SurfaceIdWrapper::LayerSurface(_) => unimplemented!(),
|
self.applet_helper
|
||||||
SurfaceIdWrapper::Window(_) => self
|
|
||||||
.applet_helper
|
|
||||||
.icon_button(&self.icon_name)
|
.icon_button(&self.icon_name)
|
||||||
.on_press(Message::TogglePopup)
|
.on_press(Message::TogglePopup)
|
||||||
.into(),
|
.into()
|
||||||
SurfaceIdWrapper::Popup(_) => {
|
} else {
|
||||||
let do_not_disturb =
|
let do_not_disturb =
|
||||||
row![
|
row![
|
||||||
toggler(String::from("Do Not Disturb"), self.do_not_disturb, |b| {
|
toggler(String::from("Do Not Disturb"), self.do_not_disturb, |b| {
|
||||||
|
|
@ -165,7 +162,6 @@ impl Application for Notifications {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// todo put into libcosmic doing so will fix the row_button's boarder radius
|
// todo put into libcosmic doing so will fix the row_button's boarder radius
|
||||||
fn row_button(
|
fn row_button(
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ libpulse-binding = "2.26.0"
|
||||||
libpulse-glib-binding = "2.25.0"
|
libpulse-glib-binding = "2.25.0"
|
||||||
tokio = { version = "1.20.1", features=["full"] }
|
tokio = { version = "1.20.1", features=["full"] }
|
||||||
libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["tokio", "wayland", "applet"] }
|
libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["tokio", "wayland", "applet"] }
|
||||||
sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit", rev = "69bffe5" }
|
|
||||||
nix = "0.26.1"
|
nix = "0.26.1"
|
||||||
zbus = "3.7"
|
zbus = "3.7"
|
||||||
logind-zbus = "3.1"
|
logind-zbus = "3.1"
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ use std::process;
|
||||||
|
|
||||||
use cosmic::applet::{CosmicAppletHelper, APPLET_BUTTON_THEME};
|
use cosmic::applet::{CosmicAppletHelper, APPLET_BUTTON_THEME};
|
||||||
use cosmic::iced::wayland::popup::{destroy_popup, get_popup};
|
use cosmic::iced::wayland::popup::{destroy_popup, get_popup};
|
||||||
use cosmic::iced::wayland::SurfaceIdWrapper;
|
|
||||||
use cosmic::iced_native::layout::Limits;
|
use cosmic::iced_native::layout::Limits;
|
||||||
use cosmic::iced_native::widget::Space;
|
use cosmic::iced_native::widget::Space;
|
||||||
use cosmic::widget::{button, divider, icon};
|
use cosmic::widget::{button, divider, icon};
|
||||||
|
|
@ -80,7 +79,7 @@ impl Application for Power {
|
||||||
self.theme
|
self.theme
|
||||||
}
|
}
|
||||||
|
|
||||||
fn close_requested(&self, _id: SurfaceIdWrapper) -> Self::Message {
|
fn close_requested(&self, _id: window::Id) -> Self::Message {
|
||||||
Message::Ignore
|
Message::Ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -139,15 +138,13 @@ impl Application for Power {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn view(&self, id: SurfaceIdWrapper) -> Element<Message> {
|
fn view(&self, id: window::Id) -> Element<Message> {
|
||||||
match id {
|
if id == window::Id::new(0) {
|
||||||
SurfaceIdWrapper::LayerSurface(_) => unimplemented!(),
|
self.applet_helper
|
||||||
SurfaceIdWrapper::Window(_) => self
|
|
||||||
.applet_helper
|
|
||||||
.icon_button(&self.icon_name)
|
.icon_button(&self.icon_name)
|
||||||
.on_press(Message::TogglePopup)
|
.on_press(Message::TogglePopup)
|
||||||
.into(),
|
.into()
|
||||||
SurfaceIdWrapper::Popup(_) => {
|
} else {
|
||||||
let settings = row_button(vec!["Settings...".into()]).on_press(Message::Settings);
|
let settings = row_button(vec!["Settings...".into()]).on_press(Message::Settings);
|
||||||
|
|
||||||
let session = column![
|
let session = column![
|
||||||
|
|
@ -168,11 +165,9 @@ impl Application for Power {
|
||||||
];
|
];
|
||||||
|
|
||||||
let power = row![
|
let power = row![
|
||||||
power_buttons("system-lock-screen-symbolic", "Suspend")
|
power_buttons("system-lock-screen-symbolic", "Suspend").on_press(Message::Suspend),
|
||||||
.on_press(Message::Suspend),
|
|
||||||
power_buttons("system-restart-symbolic", "Restart").on_press(Message::Restart),
|
power_buttons("system-restart-symbolic", "Restart").on_press(Message::Restart),
|
||||||
power_buttons("system-shutdown-symbolic", "Shutdown")
|
power_buttons("system-shutdown-symbolic", "Shutdown").on_press(Message::Shutdown),
|
||||||
.on_press(Message::Shutdown),
|
|
||||||
]
|
]
|
||||||
.spacing(24)
|
.spacing(24)
|
||||||
.padding([0, 24]);
|
.padding([0, 24]);
|
||||||
|
|
@ -196,7 +191,6 @@ impl Application for Power {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// ### UI Helplers
|
// ### UI Helplers
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,5 @@
|
||||||
use cosmic::applet::{cosmic_panel_config::PanelAnchor, CosmicAppletHelper};
|
use cosmic::applet::{cosmic_panel_config::PanelAnchor, CosmicAppletHelper};
|
||||||
use cosmic::iced::wayland::{
|
use cosmic::iced::wayland::popup::{destroy_popup, get_popup};
|
||||||
popup::{destroy_popup, get_popup},
|
|
||||||
SurfaceIdWrapper,
|
|
||||||
};
|
|
||||||
use cosmic::iced::{
|
use cosmic::iced::{
|
||||||
time,
|
time,
|
||||||
wayland::InitialSurface,
|
wayland::InitialSurface,
|
||||||
|
|
@ -28,9 +25,7 @@ pub fn main() -> cosmic::iced::Result {
|
||||||
s.iced_settings.min_size = Some((1, 1));
|
s.iced_settings.min_size = Some((1, 1));
|
||||||
s.iced_settings.max_size = None;
|
s.iced_settings.max_size = None;
|
||||||
s.autosize = true;
|
s.autosize = true;
|
||||||
s.size_limits = Limits::NONE
|
s.size_limits = Limits::NONE.min_height(1).min_width(1);
|
||||||
.min_height(1)
|
|
||||||
.min_width(1);
|
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
};
|
};
|
||||||
|
|
@ -98,7 +93,7 @@ impl Application for Time {
|
||||||
self.theme
|
self.theme
|
||||||
}
|
}
|
||||||
|
|
||||||
fn close_requested(&self, _id: SurfaceIdWrapper) -> Self::Message {
|
fn close_requested(&self, _id: window::Id) -> Self::Message {
|
||||||
Message::Ignore
|
Message::Ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -198,10 +193,8 @@ impl Application for Time {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn view(&self, id: SurfaceIdWrapper) -> Element<Message> {
|
fn view(&self, id: window::Id) -> Element<Message> {
|
||||||
match id {
|
if id == window::Id::new(0) {
|
||||||
SurfaceIdWrapper::LayerSurface(_) => unimplemented!(),
|
|
||||||
SurfaceIdWrapper::Window(_) => {
|
|
||||||
let button = button(
|
let button = button(
|
||||||
if matches!(
|
if matches!(
|
||||||
self.applet_helper.anchor,
|
self.applet_helper.anchor,
|
||||||
|
|
@ -242,8 +235,7 @@ impl Application for Time {
|
||||||
} else {
|
} else {
|
||||||
button.into()
|
button.into()
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
SurfaceIdWrapper::Popup(_) => {
|
|
||||||
let content = column![]
|
let content = column![]
|
||||||
.align_items(Alignment::Start)
|
.align_items(Alignment::Start)
|
||||||
.spacing(12)
|
.spacing(12)
|
||||||
|
|
@ -255,4 +247,3 @@ impl Application for Time {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ use cosmic::applet::CosmicAppletHelper;
|
||||||
use cosmic::iced::alignment::{Horizontal, Vertical};
|
use cosmic::iced::alignment::{Horizontal, Vertical};
|
||||||
use cosmic::iced::mouse::{self, ScrollDelta};
|
use cosmic::iced::mouse::{self, ScrollDelta};
|
||||||
use cosmic::iced::wayland::actions::window::SctkWindowSettings;
|
use cosmic::iced::wayland::actions::window::SctkWindowSettings;
|
||||||
use cosmic::iced::wayland::{window::resize_window, InitialSurface, SurfaceIdWrapper};
|
use cosmic::iced::wayland::{window::resize_window, InitialSurface};
|
||||||
use cosmic::iced::widget::{column, container, row, text};
|
use cosmic::iced::widget::{column, container, row, text};
|
||||||
use cosmic::iced::{
|
use cosmic::iced::{
|
||||||
subscription, widget::button, window, Application, Command, Event::Mouse, Length, Settings,
|
subscription, widget::button, window, Application, Command, Event::Mouse, Length, Settings,
|
||||||
|
|
@ -131,7 +131,7 @@ impl Application for IcedWorkspacesApplet {
|
||||||
Command::none()
|
Command::none()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn view(&self, _id: SurfaceIdWrapper) -> Element<Message> {
|
fn view(&self, _id: window::Id) -> Element<Message> {
|
||||||
if self.workspaces.is_empty() {
|
if self.workspaces.is_empty() {
|
||||||
return row![].padding(8).into();
|
return row![].padding(8).into();
|
||||||
}
|
}
|
||||||
|
|
@ -200,7 +200,7 @@ impl Application for IcedWorkspacesApplet {
|
||||||
self.theme
|
self.theme
|
||||||
}
|
}
|
||||||
|
|
||||||
fn close_requested(&self, _id: SurfaceIdWrapper) -> Self::Message {
|
fn close_requested(&self, _id: window::Id) -> Self::Message {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ pub fn spawn_workspaces(tx: mpsc::Sender<WorkspaceList>) -> SyncSender<Workspace
|
||||||
.workspace_groups()
|
.workspace_groups()
|
||||||
.iter()
|
.iter()
|
||||||
.find_map(|g| {
|
.find_map(|g| {
|
||||||
if g.output != state.expected_output {
|
if !g.outputs.iter().any(|o| Some(o) == state.expected_output.as_ref()) {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
g.workspaces
|
g.workspaces
|
||||||
|
|
@ -179,7 +179,7 @@ impl State {
|
||||||
.workspace_groups()
|
.workspace_groups()
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|g| {
|
.filter_map(|g| {
|
||||||
if g.output == self.expected_output {
|
if g.outputs.iter().any(|o| Some(o) == self.expected_output.as_ref()) {
|
||||||
Some(g.workspaces.iter().map(|w| {
|
Some(g.workspaces.iter().map(|w| {
|
||||||
(
|
(
|
||||||
w.name.clone(),
|
w.name.clone(),
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,12 @@ use cosmic::{
|
||||||
applet::CosmicAppletHelper,
|
applet::CosmicAppletHelper,
|
||||||
iced::{
|
iced::{
|
||||||
self,
|
self,
|
||||||
wayland::{InitialSurface, SurfaceIdWrapper},
|
wayland::InitialSurface,
|
||||||
Application,
|
Application,
|
||||||
},
|
},
|
||||||
iced_sctk::layout::Limits,
|
iced_sctk::layout::Limits,
|
||||||
iced_style::application,
|
iced_style::application,
|
||||||
|
iced_native::window,
|
||||||
};
|
};
|
||||||
use freedesktop_desktop_entry::DesktopEntry;
|
use freedesktop_desktop_entry::DesktopEntry;
|
||||||
use std::{env, fs, process::Command};
|
use std::{env, fs, process::Command};
|
||||||
|
|
@ -41,7 +42,7 @@ impl iced::Application for Button {
|
||||||
String::from("Button")
|
String::from("Button")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn close_requested(&self, _id: SurfaceIdWrapper) -> Msg {
|
fn close_requested(&self, _id: window::Id) -> Msg {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -65,7 +66,7 @@ impl iced::Application for Button {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn view(&self, _id: SurfaceIdWrapper) -> cosmic::Element<Msg> {
|
fn view(&self, _id: window::Id) -> cosmic::Element<Msg> {
|
||||||
// TODO icon?
|
// TODO icon?
|
||||||
cosmic::widget::button(cosmic::theme::Button::Text)
|
cosmic::widget::button(cosmic::theme::Button::Text)
|
||||||
.text(&self.desktop.name)
|
.text(&self.desktop.name)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue