Skip to content

Commit

Permalink
gestures: Show the OSD when using gestures to change volume (#12731)
Browse files Browse the repository at this point in the history
This was missed during the port to the new OSD. Using gestures to change the
volume was also always using the max amplified volume. Fix this to respect the
users setting while we are at it.

Closes: #12646
  • Loading branch information
JosephMcc authored Feb 10, 2025
1 parent 49179c7 commit 9627877
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions js/ui/gestures/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,13 @@ var VolumeAction = class extends BaseAction {

this.ignoring = true;

this.max_volume = mixer.get_vol_max_amplified();
const soundSettings = new Gio.Settings({ schema_id: "org.cinnamon.desktop.sound" });

if(soundSettings.get_boolean("allow-amplified-volume"))
this.max_volume = mixer.get_vol_max_amplified();
else
this.max_volume = mixer.get_vol_max_norm();

this.pct_step = Math.ceil(this.max_volume / 100);
}

Expand Down Expand Up @@ -350,7 +356,7 @@ var VolumeAction = class extends BaseAction {
sink.change_is_muted(false);
}

Main.osdWindowManager.show(-1, this._get_volume_icon(int_pct, false), int_pct, false);
Main.osdWindowManager.show(-1, this._get_volume_icon(int_pct, false), null, int_pct, false);
}

_toggle_muted() {
Expand All @@ -364,7 +370,7 @@ var VolumeAction = class extends BaseAction {
sink.change_is_muted(!is_muted);

const percent = !is_muted ? 0 : (sink.volume / this.pct_step).clamp(0, 100);
Main.osdWindowManager.show(-1, this._get_volume_icon(percent), percent, false);
Main.osdWindowManager.show(-1, this._get_volume_icon(percent), null, percent, false);
}

_get_volume_icon(volume_pct) {
Expand Down

0 comments on commit 9627877

Please sign in to comment.