noctalia-shell icon indicating copy to clipboard operation
noctalia-shell copied to clipboard

Brightness Control Doesnt Work On Hybrid Intel/Nvidia Laptop

Open CruScanlan opened this issue 1 year ago • 6 comments

Description

I am running Noctalia Shell on NixOS using a hybrid intel/nvidia based laptop. When changing brightness, the slider movies and the brightness number changes but the screen brightness of my display does not.

Steps to Reproduce

  1. Go to brightness tab
  2. Move brightness slider

Expected Behavior

Screen brightness should change

Screenshots

Environment

  • Distro: NixOS
  • Compositor: Hyprland
  • Noctalia-shell Version: v3.5.0-git

Additional Context

From what I can tell, noctalia is only changing the brightness of the first found brightness control device. I have fixed this on my own NixOS machine by making a wrapper that passes the brightness control through to both devices.

This is my brightness.nix config which solves this on my machine but there may be a better solution.

{ pkgs, ... }: 
let
  # Wrapper for brightnessctl that defaults to intel_backlight and changes both devices
  brightnessctl-hybrid = pkgs.writeShellScriptBin "brightnessctl" ''
    # Wrapper for brightnessctl on hybrid laptops
    # Always use intel_backlight unless -d is specified
    # This ensures noctalia-shell uses the correct backlight
    
    if [[ "$*" == *"-d"* ]]; then
      # User specified device, pass through
      exec ${pkgs.brightnessctl}/bin/brightnessctl "$@"
    else
      # No device specified, use intel_backlight and mirror to nvidia_0
      ${pkgs.brightnessctl}/bin/brightnessctl -d intel_backlight "$@"
      # Also set nvidia_0 to keep them in sync
      ${pkgs.brightnessctl}/bin/brightnessctl -d nvidia_0 "$@" 2>/dev/null || true
    fi
  '';
in
{
  # Override brightnessctl package with our wrapper by placing it earlier in PATH
  environment.systemPackages = with pkgs; [
    (lib.hiPrio brightnessctl-hybrid)  # Higher priority than regular brightnessctl
  ];
  
  # Allow users in video group to control backlight
  hardware.brillo.enable = true;
  
  # Set proper permissions on backlight devices for video group
  services.udev.extraRules = ''
    ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="intel_backlight", RUN+="${pkgs.coreutils}/bin/chmod 0666 /sys/class/backlight/%k/brightness"
    ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="nvidia_0", RUN+="${pkgs.coreutils}/bin/chmod 0666 /sys/class/backlight/%k/brightness"
    ACTION=="change", SUBSYSTEM=="backlight", KERNEL=="intel_backlight", RUN+="${pkgs.coreutils}/bin/chmod 0666 /sys/class/backlight/%k/brightness"
    ACTION=="change", SUBSYSTEM=="backlight", KERNEL=="nvidia_0", RUN+="${pkgs.coreutils}/bin/chmod 0666 /sys/class/backlight/%k/brightness"
  '';
}```

CruScanlan avatar Dec 02 '25 22:12 CruScanlan

We are looking for someone to contribute a PR as we dont have the hardware to test on.

ItsLemmy avatar Dec 03 '25 01:12 ItsLemmy

I would be happy to contribute a PR for it. What do you think of my solution, passing the brightness control through to both devices?

CruScanlan avatar Dec 03 '25 02:12 CruScanlan

It's not a bug , it's NVIDIA's faults . You can try to add acpi_backlight=native in /etc/default/grub , just like GRUB_CMDLINE_LINUX="zswap.enabled=0 rootfstype=btrfs acpi_backlight=native" .

baizhu945 avatar Dec 10 '25 13:12 baizhu945

there is aur package called light that work for my hybrid laptop with nvidia and amd you can add it as a dependency for hybrid laptops and use it in brightness service

shin01221 avatar Dec 18 '25 18:12 shin01221

also this is how i fixed it for my laptop

  • addamdgpu.backlight=0 kernal parameter in grub file located at /etc/default
  • rebuild grub
  • add backlight.rules file at /etc/udev/rules.d these are the file content: ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="amdgpu_bl0", RUN+="/bin/chgrp video /sys/class/backlight/amdgpu_bl0/brightness" ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="amdgpu_bl0", RUN+="/bin/chmod g+w /sys/class/backlight/amdgpu_bl0/brightness"

not sure if the udev rules are needed also this should work for hybrid with amd only

shin01221 avatar Dec 18 '25 18:12 shin01221

I'll close this one since this is not something that is in scope of noctalia-shell currently, if anyone can ever come up with a proper solution, we're all for it though.

Ly-sec avatar Feb 15 '26 14:02 Ly-sec