Merge lp:~lukas-kde/unity8/brightnessControl into lp:unity8

Proposed by Lukáš Tinkl
Status: Merged
Approved by: Michael Zanetti
Approved revision: 2613
Merged at revision: 2717
Proposed branch: lp:~lukas-kde/unity8/brightnessControl
Merge into: lp:unity8
Diff against target: 92 lines (+57/-5)
3 files modified
plugins/Unity/Indicators/indicatorsmanager.cpp (+1/-4)
qml/Components/BrightnessControl.qml (+54/-0)
qml/Shell.qml (+2/-1)
To merge this branch: bzr merge lp:~lukas-kde/unity8/brightnessControl
Reviewer Review Type Date Requested Status
Michael Zanetti (community) Approve
Unity8 CI Bot continuous-integration Approve
Review via email: mp+308695@code.launchpad.net

Commit message

Enable brightness (laptop backlight) handling on desktop/laptop PCs

Description of the change

Enable brightness (laptop backlight) handling on desktop/laptop PCs

This merely puts the indicator-power back to phone mode (to display the brightness slider) and introduces 2 global keyboard shortcuts to handle it.

Best way to test is to install silo https://bileto.ubuntu.com/#/ticket/2221 and then:

$ sudo systemctl start repowerd.service

* Are there any related MPs required for this MP to build/function as expected? Please list.

Yes, needs repowerd from https://code.launchpad.net/~afrantzis/repowerd/+git/repowerd/+merge/311015

 * Did you perform an exploratory manual test run of your code change and any related functionality?

Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?

N/A

 * If you changed the UI, has there been a design review?

N/A

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:2613
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2528/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3334
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1907
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1907
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/1907
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3362
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3214
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3214/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3214
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3214/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3214
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3214/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3214
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3214/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3214
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3214/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3214
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3214/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3214
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3214/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3214
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3214/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3214
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3214/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2528/rebuild

review: Approve (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

tested, works.

code looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/Unity/Indicators/indicatorsmanager.cpp'
2--- plugins/Unity/Indicators/indicatorsmanager.cpp 2016-08-03 15:52:42 +0000
3+++ plugins/Unity/Indicators/indicatorsmanager.cpp 2016-11-22 09:39:38 +0000
4@@ -282,13 +282,10 @@
5 // convergence:
6 // 1) enable session indicator
7 // 2) enable keyboard indicator
8- // 3) on a PC, switch the battery/power indicator to desktop mode,
9- // can't control brightness for now and phone-on-desktop broken (FIXME)
10 //
11 // The rest of the indicators respect their default profile (which is "phone", even on desktop PCs)
12 if ((new_indicator->identifier() == QStringLiteral("indicator-session"))
13- || new_indicator->identifier() == QStringLiteral("indicator-keyboard")
14- || (new_indicator->identifier() == QStringLiteral("indicator-power") && m_platform.isPC())) {
15+ || new_indicator->identifier() == QStringLiteral("indicator-keyboard")) {
16 new_indicator->setProfile(QString(m_profile).replace(QStringLiteral("phone"), QStringLiteral("desktop")));
17 } else {
18 new_indicator->setProfile(m_profile);
19
20=== added file 'qml/Components/BrightnessControl.qml'
21--- qml/Components/BrightnessControl.qml 1970-01-01 00:00:00 +0000
22+++ qml/Components/BrightnessControl.qml 2016-11-22 09:39:38 +0000
23@@ -0,0 +1,54 @@
24+/*
25+ * Copyright (C) 2016 Canonical, Ltd.
26+ *
27+ * This program is free software; you can redistribute it and/or modify
28+ * it under the terms of the GNU General Public License as published by
29+ * the Free Software Foundation; version 3.
30+ *
31+ * This program is distributed in the hope that it will be useful,
32+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
33+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34+ * GNU General Public License for more details.
35+ *
36+ * You should have received a copy of the GNU General Public License
37+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
38+ */
39+
40+import QtQuick 2.4
41+import Ubuntu.Components 1.3
42+import QMenuModel 0.1
43+import GlobalShortcut 1.0
44+
45+QtObject {
46+ objectName: "brightnessControl"
47+
48+ property GlobalShortcut brightnessUp: GlobalShortcut {
49+ shortcut: Qt.Key_MonBrightnessUp
50+ onTriggered: stepUp();
51+ }
52+
53+ property GlobalShortcut brightnessDown: GlobalShortcut {
54+ shortcut: Qt.Key_MonBrightnessDown
55+ onTriggered: stepDown();
56+ }
57+
58+ function stepUp() {
59+ actionGroup.brightness.updateState(MathUtils.clamp(actionGroup.brightness.state + 0.1, 0.01, 1.0));
60+ }
61+
62+ function stepDown() {
63+ actionGroup.brightness.updateState(MathUtils.clamp(actionGroup.brightness.state - 0.1, 0.01, 1.0));
64+ }
65+
66+ property QDBusActionGroup actionGroup: QDBusActionGroup {
67+ busType: DBus.SessionBus
68+ busName: "com.canonical.indicator.power"
69+ objectPath: "/com/canonical/indicator/power"
70+
71+ property variant brightness: action("brightness")
72+
73+ Component.onCompleted: {
74+ actionGroup.start();
75+ }
76+ }
77+}
78
79=== modified file 'qml/Shell.qml'
80--- qml/Shell.qml 2016-11-09 15:07:26 +0000
81+++ qml/Shell.qml 2016-11-22 09:39:38 +0000
82@@ -786,8 +786,9 @@
83 Behavior on opacity { UbuntuNumberAnimation {} }
84 }
85
86- // non-visual object
87+ // non-visual objects
88 KeymapSwitcher {}
89+ BrightnessControl {}
90
91 Rectangle {
92 id: shutdownFadeOutRectangle

Subscribers

People subscribed via source and target branches