Brightness icon indicating copy to clipboard operation
Brightness copied to clipboard

Added direct control of monitor backlight using ddcutil

Open Soggy-Pancake opened this issue 3 years ago • 8 comments

I wanted to directly control the backlight brightness of my monitors rather than just software brightness. It detects if ddcutil is installed and if it is then there is a check box that allows ddcutil to be used. I changed the sliders from valueChanged to sliderReleased because controlling the backlight directly is pretty slow so I made sure it wouldn't try to change it a million times. I haven't tested more than 3 monitors but the original functionality is mostly unchanged.

Soggy-Pancake avatar Jul 08 '22 23:07 Soggy-Pancake

Hey, that's awesome! I will check it out. @apandada1, if you have time - please check it out as well. :)

LordAmit avatar Jul 09 '22 07:07 LordAmit

I will certainly check it out.

On Sat, 9 Jul, 2022, 12:55 pm Amit Seal Ami, @.***> wrote:

Hey, that's awesome! I will check it out. @apandada1 https://github.com/apandada1, if you have time - please check it out as well. :)

— Reply to this email directly, view it on GitHub https://github.com/LordAmit/Brightness/pull/210#issuecomment-1179495807, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXL2XBSFUI3SFWP55C776TVTESQDANCNFSM53CM5TOA . You are receiving this because you were mentioned.Message ID: @.***>

archisman-panigrahi avatar Jul 09 '22 08:07 archisman-panigrahi

Hi @Soggy-Pancake Thanks for the PR. It seems to work.

Can you please implement the following changes.

  1. Please remove the .pyc files in pycache https://github.com/LordAmit/Brightness/pull/210/commits/c87e9241a70ede1de10ff6ed4f329e3931e6305c

  2. Can you make a toggle switch for xrandr and ddcutil? I don't want to totally remove xrandr to change brightness because it has been working for us for a while.

  3. If I change the value of the slider using keyboard (using up/down keys, while the slider is selected), the brightness value does not update after releasing the key. Can you please fix it?

archisman-panigrahi avatar Jul 11 '22 03:07 archisman-panigrahi

ok I will start on that... The toggle switch for xrandr and ddcutil is this Screenshot_20220714_151059

Soggy-Pancake avatar Jul 14 '22 22:07 Soggy-Pancake

Changed tracking to false so it only updates when released like before but arrow keys will now update as well. Focus is removed in ddc mode so arrow keys won't work then to prevent command spam.

Soggy-Pancake avatar Jul 14 '22 22:07 Soggy-Pancake

@apandada1 can you please check this? Right now I don't have access to an Ubuntu machine 😞

LordAmit avatar Jul 22 '22 17:07 LordAmit

I am travelling, and I will get back in a few days. (Please do send me a reminder if I don't get back within a week.)

archisman-panigrahi avatar Jul 23 '22 01:07 archisman-panigrahi

@apandada1 ping!

LordAmit avatar Aug 07 '22 18:08 LordAmit

@apandada1 Ping!

Soggy-Pancake avatar Aug 21 '22 04:08 Soggy-Pancake

Added the tray icon functionality back and now it shows the display names instead of something useless like DP-2 image

Soggy-Pancake avatar Aug 22 '22 04:08 Soggy-Pancake

Hello everyone, sorry about the delay.

I came to the US recently, and now I have got some free time. I will get back in a few hours.

On Mon, 22 Aug, 2022, 12:54 am Soggy_Pancake, @.***> wrote:

Added the tray icon functionality back and now it shows the display names instead of something useless like DP-2 [image: image] https://user-images.githubusercontent.com/54160598/185842097-025b6d7a-e0ec-4368-b47c-a77367b4ff8f.png

— Reply to this email directly, view it on GitHub https://github.com/LordAmit/Brightness/pull/210#issuecomment-1221821555, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXL2XCSC2CVBZSJMYZIPXLV2MBYBANCNFSM53CM5TOA . You are receiving this because you were mentioned.Message ID: @.***>

archisman-panigrahi avatar Aug 23 '22 22:08 archisman-panigrahi

I am using EndeavourOS KDE (based on Arch Linux) in a laptop (I have not tried attaching an external display yet. However, I have some external displays here, and I will try them in future).

I initially got the error

No /dev/i2c devices exist.
ddcutil requires module i2c-dev.

After entering the command sudo modprobe i2c-dev (which I found here), when I turn on Direct Control, I get the following error (and Brightness Controller crashes immediately).

./init.py 
a
gen sources
[]
True
Traceback (most recent call last):
  File "/home/archisman/Brightness-Direct-Control/src/./init.py", line 313, in directControlUpdate
    self.ui.primary_brightness.setValue(int(round((self.displayValues[0]/self.displayMaxes[0])*100)))
IndexError: list index out of range
Aborted (core dumped)

archisman-panigrahi avatar Aug 24 '22 02:08 archisman-panigrahi

DDCUtil doesn't support laptop monitors but if you want could you try "ddcutil detect"? https://www.ddcutil.com/

Soggy-Pancake avatar Aug 24 '22 08:08 Soggy-Pancake

sudo ddcutil detect
Invalid display
   I2C bus:  /dev/i2c-4
   DRM connector:           card0-eDP-1
   EDID synopsis:
      Mfg id:               BOE - BOE
      Model:                
      Product code:         1671  (0x0687)
      Serial number:        
      Binary serial number: 0 (0x00000000)
      Manufacture year:     2015,  Week: 1
   DDC communication failed
   This is an eDP laptop display. Laptop displays do not support DDC/CI.

I have a desktop around. I will try there.

archisman-panigrahi avatar Aug 24 '22 13:08 archisman-panigrahi

ill make sure to account for that later

Soggy-Pancake avatar Aug 24 '22 15:08 Soggy-Pancake

Now detects laptop displays and disables direct control if all detected monitors are invalid image Still need to get home and test with a working display but it no longer crashes and gives a warning about it

Soggy-Pancake avatar Aug 25 '22 19:08 Soggy-Pancake

Works flawlessly now :D image

Soggy-Pancake avatar Aug 25 '22 22:08 Soggy-Pancake

I went through the code to check and it looks good on a textual level. I don't have a Linux Desktop, so can not really test it out. But hopefully it will work for everyone around 😄 Thank you again, @Soggy-Pancake and @apandada1

LordAmit avatar Sep 10 '22 02:09 LordAmit