Compare commits
2 commits
a9f15d67a2
...
fb33b39cec
| Author | SHA1 | Date | |
|---|---|---|---|
| fb33b39cec | |||
| 5b838a6795 |
7 changed files with 946 additions and 944 deletions
465
Cargo.lock
generated
465
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -118,13 +118,10 @@ cosmic-settings-a11y-manager-subscription = { path = "/home/lionel/Projets/COSMI
|
|||
cosmic-settings-accessibility-subscription = { path = "/home/lionel/Projets/COSMIC/cosmic-settings/subscriptions/accessibility" }
|
||||
cosmic-settings-airplane-mode-subscription = { path = "/home/lionel/Projets/COSMIC/cosmic-settings/subscriptions/airplane-mode" }
|
||||
cosmic-settings-daemon-subscription = { path = "/home/lionel/Projets/COSMIC/cosmic-settings/subscriptions/settings-daemon" }
|
||||
cosmic-settings-network-manager-subscription = { path = "/home/lionel/Projets/COSMIC/cosmic-settings/subscriptions/network-manager" }
|
||||
cosmic-settings-sound-subscription = { path = "/home/lionel/Projets/COSMIC/cosmic-settings/subscriptions/sound" }
|
||||
cosmic-settings-upower-subscription = { path = "/home/lionel/Projets/COSMIC/cosmic-settings/subscriptions/upower" }
|
||||
|
||||
[patch."https://github.com/pop-os/cosmic-settings/"]
|
||||
cosmic-settings-airplane-mode-subscription = { path = "/home/lionel/Projets/COSMIC/cosmic-settings/subscriptions/airplane-mode" }
|
||||
cosmic-settings-network-manager-subscription = { path = "/home/lionel/Projets/COSMIC/cosmic-settings/subscriptions/network-manager" }
|
||||
|
||||
[patch."https://github.com/pop-os/cosmic-text.git"]
|
||||
cosmic-text = { path = "../cosmic-text" }
|
||||
|
|
|
|||
|
|
@ -111,6 +111,21 @@ impl Audio {
|
|||
"microphone-sensitivity-high-symbolic"
|
||||
}
|
||||
}
|
||||
|
||||
/// Refresh the volume ceilings and slider breakpoints from the
|
||||
/// amplification config.
|
||||
///
|
||||
/// Must run at startup, not only when the popup opens: the
|
||||
/// scroll-to-adjust handler clamps against `max_sink_volume`, which
|
||||
/// `Default` leaves at 0. Until the popup had been opened once, every
|
||||
/// wheel event therefore resolved to `SetSinkVolume(0)`.
|
||||
fn refresh_volume_limits(&mut self) {
|
||||
(self.max_sink_volume, self.sink_breakpoints) =
|
||||
if amplification_sink() { (150, &[100][..]) } else { (100, &[][..]) };
|
||||
|
||||
(self.max_source_volume, self.source_breakpoints) =
|
||||
if amplification_source() { (150, &[100][..]) } else { (100, &[][..]) };
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Default)]
|
||||
|
|
@ -256,13 +271,13 @@ impl cosmic::Application for Audio {
|
|||
const APP_ID: &'static str = "com.system76.CosmicAppletAudio";
|
||||
|
||||
fn init(core: cosmic::app::Core, _flags: ()) -> (Self, app::Task<Message>) {
|
||||
(
|
||||
Self {
|
||||
core,
|
||||
..Default::default()
|
||||
},
|
||||
Task::none(),
|
||||
)
|
||||
let mut app = Self {
|
||||
core,
|
||||
..Default::default()
|
||||
};
|
||||
app.refresh_volume_limits();
|
||||
|
||||
(app, Task::none())
|
||||
}
|
||||
|
||||
fn core(&self) -> &cosmic::app::Core {
|
||||
|
|
@ -295,17 +310,7 @@ impl cosmic::Application for Audio {
|
|||
let new_id = window::Id::unique();
|
||||
self.popup.replace(new_id);
|
||||
|
||||
(self.max_sink_volume, self.sink_breakpoints) = if amplification_sink() {
|
||||
(150, &[100][..])
|
||||
} else {
|
||||
(100, &[][..])
|
||||
};
|
||||
|
||||
(self.max_source_volume, self.source_breakpoints) = if amplification_source() {
|
||||
(150, &[100][..])
|
||||
} else {
|
||||
(100, &[][..])
|
||||
};
|
||||
self.refresh_volume_limits();
|
||||
|
||||
let mut popup_settings = self.core.applet.get_popup_settings(
|
||||
self.core.main_window_id().unwrap(),
|
||||
|
|
|
|||
|
|
@ -5,9 +5,7 @@ edition = "2024"
|
|||
license = "GPL-3.0-or-later"
|
||||
|
||||
[dependencies]
|
||||
anyhow.workspace = true
|
||||
async-fn-stream = "0.3"
|
||||
cosmic-dbus-networkmanager = { path = "../../dbus-settings-bindings/networkmanager" }
|
||||
futures.workspace = true
|
||||
futures-util.workspace = true
|
||||
i18n-embed-fl.workspace = true
|
||||
|
|
@ -25,13 +23,7 @@ tokio.workspace = true
|
|||
tracing-log.workspace = true
|
||||
tracing-subscriber.workspace = true
|
||||
tracing.workspace = true
|
||||
zbus.workspace = true
|
||||
indexmap = "2.13.0"
|
||||
secure-string = "0.3.0"
|
||||
uuid = { version = "1.21.0", features = ["v4"] }
|
||||
nmrs = "3.1.3"
|
||||
|
||||
|
||||
|
||||
[dependencies.cosmic-settings-network-manager-subscription]
|
||||
path = "../../cosmic-settings/subscriptions/network-manager"
|
||||
nmrs = "3.4.0"
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -3,7 +3,6 @@
|
|||
mod app;
|
||||
mod config;
|
||||
mod localize;
|
||||
mod utils;
|
||||
|
||||
use crate::localize::localize;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
use futures_util::future::select;
|
||||
|
||||
/// Spawn a background tasks and forward its messages
|
||||
pub fn forward_event_loop<M: 'static + Send, T: Future<Output = ()> + Send + 'static>(
|
||||
event_loop: impl FnOnce(async_fn_stream::StreamEmitter<M>) -> T + Send + 'static,
|
||||
) -> (tokio::sync::oneshot::Sender<()>, cosmic::Task<M>) {
|
||||
let (cancel_tx, cancel_rx) = tokio::sync::oneshot::channel::<()>();
|
||||
|
||||
let task = cosmic::Task::stream(async_fn_stream::fn_stream(|emitter| async move {
|
||||
select(
|
||||
std::pin::pin!(cancel_rx),
|
||||
std::pin::pin!(event_loop(emitter)),
|
||||
)
|
||||
.await;
|
||||
}));
|
||||
|
||||
(cancel_tx, task)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue