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
1=== modified file 'debian/changelog'
2--- debian/changelog 2017-07-23 17:08:07 +0000
3+++ debian/changelog 2017-08-09 16:08:12 +0000
4@@ -1,3 +1,14 @@
5+gnome-shell (3.24.3-0ubuntu2) UNRELEASED; urgency=medium
6+
7+ * Add patch to allow setting volume above 100%:
8+ - debian/patches/70_allow_sound_above_100.patch, which allows the volume
9+ slider in the aggregatemenu to reflect and set correct current volume
10+ position. (LP: #1706524)
11+ * Add debian/patches/50_add_ubuntu_desktop_detect.patch to centralize
12+ current desktop detection.
13+
14+ -- Didier Roche <didrocks@ubuntu.com> Wed, 26 Jul 2017 09:00:40 +0200
15+
16 gnome-shell (3.24.3-0ubuntu1) artful; urgency=medium
17
18 * New upstream release
19
20=== added file 'debian/patches/50_add_ubuntu_desktop_detect.patch'
21--- debian/patches/50_add_ubuntu_desktop_detect.patch 1970-01-01 00:00:00 +0000
22+++ debian/patches/50_add_ubuntu_desktop_detect.patch 2017-08-09 16:08:12 +0000
23@@ -0,0 +1,38 @@
24+Description: Add an helper to detect current desktop
25+ We will differentiate some behavior depending on current desktop. Add an
26+ helper to centralize the current desktop detection.
27+Forwarded: not-needed
28+Origin: ubuntu
29+Author: didrocks@ubuntu.com
30+Index: gnome-shell-3.24.3/js/misc/desktop.js
31+===================================================================
32+--- /dev/null
33++++ gnome-shell-3.24.3/js/misc/desktop.js
34+@@ -0,0 +1,27 @@
35++// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
36++
37++const GLib = imports.gi.GLib;
38++
39++// is:
40++// @name: desktop string you want to assert if it matches the current desktop env
41++//
42++// The function examples XDG_CURRENT_DESKTOP and return if the current desktop
43++// is part of that desktop string.
44++//
45++// Return value: if the environment isn't set or doesn't match, return False
46++// otherwise, return True.
47++function is(name) {
48++ let desktopsEnv = GLib.getenv('XDG_CURRENT_DESKTOP');
49++ if (!desktopsEnv) {
50++ return false;
51++ }
52++
53++ let desktops = desktopsEnv.split(":");
54++ for (let i = 0; i < desktops.length; i++) {
55++ if (desktops[i] === name) {
56++ return true;
57++ }
58++ }
59++
60++ return false;
61++}
62
63=== added file 'debian/patches/70_allow_sound_above_100.patch'
64--- debian/patches/70_allow_sound_above_100.patch 1970-01-01 00:00:00 +0000
65+++ debian/patches/70_allow_sound_above_100.patch 2017-08-09 16:08:12 +0000
66@@ -0,0 +1,79 @@
67+Description: Allow volume to bet set above 100%.
68+ Some systems have low maximum volume set (like x220), allow, from an option
69+ in gnome-control-center to set it above that 100% limit from g-s-d
70+ (keyboard) and gnome-shell.
71+Origin: ubuntu
72+Bug-Ubuntu: https://launchpad.net/bugs/1706524
73+Bug: https://bugzilla.gnome.org/show_bug.cgi?id=710424
74+
75+Index: gnome-shell-3.24.3/js/ui/status/volume.js
76+===================================================================
77+--- gnome-shell-3.24.3.orig/js/ui/status/volume.js
78++++ gnome-shell-3.24.3/js/ui/status/volume.js
79+@@ -7,6 +7,7 @@ const Gvc = imports.gi.Gvc;
80+ const St = imports.gi.St;
81+ const Signals = imports.signals;
82+
83++const Desktop = imports.misc.desktop;
84+ const PanelMenu = imports.ui.panelMenu;
85+ const PopupMenu = imports.ui.popupMenu;
86+ const Slider = imports.ui.slider;
87+@@ -49,6 +50,14 @@ const StreamSlider = new Lang.Class({
88+ }));
89+
90+ this._stream = null;
91++
92++ this._use_amplifiedvolume = false;
93++ if (Desktop.is('ubuntu')) {
94++ this._volumesettings = new Gio.Settings({ schema_id: 'com.ubuntu.sound' });
95++ this._volumesettings.connect('changed::allow-amplified-volume',
96++ Lang.bind(this, this._updateAmplifiedVolume));
97++ this._updateAmplifiedVolume();
98++ }
99+ },
100+
101+ get stream() {
102+@@ -102,11 +111,24 @@ const StreamSlider = new Lang.Class({
103+ this._slider.setValue(value);
104+ },
105+
106++ _updateAmplifiedVolume: function () {
107++ this._use_amplifiedvolume =
108++ this._volumesettings.get_boolean('allow-amplified-volume');
109++ },
110++
111++ _get_control_max_volume: function() {
112++ // return max volume depending if we are in an permitted amplified setting or not
113++ if (this._use_amplifiedvolume) {
114++ return this._control.get_vol_max_amplified();
115++ }
116++ return this._control.get_vol_max_norm();
117++ },
118++
119+ _sliderChanged: function(slider, value, property) {
120+ if (!this._stream)
121+ return;
122+
123+- let volume = value * this._control.get_vol_max_norm();
124++ let volume = value * this._get_control_max_volume();
125+ let prevMuted = this._stream.is_muted;
126+ if (volume < 1) {
127+ this._stream.volume = 0;
128+@@ -130,7 +152,7 @@ const StreamSlider = new Lang.Class({
129+
130+ _updateVolume: function() {
131+ let muted = this._stream.is_muted;
132+- this._slider.setValue(muted ? 0 : (this._stream.volume / this._control.get_vol_max_norm()));
133++ this._slider.setValue(muted ? 0 : (this._stream.volume / this._get_control_max_volume()));
134+ this.emit('stream-updated');
135+ },
136+
137+@@ -142,7 +164,7 @@ const StreamSlider = new Lang.Class({
138+ if (this._stream.is_muted || volume <= 0) {
139+ return 'audio-volume-muted-symbolic';
140+ } else {
141+- let n = Math.floor(3 * volume / this._control.get_vol_max_norm()) + 1;
142++ let n = Math.floor(3 * volume / this._get_control_max_volume()) + 1;
143+ if (n < 2)
144+ return 'audio-volume-low-symbolic';
145+ if (n >= 3)
146
147=== modified file 'debian/patches/series'
148--- debian/patches/series 2017-07-23 17:08:02 +0000
149+++ debian/patches/series 2017-08-09 16:08:12 +0000
150@@ -1,6 +1,8 @@
151 27-nm-libexec-path.patch
152 #30-remoteMenu-Prevent-the-shell-from-becoming-unrespons.patch
153 41-handle-logind-fail.patch
154+50_add_ubuntu_desktop_detect.patch
155+70_allow_sound_above_100.patch
156 ubuntu-lightdm-user-switching.patch
157 ubuntu_lock_on_suspend.patch
158 ubuntu_font.patch

Subscribers

People subscribed via source and target branches