# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only

abi <abi/4.0>,

include <tunables/global>

@{exec_path} = @{bin}/xfpm-power-backlight-helper
@{att} = ""
profile xfpm-power-backlight-helper /{,usr/}bin/xfpm-power-backlight-helper flags=(complain) {
  include <abstractions/base-strict>
  include <abstractions/xfce>

  @{exec_path} mr,

  @{sys}/class/backlight/ r,
  @{sys}/class/leds/ r,
  @{sys}/devices/@{pci}/backlight/**/{,max_,actual_}brightness rw,
  @{sys}/devices/@{pci}/backlight/**/{uevent,type,enabled} r,
  @{sys}/devices/@{pci}/backlight/**/brightness rw,
  @{sys}/devices/@{pci}/drm/card@{int}/**/{,max_,actual_}brightness rw,
  @{sys}/devices/@{pci}/drm/card@{int}/**/{uevent,type,enabled} r,
  @{sys}/devices/@{pci}/drm/card@{int}/**/brightness rw,
  @{sys}/devices/@{pci}/*_backlight/{,max_,actual_}brightness rw,
  @{sys}/devices/@{pci}/*_backlight/{uevent,type,enabled} r,

  include if exists <local/xfpm-power-backlight-helper>
}

# vim:syntax=apparmor
