end-4 / dots-hyprland

i hate minimalism so...
https://end-4.github.io/dots-hyprland-wiki/en/
GNU General Public License v3.0
3.71k stars 255 forks source link

Add config for brightness control #335

Closed jsl9208 closed 3 months ago

jsl9208 commented 5 months ago

Hi, thank you for your awesome project! I've encountered two issues while using it on my ASUS G14 laptop:

  1. The default brightnessCtl command controls the wrong device, so I need to pass -d amdgpu_bl1 to make it work correctly.
  2. The G14 uses an OLED display. I inadvertently set the brightness to 0 several times, rendering it totally unusable. I think it would be better to have a brightness configuration to prevent this situation from happening again.

I have added some configuration to solve these problems, brightness.device and brightness.minPercent.

clsty commented 5 months ago

While I do appreciate this work, I also personally suggest to consider about ddc control.

Modern monitors support DDC protocol, so when they are connected with computers via DP or HDMI, they can be controlled via DDC. brightnessctl however does not support it currently.

Basically we can use ddcutil to do this, but it requires specifying the device and is not automatic.

A better solution will be clightd, which provides a dbus interface to control all backlights, including the normal ones (which brightnessctl does) and the DDC ones (normally the connected monitors via DP or HDMI cable).

A script to use clightd to control brightness: https://github.com/clsty/dots-hyprarch/blob/main/.local/bin/clightctl

Usage example in keybinds.conf:

bindle = , XF86MonBrightnessUp, exec, ~/.local/bin/clightctl backlight r
bindle = , XF86MonBrightnessDown, exec, ~/.local/bin/clightctl backlight l

The dependency is available as an AUR package "clightd".


Ok, wait, I've found this in the repo of brightnessctl:

Use the ddcci-driver-linux kernel module to expose external monitor brightness controls to brightnessctl. Available in repositories of AUR, Debian, Nix, Ubuntu, Void.

Tested, after installing ddcci-driver-linux and reboot system and modprobe, brightnessctl only works for one of my 2 monitors, while clightd works for both.

jsl9208 commented 5 months ago

Thank you for the advice. I don't use an external monitor, just the internal one.

I believe the issue is that my laptop has two GPU devices, an integrated one and an Nvidia dGPU. Both of them can handle the display output by switching to different modes (Optimus, Integrated, etc.). These tools are unable to determine which device is in use.

In my case, the default device is Nvidia for most of the tools. I have tested brightnessCtl, clightd, and brillo. Only brillo has the feature to detect the in-use device automatically and it worked correctly.

I think it's too heavy and complicated to use the vendor-specific tool to determine which mode the system is currently in, and then choose the correct device to control. An additional config is better for most cases. But perhaps using brillo is the best approach?

Zeps2369 commented 5 months ago

Thank you for the advice. I don't use an external monitor, just the internal one.

I believe the issue is that my laptop has two GPU devices, an integrated one and an Nvidia dGPU. Both of them can handle the display output by switching to different modes (Optimus, Integrated, etc.). These tools are unable to determine which device is in use.

In my case, the default device is Nvidia for most of the tools. I have tested brightnessCtl, clightd, and brillo. Only brillo has the feature to detect the in-use device automatically and it worked correctly.

I think it's too heavy and complicated to use the vendor-specific tool to determine which mode the system is currently in, and then choose the correct device to control. An additional config is better for most cases. But perhaps using brillo is the best approach?

Hi. Im having the same isues using the g14 2024 model. Can you explain how you fixed it using brillo in detail please :)

jsl9208 commented 5 months ago

Thank you for the advice. I don't use an external monitor, just the internal one. I believe the issue is that my laptop has two GPU devices, an integrated one and an Nvidia dGPU. Both of them can handle the display output by switching to different modes (Optimus, Integrated, etc.). These tools are unable to determine which device is in use. In my case, the default device is Nvidia for most of the tools. I have tested brightnessCtl, clightd, and brillo. Only brillo has the feature to detect the in-use device automatically and it worked correctly. I think it's too heavy and complicated to use the vendor-specific tool to determine which mode the system is currently in, and then choose the correct device to control. An additional config is better for most cases. But perhaps using brillo is the best approach?

Hi. Im having the same isues using the g14 2024 model. Can you explain how you fixed it using brillo in detail please :)

just install brillo, then brillo -S 20%

Zeps2369 commented 5 months ago

Thank you for the advice. I don't use an external monitor, just the internal one. I believe the issue is that my laptop has two GPU devices, an integrated one and an Nvidia dGPU. Both of them can handle the display output by switching to different modes (Optimus, Integrated, etc.). These tools are unable to determine which device is in use. In my case, the default device is Nvidia for most of the tools. I have tested brightnessCtl, clightd, and brillo. Only brillo has the feature to detect the in-use device automatically and it worked correctly. I think it's too heavy and complicated to use the vendor-specific tool to determine which mode the system is currently in, and then choose the correct device to control. An additional config is better for most cases. But perhaps using brillo is the best approach?

Hi. Im having the same isues using the g14 2024 model. Can you explain how you fixed it using brillo in detail please :)

just install brillo, then brillo -S 20%

what is your solution for keyboard backlight?

jsl9208 commented 5 months ago

Thank you for the advice. I don't use an external monitor, just the internal one. I believe the issue is that my laptop has two GPU devices, an integrated one and an Nvidia dGPU. Both of them can handle the display output by switching to different modes (Optimus, Integrated, etc.). These tools are unable to determine which device is in use. In my case, the default device is Nvidia for most of the tools. I have tested brightnessCtl, clightd, and brillo. Only brillo has the feature to detect the in-use device automatically and it worked correctly. I think it's too heavy and complicated to use the vendor-specific tool to determine which mode the system is currently in, and then choose the correct device to control. An additional config is better for most cases. But perhaps using brillo is the best approach?

Hi. Im having the same isues using the g14 2024 model. Can you explain how you fixed it using brillo in detail please :)

just install brillo, then brillo -S 20%

what is your solution for keyboard backlight?

As far I am only able to switch it on/off using asusctl asusctl led-pow-2 keyboard