On my system for some reason the brightness indicator would not work to change the brightness. Although xbacklight did work to change the brightness.
I wrote an extension to run xbacklight whenever it changes the brightness. It works. Although it does not disable (not that I need it to, but I would like to have good code). I am not sure how to properly disable the extension. Here is all the code.
const Main = imports.ui.main;
const Lang = imports.lang;
const Util = imports.misc.util;
const Brightness = imports.ui.status.brightness;
const BrightnessIndicator = new Lang.Class({
Name : 'BrightnessIndicator',
Extends : Brightness.Indicator,
_sync : function () {
let visible = this._proxy.Brightness >= 0;
this._item.actor.visible = visible;
if (visible) {
this._slider.setValue(this._proxy.Brightness / 100.0);
}
let percent = this._proxy.Brightness.toString();
Util.spawn(['xbacklight', '-set', percent]);
}
});
function init() {
}
function enable() {
var indicator = new BrightnessIndicator();
Main.panel.statusArea.aggregateMenu._brightness = indicator;
}
function disable() {
delete indicator;
Main.panel.statusArea.aggregateMenu._brightness = null;
}
I have also tried adding a variable from enable() to hold the old _brightness and then reseting _brightness to that in the disable() code.
Neither approach has worked for me so any help would be appreciated.