Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Brightness controls try9 #511

Merged
merged 12 commits into from May 14, 2015
Merged

Conversation

tchx84
Copy link
Member

@tchx84 tchx84 commented May 14, 2015

This PR is for adding brightness control capabilities to Sugar. It includes a generic mechanism to interact with backlight devices, a jarabe model that acts as an abstraction for the sugar shell, keyboard control keys and a device frame UI.

tchx84 and others added 12 commits May 14, 2015 12:39
Add two CLI tools, the first one called "sugar-backlight-setup",
and the second one "sugar-backlight-helper".

The setup tool finds the backlight device and creates a symlink
under /var/run/ so it can be later used by sugar. The helper tool
allows sugar to interface with the backlight device.

Both tools are wrapped with polkit execution to access privileged
resources without root access.

Examples:

$ pkexec /usr/bin/sugar-backlight-setup
$ /usr/bin/sugar-backlight-helper --get-brightness
$ pkexec /usr/bin/sugar-backlight-helper --set-brightness INT

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
Add a new model which acts as a general backend for modifying
and tracking the brightness of the screen. This model uses
sugar-backlight-helper to interact with the backlight device.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
Add a new gsettings scheme key for saving and restoring brightness
values between sugar shell sessions.

Store values that are set by the user and do not store changes while
is still changing, in order to avoid unnecessary calls to gsettings.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
Use a GFileMonitor to track external changes done to the backlight
device.

This is required for detecting changes made to the device from external
power managers and to workaround missing keyboard events in the XO.

Ignore "external" changes triggered internally.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
Add a new globalkey file to implement brightness controls with the
keyboard. This is necessary for detecting XF86MonBrightnessUp and
XF86MonBrightnessDown events in standard laptops.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
Add a new model to provide a general interface for making
screenshots and refactor globalkey code to use this model.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
Add a new device icon to the frame to provive UI options
to modify brightness and take screenshots.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
Add a delay to the changes triggered by the progress bar in the display
frame palette.

This is necessary because calling to external tool is slow and because we
do not need to update the screen brightness for every bit of increment,
while the bar is still being changed.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
Connect to Brightness.changed_signal to update the progress bar if
the brightness values changes externally, ie., because of changes
made by power manager or captured control keys.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
@tchx84
Copy link
Member Author

tchx84 commented May 14, 2015

This PR replaces #510, making Brightness model constant _private.

@tchx84
Copy link
Member Author

tchx84 commented May 14, 2015

Github meeses with the commits order, to see the original order please take a look at https://github.com/tchx84/sugar/commits/brightness-controls-try9

@tchx84
Copy link
Member Author

tchx84 commented May 14, 2015

This also needs sugarlabs/sugar-artwork#51

@godiard godiard merged commit 3ca1606 into sugarlabs:master May 14, 2015
@samdroid-apps
Copy link
Contributor

Since this patch adds an almost required polkit policy, could we add that to the makefile or the docs or something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants