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

abi <abi/4.0>,

include <tunables/global>

@{exec_path} = @{bin}/waybar
profile waybar @{exec_path} flags=(attach_disconnected) {
  include <abstractions/base>
  include <abstractions/app-launcher-user>
  include <abstractions/audio-client>
  include <abstractions/dconf-write>
  include <abstractions/desktop>
  include <abstractions/nameservice-strict>

  network inet dgram,
  network inet6 dgram,
  network netlink raw,

  @{exec_path} mr,

  /etc/machine-id r,

  owner @{user_config_dirs}/waybar/{,**} r,

  @{sys}/devices/virtual/dmi/id/bios_vendor r,
  @{sys}/devices/virtual/dmi/id/board_vendor r,
  @{sys}/devices/virtual/dmi/id/product_name r,
  @{sys}/devices/virtual/dmi/id/sys_vendor r,
  @{sys}/devices/system/cpu/present r,

        @{PROC}/@{pid}/net/dev r,
        @{PROC}/spl/kstat/zfs/arcstats r,
  owner @{PROC}/@{pid}/task/@{tid}/comm rw,

  /dev/rfkill r,

  owner /dev/tty@{int} rw,

  include if exists <local/waybar>
}

# vim:syntax=apparmor
