! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Screen brightness - increase number of increments
Status:
RESOLVED: FIXED
Product:
Xfce4-power-manager
Component:
General

Comments

Description majest 2015-07-11 08:19:37 CEST
When using FN key and arrows there are only 10 increments in the screen brightness settings. The lowest one is a black screen and the next one is already mid-bright for me. So basically it is not possible to set a low screen brightness level.

Using xbacklight -dec 1 I have found there are 10 additional levels between the two xfce4-power-manager zero nd first level. Please can you let us access these.
Comment 1 majest 2015-07-11 09:58:05 CEST
The following lines in common/xfpm-brightness.c seem to be the cause of the course brightness steps.

http://git.xfce.org/xfce/xfce4-power-manager/tree/common/xfpm-brightness.c

214  brightness->priv->step =  max <= 20 ? 1 : max / 10;
366  brightness->priv->step =  ret <= 20 ? 1 : ret / 10;

I wonder if you could change these numbers to 20 or 30 to allow finer steps, e.g.

  brightness->priv->step =  max <= 30 ? 1 : max / 30;

I'm going to try and recompile but it looks a bit complicated for me.
Comment 2 majest 2015-07-18 19:45:48 CEST
I just saw there is something called:

xfce4-settings-editor 

Perhaps you could put the number of steps as a parameter in there so users can do whatever they want.
Comment 3 Simon Steinbeiss editbugs 2016-01-24 20:10:34 CET
*** Bug 12299 has been marked as a duplicate of this bug. ***
Comment 4 Timothy Lee 2016-03-06 10:57:20 CET
I've made an attempt to add this feature.  The code can be found on the brightness-step-count branch at:  git@github.com:timothytylee/xfce4-power-manager.git

Please apply if the patch is acceptable.
Comment 5 Eric Koegel editbugs 2016-03-07 07:30:29 CET
Timothy, nice work. Now that you have a configuration option in the settings UI, you can react to that in the power manager plugin as well. If we do it in the backlight, you'll need to create a step_switch variable in the struct then, install it in the class_init
http://git.xfce.org/xfce/xfce4-power-manager/tree/src/xfpm-backlight.c#n313

Use xfconf_g_property_bind to be notified of changes.
http://git.xfce.org/xfce/xfce4-power-manager/tree/src/xfpm-backlight.c#n368

Then you can call xfpm_brightness_set_step_count in the set_property function
and return the step-size in the get function.
http://git.xfce.org/xfce/xfce4-power-manager/tree/src/xfpm-backlight.c#n444
Comment 6 Eric Koegel editbugs 2016-03-07 18:35:38 CET
Ugh, that's what I get for commenting before coffee. For the panel plugin you'll want to do something similar what the brightness_min_level does in the panel-plugins/power-manager-plugin/power-manager-button.c Hope I'm not too confusing.
Comment 7 Timothy Lee 2016-03-08 01:20:06 CET
I believe the panel plugin doesn't need to be updated, since changing the number of keyboard controllable steps doesn't affect current brightness -- it only affects future brightness adjustment made by keyboard.
Comment 8 majest 2016-05-06 22:09:17 CEST
I wonder if you could make the increments logarithmic? I.e. 1, 2, 4, 6, 16. etc. On my screen, with linear steps the gaps are too large at the low levels (ie, the screen gets too bright too quickly) but then at the high levels there are too many steps needed to get to full brightness.

In terms of steps, something like 0, 1, 2, 3, 4, 5, 10, 20, 50, 75, 100 % would give fine control where you need it but you can also get to max brightness easily as well. Thanks for your help! Really appreciated.
Comment 9 Timothy Lee 2016-07-28 13:16:07 CEST
I've finished implementing the brightness step count functionality.  In addition to the git repository, I'm attaching a patch.
Comment 10 Timothy Lee 2016-07-28 13:17:11 CEST
Created attachment 6754 
Adjustable brightness steps
Comment 11 Elin Angelov 2016-07-29 12:49:42 CEST
(In reply to Timothy Lee from comment #10)
> Created attachment 6754 
> Adjustable brightness steps

to which package should be applied this patch ? because i cannot see edited file in xfce4-power-manager
Comment 12 Timothy Lee 2016-07-29 14:56:07 CEST
I've added an option to toggle exponential step sizes.
Comment 13 Timothy Lee 2016-07-29 14:56:56 CEST
Created attachment 6757 
Adjustable brightness steps with support for exponential step sizes
Comment 14 Timothy Lee 2016-07-29 14:59:47 CEST
This patch is applicable to the master branch of xfce4-power-manager at http://git.xfce.org/xfce/xfce4-power-manager/
Comment 15 Elin Angelov 2016-07-29 20:24:58 CEST
thanks
Comment 16 Timothy Lee 2016-08-30 09:42:02 CEST
Ping.  Any comments on the patch?
Comment 17 majest 2017-01-14 12:09:31 CET
The latest versions (up to 1.6) still have the original code with the brain-dead step increment.

https://github.com/xfce-mirror/xfce4-power-manager/releases

What exactly is the point of this bug tracker?

Logarithmic increments can be implemented with very little modification in common/xfpm-brightness.c. Look for "set_level =" and use the following for decrement and increment, respectively.

    set_level = MAX (hw_level/2, brightness->priv->min_level);

    set_level = MIN (hw_level*2 + (hw_level==0), brightness->priv->max_level );

I hope someone finds this useful... if anyone is even out there!
Comment 18 majest 2017-01-22 09:41:41 CET
Works even better with a smaller decrement value, so you can access in-between values.

 set_level = MAX (hw_level/1.5, brightness->priv->min_level);
Comment 19 Marcel Partap 2017-12-03 19:16:15 CET
Yes, please @maintainer integrate this into the next update : )
Comment 20 Timothy Lee 2018-05-12 14:42:40 CEST
Created attachment 7728 
Adjustable brightness steps with support for exponential step sizes

Updated patch again for master branch of xfce4-power-manager at http://git.xfce.org/xfce/xfce4-power-manager/
Comment 21 majest 2018-08-29 09:22:36 CEST
Wow that is a godawful amount of patching for a simple 2-line fix. Are you sure there's not an NSA backdoor embedded in there somewhere? ;)
Comment 22 alcornoqui 2019-06-11 20:14:33 CEST
@majest I guess the bulk of the patch is the added config options in the GUI, please don't spread FUD (even ironic FUD).

I think this a very good feature and several users in the forum have expressed their desire for it and confirmed it works, e.g.: https://forum.xfce.org/viewtopic.php?id=13072

Thanks @Timothy Lee!
Comment 23 bjo 2019-06-15 15:49:28 CEST
@Timothy Lee Could you provide a patch for the actual master branch?
Comment 24 Timothy Lee 2019-06-19 15:39:31 CEST
Created attachment 8652 
Adjustable brightness steps with support for exponential step sizes

Rebased to latest master as of 2019-06-19.
Comment 25 Timothy Lee 2019-06-19 16:21:40 CEST
Created attachment 8653 
Adjustable brightness steps with support for exponential step sizes

Fixed compilation problem.
Comment 26 Simon Steinbeiss editbugs 2019-11-26 00:23:01 CET
Sorry this got overlooked for a while...
We're not doing this on purpose, we're just not enough people and don't have enough free time to clean up the bugtracker. (FYI Eric, who previously reviewed and commented on the patch left the project so this is simply a leftover.)

I'll take a look so this can get included for 4.16.
Comment 27 Simon Steinbeiss editbugs 2019-12-01 23:57:10 CET
I started to look into this patch - could you rebase it one last time on top of master? (Please note that it mostly fails to apply because I cleaned up the code formatting in the sourcecode - no more tabs, 2 spaces instead.)

Thanks in advance!
Comment 28 Simon Steinbeiss editbugs 2019-12-02 00:27:55 CET
Nvm, I rebased it myself.

So yes, it works, but I'm not sure I agree with not updating the panel plugin with the brightness steps. I understand you bound it visually to the brightness *buttons*, and that there is a separate GtkScale widget in the panel plugin's menu.

What feels a little strange to have two brightness steps, one on the brightness keys and the other for the mousewheel (which you can use on hovering the plugin to change the brightness).
Comment 29 Timothy Lee 2019-12-02 20:48:25 CET
Sorry, I completely missed the slider on the pop-up menu.
Comment 30 Timothy Lee 2019-12-14 00:17:45 CET
Created attachment 9307 
Adjustable brightness steps with support for exponential step sizes

I've updated the patch against latest master, with whitespace fixes.

The slider on the pop-up menu now also obeys uses the same steps as the brightness buttons (allowing for rounding errors).
Comment 31 Dawid Młynarczyk 2019-12-27 15:31:20 CET
The lowest one is a black screen for me too and the next one is already mid-bright on my Dell XPS 13. While I don't mind having the possibility to turn the screen brightness off completely, for many years I was also adding "xbacklight -dec 1" to the keyboard shortcuts, just to be able to dim my display more, when needed.

Thanks guys for fixing it. Can't wait to have it available in XFCE 4.16, when it comes out.
Comment 32 Git Bot editbugs 2020-01-06 00:45:59 CET
Timothy Lee referenced this bugreport in commit c866cf9faec6333e60f6b55a56b92ec9494747f3

Make brightness steps configurable (Bug #12062)

https://git.xfce.org/xfce/xfce4-power-manager/commit?id=c866cf9faec6333e60f6b55a56b92ec9494747f3
Comment 33 Simon Steinbeiss editbugs 2020-01-06 00:48:12 CET
Thanks for updating the patch and sticking to the coding style.
I only had very few places with odd spaces to fix (but I acknowledge that the source code is still quite messy and inconsistent in this respect, so it's hard to stick to a "correct style").
Comment 34 haarp 2020-01-15 19:55:17 CET
Thank you, Timothy Lee. This was long needed. I've applied attachment 8653  from comment 25 on top of xfce4-power-manager-1.6.5. I couldn't apply the newer patches due to the aforementioned code style changes.

Where are the settings to be found? I can't find anything new in the Power Manager's setting screen. I ended up manually adding them with the settings editor.

The exponential feature is really comfortable to use. However there's one caveat. It starts too slow, so that the first 3 of 10 steps have pretty much no effect at all. Is there a way to weigh it a little more towards the later steps?

Cheers!
Comment 35 Timothy Lee 2020-01-17 13:05:24 CET
(In reply to haarp from comment #34)
> Where are the settings to be found? I can't find anything new in the Power
> Manager's setting screen. I ended up manually adding them with the settings
> editor.

With the patch applied, on the General tab of Xfce Power Manager, there should be a "Brightness step count" field and an "Exponential" checkbox next to it.
 
> The exponential feature is really comfortable to use. However there's one
> caveat. It starts too slow, so that the first 3 of 10 steps have pretty much
> no effect at all. Is there a way to weigh it a little more towards the later
> steps?

I believe the effect of exponential steps is very much dependent on the characteristics of the LCD backlight.  For my last two laptops, there are very visible differences between every step on the scale.  Perhaps you can try reducing the number of steps to 6?

Enlarging the step sizes towards the lower end complicates the maths quite a bit, and may not suit everyone.
Comment 36 haarp 2020-01-17 13:37:53 CET
> With the patch applied, on the General tab of Xfce Power Manager, there should be a "Brightness step count" field and an "Exponential" checkbox next to it.

Weird, I'm not seeing those. But don't let that worry you, I'm sure the next proper release will have those setting show up.

> I believe the effect of exponential steps is very much dependent on the characteristics of the LCD backlight.  For my last two laptops, there are very visible differences between every step on the scale.  Perhaps you can try reducing the number of steps to 6?

Tried that. Funnily enough, it did nothing to change the lower end. Now I have 3 steps that do nothing and 3 steps that quickly increase brightness :)

Seems like a large case of YMMV.

Bug #12062

Reported by:
majest
Reported on: 2015-07-11
Last modified on: 2020-01-17
Duplicates (1):
  • 12299 xfce screen brightness levels

People

Assignee:
Simon Steinbeiss
CC List:
12 users

Version

Attachments

Additional information