Merge pull request #55 from pop-os/cleanup_jammy
Fix some warnings and clippy lints
This commit is contained in:
commit
b5371f58f7
14 changed files with 133 additions and 111 deletions
5
Cargo.lock
generated
5
Cargo.lock
generated
|
|
@ -602,7 +602,7 @@ dependencies = [
|
|||
"libpulse-binding",
|
||||
"libpulse-glib-binding",
|
||||
"logind-zbus",
|
||||
"nix 0.24.3",
|
||||
"nix 0.26.1",
|
||||
"smithay-client-toolkit",
|
||||
"tokio",
|
||||
"zbus",
|
||||
|
|
@ -3968,6 +3968,7 @@ dependencies = [
|
|||
"signal-hook-registry",
|
||||
"socket2",
|
||||
"tokio-macros",
|
||||
"tracing",
|
||||
"windows-sys 0.42.0",
|
||||
]
|
||||
|
||||
|
|
@ -4803,6 +4804,7 @@ dependencies = [
|
|||
"futures-sink",
|
||||
"futures-util",
|
||||
"hex",
|
||||
"lazy_static",
|
||||
"nix 0.25.1",
|
||||
"once_cell",
|
||||
"ordered-stream",
|
||||
|
|
@ -4811,6 +4813,7 @@ dependencies = [
|
|||
"serde_repr",
|
||||
"sha1",
|
||||
"static_assertions",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"uds_windows",
|
||||
"winapi",
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ impl Application for CosmicAppList {
|
|||
let new_id = window::Id::new(self.surface_id_ctr);
|
||||
self.popup.replace(new_id);
|
||||
toplevel_group.popup.replace(new_id);
|
||||
|
||||
|
||||
let mut popup_settings = self.applet_helper.get_popup_settings(
|
||||
window::Id::new(0),
|
||||
new_id,
|
||||
|
|
@ -271,11 +271,11 @@ impl Application for CosmicAppList {
|
|||
Message::Toplevel(event) => {
|
||||
match event {
|
||||
ToplevelUpdate::AddToplevel(handle, info) => {
|
||||
if info.app_id == "" {
|
||||
if info.app_id.is_empty() {
|
||||
return Command::none();
|
||||
}
|
||||
if let Some(i) = self.toplevel_list.iter().position(
|
||||
|Toplevel { desktop_info, .. }| &desktop_info.id == &info.app_id,
|
||||
|Toplevel { desktop_info, .. }| desktop_info.id == info.app_id,
|
||||
) {
|
||||
self.toplevel_list[i].toplevels.push((handle, info));
|
||||
} else {
|
||||
|
|
@ -309,7 +309,7 @@ impl Application for CosmicAppList {
|
|||
desktop_info,
|
||||
..
|
||||
}| {
|
||||
if let Some(ret) = toplevels.iter().position(|t| &t.0 == &handle) {
|
||||
if let Some(ret) = toplevels.iter().position(|t| t.0 == handle) {
|
||||
toplevels.remove(ret);
|
||||
toplevels.is_empty()
|
||||
&& !self.config.favorites.contains(&desktop_info.id)
|
||||
|
|
@ -326,7 +326,7 @@ impl Application for CosmicAppList {
|
|||
}
|
||||
ToplevelUpdate::UpdateToplevel(handle, info) => {
|
||||
// TODO probably want to make sure it is removed
|
||||
if info.app_id == "" {
|
||||
if info.app_id.is_empty() {
|
||||
return Command::none();
|
||||
}
|
||||
'toplevel_loop: for toplevel_list in &mut self.toplevel_list {
|
||||
|
|
@ -351,12 +351,12 @@ impl Application for CosmicAppList {
|
|||
Message::Exec(exec_str) => {
|
||||
let mut exec = shlex::Shlex::new(&exec_str);
|
||||
let mut cmd = match exec.next() {
|
||||
Some(cmd) if !cmd.contains("=") => tokio::process::Command::new(cmd),
|
||||
Some(cmd) if !cmd.contains('=') => tokio::process::Command::new(cmd),
|
||||
_ => return Command::none(),
|
||||
};
|
||||
for arg in exec {
|
||||
// TODO handle "%" args here if necessary?
|
||||
if !arg.starts_with("%") {
|
||||
if !arg.starts_with('%') {
|
||||
cmd.arg(arg);
|
||||
}
|
||||
}
|
||||
|
|
@ -398,7 +398,10 @@ impl Application for CosmicAppList {
|
|||
desktop_info,
|
||||
..
|
||||
}| {
|
||||
let cosmic_icon = cosmic::widget::icon(Path::new(&desktop_info.icon), self.applet_helper.suggested_size().0);
|
||||
let cosmic_icon = cosmic::widget::icon(
|
||||
Path::new(&desktop_info.icon),
|
||||
self.applet_helper.suggested_size().0,
|
||||
);
|
||||
// let icon = if desktop_info.icon.extension() == Some(&OsStr::new("svg")) {
|
||||
// svg::Handle::from_path(&desktop_info.icon);
|
||||
// svg::Svg::new(handle)
|
||||
|
|
@ -433,22 +436,30 @@ impl Application for CosmicAppList {
|
|||
.collect_vec();
|
||||
dots.push(vertical_space(Length::Units(4)).into());
|
||||
let icon_wrapper = match &self.applet_helper.anchor {
|
||||
PanelAnchor::Left => row(vec![column(dots).spacing(4).into(), cosmic_icon.into()])
|
||||
.align_items(iced::Alignment::Center)
|
||||
.spacing(4)
|
||||
.into(),
|
||||
PanelAnchor::Right => row(vec![cosmic_icon.into(), column(dots).spacing(4).into()])
|
||||
.align_items(iced::Alignment::Center)
|
||||
.spacing(4)
|
||||
.into(),
|
||||
PanelAnchor::Top => column(vec![row(dots).spacing(4).into(), cosmic_icon.into()])
|
||||
.align_items(iced::Alignment::Center)
|
||||
.spacing(4)
|
||||
.into(),
|
||||
PanelAnchor::Bottom => column(vec![cosmic_icon.into(), row(dots).spacing(4).into()])
|
||||
.align_items(iced::Alignment::Center)
|
||||
.spacing(4)
|
||||
.into(),
|
||||
PanelAnchor::Left => {
|
||||
row(vec![column(dots).spacing(4).into(), cosmic_icon.into()])
|
||||
.align_items(iced::Alignment::Center)
|
||||
.spacing(4)
|
||||
.into()
|
||||
}
|
||||
PanelAnchor::Right => {
|
||||
row(vec![cosmic_icon.into(), column(dots).spacing(4).into()])
|
||||
.align_items(iced::Alignment::Center)
|
||||
.spacing(4)
|
||||
.into()
|
||||
}
|
||||
PanelAnchor::Top => {
|
||||
column(vec![row(dots).spacing(4).into(), cosmic_icon.into()])
|
||||
.align_items(iced::Alignment::Center)
|
||||
.spacing(4)
|
||||
.into()
|
||||
}
|
||||
PanelAnchor::Bottom => {
|
||||
column(vec![cosmic_icon.into(), row(dots).spacing(4).into()])
|
||||
.align_items(iced::Alignment::Center)
|
||||
.spacing(4)
|
||||
.into()
|
||||
}
|
||||
};
|
||||
let mut icon_button = cosmic::widget::button(Button::Text)
|
||||
.custom(vec![icon_wrapper])
|
||||
|
|
@ -463,8 +474,10 @@ impl Application for CosmicAppList {
|
|||
}
|
||||
|
||||
// TODO tooltip on hover
|
||||
let icon_button = mouse_listener(icon_button.width(Length::Shrink).height(Length::Shrink))
|
||||
.on_right_release(Message::Popup(desktop_info.id.clone()));
|
||||
let icon_button = mouse_listener(
|
||||
icon_button.width(Length::Shrink).height(Length::Shrink),
|
||||
)
|
||||
.on_right_release(Message::Popup(desktop_info.id.clone()));
|
||||
let icon_button = if let Some(tracker) = self.rectangle_tracker.as_ref() {
|
||||
tracker.container(*id, icon_button).into()
|
||||
} else {
|
||||
|
|
@ -495,7 +508,9 @@ impl Application for CosmicAppList {
|
|||
.align_items(Alignment::Center)
|
||||
.height(Length::Fill)
|
||||
.width(Length::Fill),
|
||||
).height(Length::Fill).width(Length::Fill),
|
||||
)
|
||||
.height(Length::Fill)
|
||||
.width(Length::Fill),
|
||||
};
|
||||
if self.popup.is_some() {
|
||||
mouse_listener(content)
|
||||
|
|
@ -554,19 +569,19 @@ impl Application for CosmicAppList {
|
|||
.on_press(Message::Favorite(desktop_info.id.clone()))
|
||||
});
|
||||
|
||||
if toplevels.len() == 1 {
|
||||
content = content.push(
|
||||
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())),
|
||||
)
|
||||
} else if toplevels.len() > 1 {
|
||||
content = content.push(
|
||||
),
|
||||
_ => 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()),
|
||||
|
|
@ -578,7 +593,7 @@ impl Application for CosmicAppList {
|
|||
// )).into();
|
||||
return self.applet_helper.popup_container(content).into();
|
||||
}
|
||||
return horizontal_space(Length::Units(1)).into();
|
||||
horizontal_space(Length::Units(1)).into()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,10 +38,10 @@ async fn start_listening<I: Copy>(id: I, state: State) -> (Option<(I, ToplevelUp
|
|||
std::thread::spawn(move || {
|
||||
toplevel_handler(toplevel_tx, calloop_rx);
|
||||
});
|
||||
return (
|
||||
(
|
||||
Some((id, ToplevelUpdate::Init(calloop_tx.clone()))),
|
||||
State::Waiting(toplevel_rx, calloop_tx),
|
||||
);
|
||||
)
|
||||
}
|
||||
State::Waiting(mut rx, tx) => match rx.next().await {
|
||||
Some(u) => (Some((id, u)), State::Waiting(rx, tx)),
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ use iced::Color;
|
|||
|
||||
mod pulse;
|
||||
use crate::pulse::DeviceInfo;
|
||||
use libpulse_binding::volume::{Volume, VolumeLinear};
|
||||
use libpulse_binding::volume::VolumeLinear;
|
||||
|
||||
pub fn main() -> cosmic::iced::Result {
|
||||
let helper = CosmicAppletHelper::default();
|
||||
|
|
@ -134,7 +134,7 @@ impl Application for Audio {
|
|||
if let Some(device) = &self.current_output {
|
||||
if let Some(name) = &device.name {
|
||||
connection.send(pulse::Message::SetSinkVolumeByName(
|
||||
name.clone().to_string(),
|
||||
name.clone(),
|
||||
device.volume,
|
||||
))
|
||||
}
|
||||
|
|
@ -151,7 +151,7 @@ impl Application for Audio {
|
|||
if let Some(name) = &device.name {
|
||||
println!("increasing volume of {}", name);
|
||||
connection.send(pulse::Message::SetSourceVolumeByName(
|
||||
name.clone().to_string(),
|
||||
name.clone(),
|
||||
device.volume,
|
||||
))
|
||||
}
|
||||
|
|
@ -241,28 +241,40 @@ impl Application for Audio {
|
|||
self.current_output
|
||||
.as_ref()
|
||||
.map(|o| o.volume.avg())
|
||||
.unwrap_or(Volume::default()),
|
||||
.unwrap_or_default(),
|
||||
)
|
||||
.0 * 100.0;
|
||||
let in_f64 = VolumeLinear::from(
|
||||
self.current_input
|
||||
.as_ref()
|
||||
.map(|o| o.volume.avg())
|
||||
.unwrap_or(Volume::default()),
|
||||
.unwrap_or_default(),
|
||||
)
|
||||
.0 * 100.0;
|
||||
|
||||
let sink = row![
|
||||
icon("audio-volume-high-symbolic", 64).width(Length::Units(24)).height(Length::Units(24)).style(Svg::SymbolicActive),
|
||||
slider(0.0..=100.0, out_f64, Message::SetOutputVolume).width(Length::FillPortion(5)),
|
||||
text(format!("{}%", out_f64.round())).width(Length::FillPortion(1)).horizontal_alignment(Horizontal::Right)
|
||||
icon("audio-volume-high-symbolic", 64)
|
||||
.width(Length::Units(24))
|
||||
.height(Length::Units(24))
|
||||
.style(Svg::SymbolicActive),
|
||||
slider(0.0..=100.0, out_f64, Message::SetOutputVolume)
|
||||
.width(Length::FillPortion(5)),
|
||||
text(format!("{}%", out_f64.round()))
|
||||
.width(Length::FillPortion(1))
|
||||
.horizontal_alignment(Horizontal::Right)
|
||||
]
|
||||
.spacing(10)
|
||||
.align_items(Alignment::Center);
|
||||
let source = row![
|
||||
icon("audio-input-microphone-symbolic", 64).width(Length::Units(24)).height(Length::Units(24)).style(Svg::SymbolicActive),
|
||||
slider(0.0..=100.0, in_f64, Message::SetInputVolume).width(Length::FillPortion(5)),
|
||||
text(format!("{}%", in_f64.round())).width(Length::FillPortion(1)).horizontal_alignment(Horizontal::Right)
|
||||
icon("audio-input-microphone-symbolic", 64)
|
||||
.width(Length::Units(24))
|
||||
.height(Length::Units(24))
|
||||
.style(Svg::SymbolicActive),
|
||||
slider(0.0..=100.0, in_f64, Message::SetInputVolume)
|
||||
.width(Length::FillPortion(5)),
|
||||
text(format!("{}%", in_f64.round()))
|
||||
.width(Length::FillPortion(1))
|
||||
.horizontal_alignment(Horizontal::Right)
|
||||
]
|
||||
.spacing(10)
|
||||
.align_items(Alignment::Center);
|
||||
|
|
@ -322,14 +334,14 @@ fn spacer() -> iced::widget::Space {
|
|||
Space::with_width(Length::Fill)
|
||||
}
|
||||
|
||||
fn revealer<'a>(
|
||||
fn revealer(
|
||||
open: bool,
|
||||
title: &'a str,
|
||||
title: &str,
|
||||
selected: String,
|
||||
options: Vec<String>,
|
||||
toggle: Message,
|
||||
_change: Message,
|
||||
) -> widget::Column<'a, Message, Renderer> {
|
||||
) -> widget::Column<Message, Renderer> {
|
||||
if open {
|
||||
options.iter().fold(
|
||||
column![revealer_head(open, title, selected, toggle)].width(Length::Fill),
|
||||
|
|
@ -340,9 +352,9 @@ fn revealer<'a>(
|
|||
}
|
||||
}
|
||||
|
||||
fn revealer_head<'a>(
|
||||
fn revealer_head(
|
||||
_open: bool,
|
||||
title: &'a str,
|
||||
title: &str,
|
||||
selected: String,
|
||||
toggle: Message,
|
||||
) -> widget::Button<Message, Renderer> {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ use libpulse_binding::{
|
|||
callbacks::ListResult,
|
||||
context::{
|
||||
introspect::{Introspector, SinkInfo, SourceInfo},
|
||||
subscribe::{Facility, InterestMaskSet, Operation},
|
||||
Context,
|
||||
},
|
||||
error::PAErr,
|
||||
|
|
@ -80,8 +79,7 @@ pub struct Connection(tokio::sync::mpsc::Sender<Message>);
|
|||
|
||||
impl Connection {
|
||||
pub fn send(&mut self, message: Message) {
|
||||
let _ = self
|
||||
.0
|
||||
self.0
|
||||
.try_send(message)
|
||||
.expect("Send message to PulseAudio server");
|
||||
}
|
||||
|
|
@ -198,7 +196,7 @@ impl PulseHandle {
|
|||
}
|
||||
|
||||
fn blocking_send_disconnected(sender: &mut tokio::sync::mpsc::Sender<Message>) {
|
||||
sender.blocking_send(Message::Disconnected);
|
||||
sender.blocking_send(Message::Disconnected).unwrap()
|
||||
}
|
||||
|
||||
fn blocking_send_connected(sender: &mut tokio::sync::mpsc::Sender<Message>) {
|
||||
|
|
@ -209,6 +207,7 @@ impl PulseHandle {
|
|||
sender.send(Message::Disconnected).await.unwrap()
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
async fn send_connected(sender: &mut tokio::sync::mpsc::Sender<Message>) {
|
||||
sender.send(Message::Connected).await.unwrap()
|
||||
}
|
||||
|
|
@ -258,7 +257,7 @@ impl PulseServer {
|
|||
context
|
||||
.borrow_mut()
|
||||
.connect(None, pulse::context::FlagSet::NOFLAGS, None)
|
||||
.map_err(|e| PulseServerError::PAErr(e))?;
|
||||
.map_err(PulseServerError::PAErr)?;
|
||||
|
||||
Ok(PulseServer {
|
||||
mainloop,
|
||||
|
|
@ -308,13 +307,11 @@ impl PulseServer {
|
|||
}
|
||||
},
|
||||
);
|
||||
self.wait_for_result(operation)
|
||||
.and_then(|_| {
|
||||
list.borrow_mut().take().ok_or(PulseServerError::Misc(
|
||||
"get_sinks(): failed to wait for operation",
|
||||
))
|
||||
})
|
||||
.and_then(|result| Ok(result))
|
||||
self.wait_for_result(operation).and_then(|_| {
|
||||
list.borrow_mut().take().ok_or(PulseServerError::Misc(
|
||||
"get_sinks(): failed to wait for operation",
|
||||
))
|
||||
})
|
||||
}
|
||||
|
||||
// Get a list of input devices
|
||||
|
|
@ -329,13 +326,11 @@ impl PulseServer {
|
|||
}
|
||||
},
|
||||
);
|
||||
self.wait_for_result(operation)
|
||||
.and_then(|_| {
|
||||
list.borrow_mut().take().ok_or(PulseServerError::Misc(
|
||||
"get_sources(): Failed to wait for operation",
|
||||
))
|
||||
})
|
||||
.and_then(|result| Ok(result))
|
||||
self.wait_for_result(operation).and_then(|_| {
|
||||
list.borrow_mut().take().ok_or(PulseServerError::Misc(
|
||||
"get_sources(): Failed to wait for operation",
|
||||
))
|
||||
})
|
||||
}
|
||||
|
||||
pub fn get_server_info(&mut self) -> Result<ServerInfo, PulseServerError> {
|
||||
|
|
@ -355,7 +350,7 @@ impl PulseServer {
|
|||
let server_info = self.get_server_info();
|
||||
match server_info {
|
||||
Ok(info) => {
|
||||
let name = &info.default_sink_name.unwrap_or(String::new());
|
||||
let name = &info.default_sink_name.unwrap_or_default();
|
||||
let device = Rc::new(RefCell::new(Some(None)));
|
||||
let dev_ref = device.clone();
|
||||
let op = self.introspector.get_sink_info_by_name(
|
||||
|
|
@ -368,7 +363,7 @@ impl PulseServer {
|
|||
);
|
||||
self.wait_for_result(op)?;
|
||||
let mut result = device.borrow_mut();
|
||||
result.take().unwrap().ok_or_else(|| {
|
||||
result.take().unwrap().ok_or({
|
||||
PulseServerError::Misc("get_default_sink(): Error getting requested device")
|
||||
})
|
||||
}
|
||||
|
|
@ -380,7 +375,7 @@ impl PulseServer {
|
|||
let server_info = self.get_server_info();
|
||||
match server_info {
|
||||
Ok(info) => {
|
||||
let name = &info.default_source_name.unwrap_or(String::new());
|
||||
let name = &info.default_source_name.unwrap_or_default();
|
||||
let device = Rc::new(RefCell::new(Some(None)));
|
||||
let dev_ref = device.clone();
|
||||
let op = self.introspector.get_source_info_by_name(
|
||||
|
|
@ -393,7 +388,7 @@ impl PulseServer {
|
|||
);
|
||||
self.wait_for_result(op)?;
|
||||
let mut result = device.borrow_mut();
|
||||
result.take().unwrap().ok_or_else(|| {
|
||||
result.take().unwrap().ok_or({
|
||||
PulseServerError::Misc("get_default_source(): Error getting requested device")
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ once_cell = "1.16.0"
|
|||
libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["wayland", "applet"] }
|
||||
sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit", rev = "3776d4a" }
|
||||
futures = "0.3"
|
||||
zbus = { version = "3.5", no-default-features = true }
|
||||
zbus = { version = "3.5", default-features = false, features = ["tokio"] }
|
||||
log = "0.4"
|
||||
pretty_env_logger = "0.4"
|
||||
# Application i18n
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ impl Application for CosmicBatteryApplet {
|
|||
}
|
||||
}
|
||||
Message::SetScreenBrightness(brightness) => {
|
||||
self.screen_brightness = (brightness as f64 / 100.0).max(0.01).min(1.0);
|
||||
self.screen_brightness = (brightness as f64 / 100.0).clamp(0.01, 1.0);
|
||||
if let Some(tx) = &self.screen_sender {
|
||||
let _ = tx.send(ScreenBacklightRequest::Set(self.screen_brightness));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,10 +114,10 @@ async fn start_listening<I: Copy>(
|
|||
let b = (backlight.brightness().await.unwrap_or_default() as f64
|
||||
/ backlight.max_brightness().await.unwrap_or(1) as f64)
|
||||
.clamp(0., 1.);
|
||||
return (
|
||||
(
|
||||
Some((id, ScreenBacklightUpdate::Init(tx, b))),
|
||||
State::Waiting(backlight, screen_proxy, rx),
|
||||
);
|
||||
)
|
||||
}
|
||||
State::Waiting(backlight, proxy, mut rx) => match rx.recv().await {
|
||||
Some(req) => match req {
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ async fn start_listening<I: Copy>(id: I, state: State) -> (Option<(I, DeviceDbus
|
|||
State::Waiting(device),
|
||||
);
|
||||
}
|
||||
return (None, State::Finished);
|
||||
(None, State::Finished)
|
||||
}
|
||||
State::Waiting(device) => {
|
||||
let mut stream = futures::stream_select!(
|
||||
|
|
|
|||
|
|
@ -66,10 +66,10 @@ async fn start_listening<I: Copy>(
|
|||
|
||||
let b = kbd_proxy.get_brightness().await.unwrap_or_default() as f64
|
||||
/ kbd_proxy.get_max_brightness().await.unwrap_or(1) as f64;
|
||||
return (
|
||||
(
|
||||
Some((id, KeyboardBacklightUpdate::Init(tx, b))),
|
||||
State::Waiting(kbd_proxy, rx),
|
||||
);
|
||||
)
|
||||
}
|
||||
State::Waiting(proxy, mut rx) => match rx.recv().await {
|
||||
Some(req) => match req {
|
||||
|
|
|
|||
|
|
@ -79,13 +79,13 @@ impl Application for Window {
|
|||
let mut window = Window::default();
|
||||
let pixels = std::env::var("COSMIC_PANEL_SIZE")
|
||||
.ok()
|
||||
.and_then(|size| match size.parse::<PanelSize>() {
|
||||
Ok(PanelSize::XL) => Some(64),
|
||||
Ok(PanelSize::L) => Some(36),
|
||||
Ok(PanelSize::M) => Some(24),
|
||||
Ok(PanelSize::S) => Some(16),
|
||||
Ok(PanelSize::XS) => Some(12),
|
||||
Err(_) => Some(12),
|
||||
.map(|size| match size.parse::<PanelSize>() {
|
||||
Ok(PanelSize::XL) => 64,
|
||||
Ok(PanelSize::L) => 36,
|
||||
Ok(PanelSize::M) => 24,
|
||||
Ok(PanelSize::S) => 16,
|
||||
Ok(PanelSize::XS) => 12,
|
||||
Err(_) => 12,
|
||||
})
|
||||
.unwrap_or(16);
|
||||
window.icon_size = pixels;
|
||||
|
|
@ -96,10 +96,7 @@ impl Application for Window {
|
|||
Err(_) => PanelAnchor::Top,
|
||||
})
|
||||
.unwrap_or(PanelAnchor::Top);
|
||||
(
|
||||
window,
|
||||
Command::perform(dbus::init(), |dbus_init| Message::DBusInit(dbus_init)),
|
||||
)
|
||||
(window, Command::perform(dbus::init(), Message::DBusInit))
|
||||
}
|
||||
|
||||
fn title(&self) -> String {
|
||||
|
|
@ -202,28 +199,28 @@ impl Application for Window {
|
|||
"Integrated Graphics",
|
||||
Graphics::Integrated,
|
||||
self.graphics_mode.map(|g| g.inner()),
|
||||
|g| Message::SelectGraphicsMode(g),
|
||||
Message::SelectGraphicsMode,
|
||||
)
|
||||
.into(),
|
||||
radio(
|
||||
"Nvidia Graphics",
|
||||
Graphics::Nvidia,
|
||||
self.graphics_mode.map(|g| g.inner()),
|
||||
|g| Message::SelectGraphicsMode(g),
|
||||
Message::SelectGraphicsMode,
|
||||
)
|
||||
.into(),
|
||||
radio(
|
||||
"Hybrid Graphics",
|
||||
Graphics::Hybrid,
|
||||
self.graphics_mode.map(|g| g.inner()),
|
||||
|g| Message::SelectGraphicsMode(g),
|
||||
Message::SelectGraphicsMode,
|
||||
)
|
||||
.into(),
|
||||
radio(
|
||||
"Compute Graphics",
|
||||
Graphics::Compute,
|
||||
self.graphics_mode.map(|g| g.inner()),
|
||||
|g| Message::SelectGraphicsMode(g),
|
||||
Message::SelectGraphicsMode,
|
||||
)
|
||||
.into(),
|
||||
];
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ libpulse-glib-binding = "2.25.0"
|
|||
tokio = { version = "1.20.1", features=["full"] }
|
||||
libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["wayland", "applet"] }
|
||||
sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit", rev = "3776d4a" }
|
||||
nix = "0.24.1"
|
||||
nix = "0.26.1"
|
||||
|
||||
# Until the 3.6.3 release, need the implementation of clone on zbus::Error
|
||||
[dependencies.zbus]
|
||||
|
|
|
|||
|
|
@ -23,14 +23,16 @@ use crate::wayland::{WorkspaceEvent, WorkspaceList};
|
|||
use crate::wayland_subscription::{workspaces, WorkspacesUpdate};
|
||||
|
||||
pub fn run() -> cosmic::iced::Result {
|
||||
let mut settings = Settings::default();
|
||||
settings.initial_surface = InitialSurface::XdgWindow(SctkWindowSettings {
|
||||
iced_settings: cosmic::iced_native::window::Settings {
|
||||
size: (32, 32),
|
||||
let settings = Settings {
|
||||
initial_surface: InitialSurface::XdgWindow(SctkWindowSettings {
|
||||
iced_settings: cosmic::iced_native::window::Settings {
|
||||
size: (32, 32),
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
},
|
||||
}),
|
||||
..Default::default()
|
||||
});
|
||||
};
|
||||
IcedWorkspacesApplet::run(settings)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -117,12 +117,10 @@ pub fn spawn_workspaces(tx: mpsc::Sender<WorkspaceList>) -> SyncSender<Workspace
|
|||
} else {
|
||||
w_i.wrapping_add(1)
|
||||
}
|
||||
} else if w_i == 0 {
|
||||
max_w
|
||||
} else {
|
||||
if w_i == 0 {
|
||||
max_w
|
||||
} else {
|
||||
w_i.wrapping_sub(1)
|
||||
}
|
||||
w_i.wrapping_sub(1)
|
||||
};
|
||||
if let Some(w) = w_g.workspaces.get(d_i) {
|
||||
w.handle.activate();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue