LordAmit / Brightness

Using Brightness Controller, you can control brightness of both primary and external displays in Linux. Check it out!
Other
1.06k stars 86 forks source link

Added direct control of monitor backlight using ddcutil #210

Closed Soggy-Pancake closed 2 years ago

Soggy-Pancake commented 2 years ago

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.

LordAmit commented 2 years ago

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

archisman-panigrahi commented 2 years ago

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 commented 2 years ago

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?

Soggy-Pancake commented 2 years ago

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

Soggy-Pancake commented 2 years ago

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.

LordAmit commented 2 years ago

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

archisman-panigrahi commented 2 years ago

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.)

LordAmit commented 2 years ago

@apandada1 ping!

Soggy-Pancake commented 2 years ago

@apandada1 Ping!

Soggy-Pancake commented 2 years ago

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

archisman-panigrahi commented 2 years ago

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 commented 2 years ago

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)
Soggy-Pancake commented 2 years ago

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

archisman-panigrahi commented 2 years ago
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.

Soggy-Pancake commented 2 years ago

ill make sure to account for that later

Soggy-Pancake commented 2 years ago

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 commented 2 years ago

Works flawlessly now :D image

LordAmit commented 2 years ago

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