Skip to content

Commit 903a558

Browse files
committed
update libcosmic
1 parent 2c74a55 commit 903a558

File tree

19 files changed

+2233
-1849
lines changed

19 files changed

+2233
-1849
lines changed

Cargo.lock

Lines changed: 943 additions & 499 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cosmic-app-list/src/app.rs

Lines changed: 186 additions & 197 deletions
Large diffs are not rendered by default.

cosmic-applet-audio/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@ libpulse-binding = "2.26.0"
1111
libpulse-glib-binding = "2.25.0"
1212
tokio = { version = "1.20.1", features=["full"] }
1313
libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["tokio", "wayland", "applet"] }
14-
sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit", rev = "69bffe5" }
1514
log = "0.4.14"
16-
pretty_env_logger = "0.4.0"
15+
pretty_env_logger = "0.4.0"

cosmic-applet-audio/src/main.rs

Lines changed: 118 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use cosmic::iced::wayland::SurfaceIdWrapper;
21
use cosmic::iced::widget;
32
use cosmic::iced_native::alignment::Horizontal;
43
use cosmic::iced_native::layout::Limits;
@@ -97,7 +96,7 @@ impl Application for Audio {
9796
self.theme
9897
}
9998

100-
fn close_requested(&self, _id: SurfaceIdWrapper) -> Self::Message {
99+
fn close_requested(&self, _id: window::Id) -> Self::Message {
101100
Message::Ignore
102101
}
103102

@@ -268,134 +267,131 @@ impl Application for Audio {
268267
pulse::connect().map(Message::Pulse)
269268
}
270269

271-
fn view(&self, id: SurfaceIdWrapper) -> Element<Message> {
272-
match id {
273-
SurfaceIdWrapper::LayerSurface(_) => unimplemented!(),
274-
SurfaceIdWrapper::Window(_) => self
275-
.applet_helper
270+
fn view(&self, id: window::Id) -> Element<Message> {
271+
if id == window::Id::new(0) {
272+
self.applet_helper
276273
.icon_button(&self.icon_name)
277274
.on_press(Message::TogglePopup)
278-
.into(),
279-
SurfaceIdWrapper::Popup(_) => {
280-
let audio_disabled = matches!(self.pulse_state, PulseState::Disconnected(_));
281-
let out_f64 = VolumeLinear::from(
282-
self.current_output
283-
.as_ref()
284-
.map(|o| o.volume.avg())
285-
.unwrap_or_default(),
286-
)
287-
.0 * 100.0;
288-
let in_f64 = VolumeLinear::from(
289-
self.current_input
290-
.as_ref()
291-
.map(|o| o.volume.avg())
292-
.unwrap_or_default(),
293-
)
294-
.0 * 100.0;
295-
296-
let audio_content = if audio_disabled {
297-
column![text("PulseAudio Disconnected")
298-
.width(Length::Fill)
299-
.horizontal_alignment(Horizontal::Center)
300-
.size(24),]
301-
} else {
302-
column![
303-
row![
304-
icon("audio-volume-high-symbolic", 32)
305-
.width(Length::Units(24))
306-
.height(Length::Units(24))
307-
.style(Svg::Symbolic),
308-
slider(0.0..=100.0, out_f64, Message::SetOutputVolume)
309-
.width(Length::FillPortion(5)),
310-
text(format!("{}%", out_f64.round()))
311-
.width(Length::FillPortion(1))
312-
.horizontal_alignment(Horizontal::Right)
313-
]
314-
.spacing(12)
315-
.align_items(Alignment::Center)
316-
.padding([8, 24]),
317-
row![
318-
icon("audio-input-microphone-symbolic", 32)
319-
.width(Length::Units(24))
320-
.height(Length::Units(24))
321-
.style(Svg::Symbolic),
322-
slider(0.0..=100.0, in_f64, Message::SetInputVolume)
323-
.width(Length::FillPortion(5)),
324-
text(format!("{}%", in_f64.round()))
325-
.width(Length::FillPortion(1))
326-
.horizontal_alignment(Horizontal::Right)
327-
]
328-
.spacing(12)
329-
.align_items(Alignment::Center)
330-
.padding([8, 24]),
331-
container(divider::horizontal::light())
332-
.padding([12, 24])
333-
.width(Length::Fill),
334-
revealer(
335-
self.is_open == IsOpen::Output,
336-
"Output",
337-
match &self.current_output {
338-
Some(output) => pretty_name(output.description.clone()),
339-
None => String::from("No device selected"),
340-
},
341-
self.outputs
342-
.clone()
343-
.into_iter()
344-
.map(|output| (
345-
output.name.clone().unwrap_or_default(),
346-
pretty_name(output.description)
347-
))
348-
.collect(),
349-
Message::OutputToggle,
350-
Message::OutputChanged,
351-
),
352-
revealer(
353-
self.is_open == IsOpen::Input,
354-
"Input",
355-
match &self.current_input {
356-
Some(input) => pretty_name(input.description.clone()),
357-
None => String::from("No device selected"),
358-
},
359-
self.inputs
360-
.clone()
361-
.into_iter()
362-
.map(|input| (
363-
input.name.clone().unwrap_or_default(),
364-
pretty_name(input.description)
365-
))
366-
.collect(),
367-
Message::InputToggle,
368-
Message::InputChanged,
369-
)
275+
.into()
276+
} else {
277+
let audio_disabled = matches!(self.pulse_state, PulseState::Disconnected(_));
278+
let out_f64 = VolumeLinear::from(
279+
self.current_output
280+
.as_ref()
281+
.map(|o| o.volume.avg())
282+
.unwrap_or_default(),
283+
)
284+
.0 * 100.0;
285+
let in_f64 = VolumeLinear::from(
286+
self.current_input
287+
.as_ref()
288+
.map(|o| o.volume.avg())
289+
.unwrap_or_default(),
290+
)
291+
.0 * 100.0;
292+
293+
let audio_content = if audio_disabled {
294+
column![text("PulseAudio Disconnected")
295+
.width(Length::Fill)
296+
.horizontal_alignment(Horizontal::Center)
297+
.size(24),]
298+
} else {
299+
column![
300+
row![
301+
icon("audio-volume-high-symbolic", 32)
302+
.width(Length::Units(24))
303+
.height(Length::Units(24))
304+
.style(Svg::Symbolic),
305+
slider(0.0..=100.0, out_f64, Message::SetOutputVolume)
306+
.width(Length::FillPortion(5)),
307+
text(format!("{}%", out_f64.round()))
308+
.width(Length::FillPortion(1))
309+
.horizontal_alignment(Horizontal::Right)
370310
]
371-
.align_items(Alignment::Start)
372-
};
373-
let content = column![
374-
audio_content,
375-
container(divider::horizontal::light())
376-
.padding([12, 24])
377-
.width(Length::Fill),
378-
container(toggler(
379-
Some("Show Media Controls on Top Panel".into()),
380-
self.show_media_controls_in_top_panel,
381-
Message::ToggleMediaControlsInTopPanel,
382-
))
383-
.padding([0, 24]),
311+
.spacing(12)
312+
.align_items(Alignment::Center)
313+
.padding([8, 24]),
314+
row![
315+
icon("audio-input-microphone-symbolic", 32)
316+
.width(Length::Units(24))
317+
.height(Length::Units(24))
318+
.style(Svg::Symbolic),
319+
slider(0.0..=100.0, in_f64, Message::SetInputVolume)
320+
.width(Length::FillPortion(5)),
321+
text(format!("{}%", in_f64.round()))
322+
.width(Length::FillPortion(1))
323+
.horizontal_alignment(Horizontal::Right)
324+
]
325+
.spacing(12)
326+
.align_items(Alignment::Center)
327+
.padding([8, 24]),
384328
container(divider::horizontal::light())
385329
.padding([12, 24])
386330
.width(Length::Fill),
387-
button(APPLET_BUTTON_THEME)
388-
.text("Sound Settings...")
389-
.padding([8, 24])
390-
.width(Length::Fill)
331+
revealer(
332+
self.is_open == IsOpen::Output,
333+
"Output",
334+
match &self.current_output {
335+
Some(output) => pretty_name(output.description.clone()),
336+
None => String::from("No device selected"),
337+
},
338+
self.outputs
339+
.clone()
340+
.into_iter()
341+
.map(|output| (
342+
output.name.clone().unwrap_or_default(),
343+
pretty_name(output.description)
344+
))
345+
.collect(),
346+
Message::OutputToggle,
347+
Message::OutputChanged,
348+
),
349+
revealer(
350+
self.is_open == IsOpen::Input,
351+
"Input",
352+
match &self.current_input {
353+
Some(input) => pretty_name(input.description.clone()),
354+
None => String::from("No device selected"),
355+
},
356+
self.inputs
357+
.clone()
358+
.into_iter()
359+
.map(|input| (
360+
input.name.clone().unwrap_or_default(),
361+
pretty_name(input.description)
362+
))
363+
.collect(),
364+
Message::InputToggle,
365+
Message::InputChanged,
366+
)
391367
]
392368
.align_items(Alignment::Start)
393-
.padding([8, 0]);
394-
395-
self.applet_helper
396-
.popup_container(container(content))
397-
.into()
398-
}
369+
};
370+
let content = column![
371+
audio_content,
372+
container(divider::horizontal::light())
373+
.padding([12, 24])
374+
.width(Length::Fill),
375+
container(toggler(
376+
Some("Show Media Controls on Top Panel".into()),
377+
self.show_media_controls_in_top_panel,
378+
Message::ToggleMediaControlsInTopPanel,
379+
))
380+
.padding([0, 24]),
381+
container(divider::horizontal::light())
382+
.padding([12, 24])
383+
.width(Length::Fill),
384+
button(APPLET_BUTTON_THEME)
385+
.text("Sound Settings...")
386+
.padding([8, 24])
387+
.width(Length::Fill)
388+
]
389+
.align_items(Alignment::Start)
390+
.padding([8, 0]);
391+
392+
self.applet_helper
393+
.popup_container(container(content))
394+
.into()
399395
}
400396
}
401397
}

cosmic-applet-battery/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ edition = "2021"
66
[dependencies]
77
once_cell = "1.16.0"
88
libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["tokio", "wayland", "applet"] }
9-
sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit", rev = "69bffe5" }
109
futures = "0.3"
1110
zbus = { version = "3.5", default-features = false, features = ["tokio"] }
1211
log = "0.4"

0 commit comments

Comments
 (0)