Skip to content

DeviceManager: use gala's brightness interface - #301

Open
garaevdi wants to merge 19 commits into
elementary:mainfrom
garaevdi:gala-brightness-interface
Open

garaevdi wants to merge 19 commits into
elementary:mainfrom
garaevdi:gala-brightness-interface

Conversation

@garaevdi

@garaevdi garaevdi commented Jul 17, 2026 •

Copy link
Copy Markdown

Fixes #296
Requires elementary/gala#2916

@zeebok
zeebok requested a review from a team July 25, 2026 16:16
@ryonakano ryonakano added this to OS 9 Jul 28, 2026
@ryonakano ryonakano moved this to In progress in OS 9 Jul 28, 2026
@ryonakano ryonakano moved this from In progress to Needs Review in OS 9 Jul 28, 2026
Comment thread src/Widgets/ScreenBrightness.vala Outdated
@garaevdi
garaevdi force-pushed the gala-brightness-interface branch 2 times, most recently from 8ae12b5 to 908399e Compare August 30, 2026 17:28
@garaevdi
garaevdi force-pushed the gala-brightness-interface branch from 908399e to 8a12a7c Compare August 30, 2026 17:40

@leolost2605 leolost2605 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great with elementary/gala#2916 thanks! I left a few comments

Comment thread src/Services/DeviceManager.vala Outdated
Comment thread src/Widgets/ScreenBrightness.vala Outdated
Comment thread src/Indicator.vala Outdated
Comment thread src/Indicator.vala Outdated
@zeebok
zeebok requested a review from leolost2605 September 21, 2026 05:14

@leolost2605 leolost2605 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments :)

Comment thread src/Services/BrightnessManager.vala Outdated
Comment thread src/Services/BrightnessManager.vala Outdated
Comment thread src/Services/DBusInterfaces/GalaBrightnessManager.vala Outdated
Comment thread src/Services/BrightnessManager.vala
Comment thread src/Widgets/PopoverWidget.vala
Comment thread src/Widgets/ScreenBrightnessList.vala Outdated
Comment thread src/Widgets/ScreenBrightnessList.vala Outdated
Comment thread src/Widgets/ScreenBrightnessRow.vala Outdated
Comment thread src/Widgets/ScreenBrightnessList.vala Outdated
private void populate_list () {
for (int i = 0; i < brightness_manager.get_n_monitors (); i++) {
if (i != 0) {
list_box.append (new Gtk.Separator (Gtk.Orientation.HORIZONTAL) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just use Gtk.ListBox.show_separators for this

@garaevdi garaevdi Sep 24, 2026 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, but it doesn't quite have the same style as other separators (perhaps fixed in granite-9?)
image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm maybe even no separators would work? Since it belongs to the same group of controls I think it would make sense to have no separators. @elementary/ux any opinions?

Comment thread src/Widgets/ScreenBrightnessRow.vala Outdated
@garaevdi
garaevdi force-pushed the gala-brightness-interface branch from ceb59d7 to 58955ad Compare September 24, 2026 20:15
Comment thread src/Services/BrightnessManager.vala
Comment thread src/Services/BrightnessManager.vala Outdated
Comment thread src/Widgets/ScreenBrightnessList.vala Outdated
Comment thread src/Widgets/ScreenBrightnessRow.vala Outdated
Comment thread src/Widgets/ScreenBrightnessRow.vala Outdated
Comment thread src/Indicator.vala Outdated
Comment thread src/Indicator.vala Outdated
Comment thread src/Indicator.vala Outdated
Comment thread src/Widgets/ScreenBrightnessList.vala Outdated
Comment thread src/Indicator.vala Outdated
@garaevdi
garaevdi force-pushed the gala-brightness-interface branch from 58955ad to be83482 Compare October 3, 2026 09:18
So there would be no warning when we are trying to scroll on top of
indicator while there is no suitable monitors with brightness control
@garaevdi
garaevdi force-pushed the gala-brightness-interface branch from be83482 to 3b4e913 Compare October 3, 2026 09:30

@leolost2605 leolost2605 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few nits apart from that LGTM :)

Comment on lines +1 to +18
/*
* Copyright (c) 2011-2018 elementary LLC. (https://elementary.io)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
* Boston, MA 02110-1301, USA.
*/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use the new license header here like you do elsewhere

Suggested change
/*
* Copyright (c) 2011-2018 elementary LLC. (https://elementary.io)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
/*
* Copyright 2026 elementary, Inc. (https://elementary.io)
* SPDX-License-Identifier: GPL-3.0-or-later
*/

Comment on lines +21 to +25
if (gala_brightness_manager == null) {
return false;
}

return true;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (gala_brightness_manager == null) {
return false;
}
return true;
return gala_brightness_manager != null;

Comment on lines +35 to +39
if (get_n_monitors () <= 0) {
return false;
}

return true;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (get_n_monitors () <= 0) {
return false;
}
return true;
return get_n_monitors () > 0;

Comment on lines +120 to +122
brightness_manager.notify["has-monitors"].connect ((s, p) => {
update_device_separator_revealer ();
});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
brightness_manager.notify["has-monitors"].connect ((s, p) => {
update_device_separator_revealer ();
});
brightness_manager.notify["has-monitors"].connect (update_device_separator_revealer);

Comment on lines +1 to +18
/*
* Copyright 2011-2021 elementary, Inc. (https://elementary.io)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
* Boston, MA 02110-1301, USA.
*/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/*
* Copyright 2011-2021 elementary, Inc. (https://elementary.io)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
/*
* Copyright 2026 elementary, Inc. (https://elementary.io)
* SPDX-License-Identifier: GPL-3.0-or-later
*/

};

if (index == 0) {
monitor_label.set_text (_(@"$(monitor_label.get_text ()) (Primary)"));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
monitor_label.set_text (_(@"$(monitor_label.get_text ()) (Primary)"));
monitor_label.set_text (_("%s (Primary)").printf (monitor_label.get_text ()));

monitor_label.set_text (_(@"$(monitor_label.get_text ()) (Primary)"));
}

brightness_slider = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, 0, 1, 0.1) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually leave the namespace away if it's not necessary

Suggested change
brightness_slider = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, 0, 1, 0.1) {
brightness_slider = new Gtk.Scale.with_range (HORIZONTAL, 0, 1, 0.1) {

width_request = 175
};

var slider_box = new Granite.Box (Gtk.Orientation.VERTICAL, Granite.Box.Spacing.NONE) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var slider_box = new Granite.Box (Gtk.Orientation.VERTICAL, Granite.Box.Spacing.NONE) {
var slider_box = new Granite.Box (VERTICAL, NONE) {

slider_box.append (monitor_label);
slider_box.append (brightness_slider);

var box = new Granite.Box (Gtk.Orientation.HORIZONTAL, Granite.Box.Spacing.HALF) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var box = new Granite.Box (Gtk.Orientation.HORIZONTAL, Granite.Box.Spacing.HALF) {
var box = new Granite.Box (HORIZONTAL, HALF) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs Review

Development

Successfully merging this pull request may close these issues.

Brightness control doesn't work with mutter-49+

5 participants