Compare commits

...

2 commits

Author SHA1 Message Date
fb33b39cec fix(network): align applet with cosmic-settings 1.3 nmrs backend
Some checks failed
Continuous Integration / formatting (push) Has been cancelled
Continuous Integration / linting (push) Has been cancelled
cosmic-settings 1.3 replaced its custom NetworkManager backend with nmrs
and removed subscriptions/network-manager, which cosmic-applet-network
still referenced by path. That broke manifest resolution for the whole
workspace, so no applet package could be built at all.

Take upstream's post-migration cosmic-applet-network wholesale (upstream
e318f0d4 "migrate NetworkManager flow to nmrs 3.4" plus the nine network
fixes that followed it). None of our local commits touched this crate's
sources, only its manifest, so the only local adjustments to reapply are
the libcosmic -> cosmic workspace alias and the 1.3.0 version.

This also drops the cosmic-dbus-networkmanager dependency, and with it
the last user of the now-dead cosmic-settings-network-manager and
cosmic-settings-sound patch entries, which are removed from the
workspace manifest.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-31 09:47:24 +02:00
5b838a6795 fix(audio): initialize volume ceilings at startup
max_sink_volume and max_source_volume were only computed in the
TogglePopup handler, so they kept their Default value of 0 until the
popup had been opened once. The scroll-to-adjust handler clamps against
max_sink_volume, which meant every wheel event resolved to
SetSinkVolume(0) until the user had clicked the applet icon: scrolling
up did nothing and scrolling down muted the sink.

Extract refresh_volume_limits() and call it from init() as well as from
TogglePopup, so the popup still picks up amplification config changes
made during the session.

This is the actual cause of "scroll does not adjust volume until the
applet is clicked once" — the wheel events were reaching the widget all
along, which is why a single click made scrolling work on plain hover
from then on.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-31 09:33:16 +02:00
7 changed files with 946 additions and 944 deletions

465
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -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" }

View file

@ -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(),

View file

@ -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

View file

@ -3,7 +3,6 @@
mod app;
mod config;
mod localize;
mod utils;
use crate::localize::localize;

View file

@ -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)
}