Merge lp:~didrocks/gnome-shell/sound-above-100 into lp:~ubuntu-desktop/gnome-shell/ubuntu

Proposed by Didier Roche-Tolomelli
Status: Merged
Merged at revision: 47
Proposed branch: lp:~didrocks/gnome-shell/sound-above-100
Merge into: lp:~ubuntu-desktop/gnome-shell/ubuntu
Diff against target: 158 lines (+130/-0)
4 files modified
debian/changelog (+11/-0)
debian/patches/50_add_ubuntu_desktop_detect.patch (+38/-0)
debian/patches/70_allow_sound_above_100.patch (+79/-0)
debian/patches/series (+2/-0)
To merge this branch: bzr merge lp:~didrocks/gnome-shell/sound-above-100
Reviewer Review Type Date Requested Status
Sebastien Bacher Pending
Review via email: mp+328067@code.launchpad.net

Description of the change

* Add patch to allow setting volume above 100%:
    - debian/patches/70_allow_sound_above_100.patch, which allows the volume
      slider in the aggregatemenu to reflect and set correct current volume
      position. (LP: #1706524)

To post a comment you must log in.
40. By Didier Roche-Tolomelli

Changed Forwarded to simpy Bug

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

Pinging seb on that one as he did g-s-d review

41. By Didier Roche-Tolomelli

Make it dependent on XDG_CURRENT_DESKTOP (which is what we are going
to use on other places).

42. By Didier Roche-Tolomelli

Add debian/patches/50_add_ubuntu_desktop_detect.patch to centralize
current desktop detection.

Revision history for this message
Amr Ibrahim (amribrahim1987) wrote :

There is a typo in the code. See the inline comment.

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

Thanks! Staging it for the next upload :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2017-07-23 17:08:07 +0000
+++ debian/changelog 2017-08-09 16:08:12 +0000
@@ -1,3 +1,14 @@
1gnome-shell (3.24.3-0ubuntu2) UNRELEASED; urgency=medium
2
3 * Add patch to allow setting volume above 100%:
4 - debian/patches/70_allow_sound_above_100.patch, which allows the volume
5 slider in the aggregatemenu to reflect and set correct current volume
6 position. (LP: #1706524)
7 * Add debian/patches/50_add_ubuntu_desktop_detect.patch to centralize
8 current desktop detection.
9
10 -- Didier Roche <didrocks@ubuntu.com> Wed, 26 Jul 2017 09:00:40 +0200
11
1gnome-shell (3.24.3-0ubuntu1) artful; urgency=medium12gnome-shell (3.24.3-0ubuntu1) artful; urgency=medium
213
3 * New upstream release14 * New upstream release
415
=== added file 'debian/patches/50_add_ubuntu_desktop_detect.patch'
--- debian/patches/50_add_ubuntu_desktop_detect.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/50_add_ubuntu_desktop_detect.patch 2017-08-09 16:08:12 +0000
@@ -0,0 +1,38 @@
1Description: Add an helper to detect current desktop
2 We will differentiate some behavior depending on current desktop. Add an
3 helper to centralize the current desktop detection.
4Forwarded: not-needed
5Origin: ubuntu
6Author: didrocks@ubuntu.com
7Index: gnome-shell-3.24.3/js/misc/desktop.js
8===================================================================
9--- /dev/null
10+++ gnome-shell-3.24.3/js/misc/desktop.js
11@@ -0,0 +1,27 @@
12+// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
13+
14+const GLib = imports.gi.GLib;
15+
16+// is:
17+// @name: desktop string you want to assert if it matches the current desktop env
18+//
19+// The function examples XDG_CURRENT_DESKTOP and return if the current desktop
20+// is part of that desktop string.
21+//
22+// Return value: if the environment isn't set or doesn't match, return False
23+// otherwise, return True.
24+function is(name) {
25+ let desktopsEnv = GLib.getenv('XDG_CURRENT_DESKTOP');
26+ if (!desktopsEnv) {
27+ return false;
28+ }
29+
30+ let desktops = desktopsEnv.split(":");
31+ for (let i = 0; i < desktops.length; i++) {
32+ if (desktops[i] === name) {
33+ return true;
34+ }
35+ }
36+
37+ return false;
38+}
039
=== added file 'debian/patches/70_allow_sound_above_100.patch'
--- debian/patches/70_allow_sound_above_100.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/70_allow_sound_above_100.patch 2017-08-09 16:08:12 +0000
@@ -0,0 +1,79 @@
1Description: Allow volume to bet set above 100%.
2 Some systems have low maximum volume set (like x220), allow, from an option
3 in gnome-control-center to set it above that 100% limit from g-s-d
4 (keyboard) and gnome-shell.
5Origin: ubuntu
6Bug-Ubuntu: https://launchpad.net/bugs/1706524
7Bug: https://bugzilla.gnome.org/show_bug.cgi?id=710424
8
9Index: gnome-shell-3.24.3/js/ui/status/volume.js
10===================================================================
11--- gnome-shell-3.24.3.orig/js/ui/status/volume.js
12+++ gnome-shell-3.24.3/js/ui/status/volume.js
13@@ -7,6 +7,7 @@ const Gvc = imports.gi.Gvc;
14 const St = imports.gi.St;
15 const Signals = imports.signals;
16
17+const Desktop = imports.misc.desktop;
18 const PanelMenu = imports.ui.panelMenu;
19 const PopupMenu = imports.ui.popupMenu;
20 const Slider = imports.ui.slider;
21@@ -49,6 +50,14 @@ const StreamSlider = new Lang.Class({
22 }));
23
24 this._stream = null;
25+
26+ this._use_amplifiedvolume = false;
27+ if (Desktop.is('ubuntu')) {
28+ this._volumesettings = new Gio.Settings({ schema_id: 'com.ubuntu.sound' });
29+ this._volumesettings.connect('changed::allow-amplified-volume',
30+ Lang.bind(this, this._updateAmplifiedVolume));
31+ this._updateAmplifiedVolume();
32+ }
33 },
34
35 get stream() {
36@@ -102,11 +111,24 @@ const StreamSlider = new Lang.Class({
37 this._slider.setValue(value);
38 },
39
40+ _updateAmplifiedVolume: function () {
41+ this._use_amplifiedvolume =
42+ this._volumesettings.get_boolean('allow-amplified-volume');
43+ },
44+
45+ _get_control_max_volume: function() {
46+ // return max volume depending if we are in an permitted amplified setting or not
47+ if (this._use_amplifiedvolume) {
48+ return this._control.get_vol_max_amplified();
49+ }
50+ return this._control.get_vol_max_norm();
51+ },
52+
53 _sliderChanged: function(slider, value, property) {
54 if (!this._stream)
55 return;
56
57- let volume = value * this._control.get_vol_max_norm();
58+ let volume = value * this._get_control_max_volume();
59 let prevMuted = this._stream.is_muted;
60 if (volume < 1) {
61 this._stream.volume = 0;
62@@ -130,7 +152,7 @@ const StreamSlider = new Lang.Class({
63
64 _updateVolume: function() {
65 let muted = this._stream.is_muted;
66- this._slider.setValue(muted ? 0 : (this._stream.volume / this._control.get_vol_max_norm()));
67+ this._slider.setValue(muted ? 0 : (this._stream.volume / this._get_control_max_volume()));
68 this.emit('stream-updated');
69 },
70
71@@ -142,7 +164,7 @@ const StreamSlider = new Lang.Class({
72 if (this._stream.is_muted || volume <= 0) {
73 return 'audio-volume-muted-symbolic';
74 } else {
75- let n = Math.floor(3 * volume / this._control.get_vol_max_norm()) + 1;
76+ let n = Math.floor(3 * volume / this._get_control_max_volume()) + 1;
77 if (n < 2)
78 return 'audio-volume-low-symbolic';
79 if (n >= 3)
080
=== modified file 'debian/patches/series'
--- debian/patches/series 2017-07-23 17:08:02 +0000
+++ debian/patches/series 2017-08-09 16:08:12 +0000
@@ -1,6 +1,8 @@
127-nm-libexec-path.patch127-nm-libexec-path.patch
2#30-remoteMenu-Prevent-the-shell-from-becoming-unrespons.patch2#30-remoteMenu-Prevent-the-shell-from-becoming-unrespons.patch
341-handle-logind-fail.patch341-handle-logind-fail.patch
450_add_ubuntu_desktop_detect.patch
570_allow_sound_above_100.patch
4ubuntu-lightdm-user-switching.patch6ubuntu-lightdm-user-switching.patch
5ubuntu_lock_on_suspend.patch7ubuntu_lock_on_suspend.patch
6ubuntu_font.patch8ubuntu_font.patch

Subscribers

People subscribed via source and target branches