Compare commits
No commits in common. "fb33b39cecf719e32926947ca46c2f7fe1351285" and "a9f15d67a23a43f5fe389dc50cec1b7c0e1a9c12" have entirely different histories.
fb33b39cec
...
a9f15d67a2
7 changed files with 945 additions and 947 deletions
465
Cargo.lock
generated
465
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -118,10 +118,13 @@ 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-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-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-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" }
|
cosmic-settings-upower-subscription = { path = "/home/lionel/Projets/COSMIC/cosmic-settings/subscriptions/upower" }
|
||||||
|
|
||||||
[patch."https://github.com/pop-os/cosmic-settings/"]
|
[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-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"]
|
[patch."https://github.com/pop-os/cosmic-text.git"]
|
||||||
cosmic-text = { path = "../cosmic-text" }
|
cosmic-text = { path = "../cosmic-text" }
|
||||||
|
|
|
||||||
|
|
@ -111,21 +111,6 @@ impl Audio {
|
||||||
"microphone-sensitivity-high-symbolic"
|
"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)]
|
#[derive(Debug, PartialEq, Eq, Default)]
|
||||||
|
|
@ -271,13 +256,13 @@ impl cosmic::Application for Audio {
|
||||||
const APP_ID: &'static str = "com.system76.CosmicAppletAudio";
|
const APP_ID: &'static str = "com.system76.CosmicAppletAudio";
|
||||||
|
|
||||||
fn init(core: cosmic::app::Core, _flags: ()) -> (Self, app::Task<Message>) {
|
fn init(core: cosmic::app::Core, _flags: ()) -> (Self, app::Task<Message>) {
|
||||||
let mut app = Self {
|
(
|
||||||
core,
|
Self {
|
||||||
..Default::default()
|
core,
|
||||||
};
|
..Default::default()
|
||||||
app.refresh_volume_limits();
|
},
|
||||||
|
Task::none(),
|
||||||
(app, Task::none())
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn core(&self) -> &cosmic::app::Core {
|
fn core(&self) -> &cosmic::app::Core {
|
||||||
|
|
@ -310,7 +295,17 @@ impl cosmic::Application for Audio {
|
||||||
let new_id = window::Id::unique();
|
let new_id = window::Id::unique();
|
||||||
self.popup.replace(new_id);
|
self.popup.replace(new_id);
|
||||||
|
|
||||||
self.refresh_volume_limits();
|
(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, &[][..])
|
||||||
|
};
|
||||||
|
|
||||||
let mut popup_settings = self.core.applet.get_popup_settings(
|
let mut popup_settings = self.core.applet.get_popup_settings(
|
||||||
self.core.main_window_id().unwrap(),
|
self.core.main_window_id().unwrap(),
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,9 @@ edition = "2024"
|
||||||
license = "GPL-3.0-or-later"
|
license = "GPL-3.0-or-later"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
anyhow.workspace = true
|
||||||
async-fn-stream = "0.3"
|
async-fn-stream = "0.3"
|
||||||
|
cosmic-dbus-networkmanager = { path = "../../dbus-settings-bindings/networkmanager" }
|
||||||
futures.workspace = true
|
futures.workspace = true
|
||||||
futures-util.workspace = true
|
futures-util.workspace = true
|
||||||
i18n-embed-fl.workspace = true
|
i18n-embed-fl.workspace = true
|
||||||
|
|
@ -23,7 +25,13 @@ tokio.workspace = true
|
||||||
tracing-log.workspace = true
|
tracing-log.workspace = true
|
||||||
tracing-subscriber.workspace = true
|
tracing-subscriber.workspace = true
|
||||||
tracing.workspace = true
|
tracing.workspace = true
|
||||||
|
zbus.workspace = true
|
||||||
indexmap = "2.13.0"
|
indexmap = "2.13.0"
|
||||||
secure-string = "0.3.0"
|
secure-string = "0.3.0"
|
||||||
uuid = { version = "1.21.0", features = ["v4"] }
|
uuid = { version = "1.21.0", features = ["v4"] }
|
||||||
nmrs = "3.4.0"
|
nmrs = "3.1.3"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[dependencies.cosmic-settings-network-manager-subscription]
|
||||||
|
path = "../../cosmic-settings/subscriptions/network-manager"
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -3,6 +3,7 @@
|
||||||
mod app;
|
mod app;
|
||||||
mod config;
|
mod config;
|
||||||
mod localize;
|
mod localize;
|
||||||
|
mod utils;
|
||||||
|
|
||||||
use crate::localize::localize;
|
use crate::localize::localize;
|
||||||
|
|
||||||
|
|
|
||||||
18
cosmic-applet-network/src/utils.rs
Normal file
18
cosmic-applet-network/src/utils.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
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