# 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}/startxfce4
profile startxfce @{exec_path} {
  include <abstractions/base>
  include <abstractions/consoles>
  include <abstractions/X-strict>

  @{exec_path} mr,

  @{sh_path}    rix,
  @{bin}/cat    rix,
  @{bin}/mkdir  rix,
  @{bin}/id     rix,

  @{bin}/xfce4-session                       rPx,
  @{bin}/xrdb                                rPx,
  @{bin}/systemctl                           rCx -> systemctl,
  @{bin}/dbus-update-activation-environment  rCx -> dbus,

  /etc/X11/xinit/xinitrc.d/{,**} r,
  /etc/xdg/xfce4/{,**} r,

  profile systemctl flags=(attach_disconnected) {
    include <abstractions/base>
    include <abstractions/app/systemctl>

    include if exists <local/startxfce_systemctl>
  }

  profile dbus {
    include <abstractions/base>

    @{bin}/dbus-update-activation-environment mr,

    owner @{HOME}/.xsession-errors w,

    include if exists <local/startxfce_dbus>
  }

  include if exists <local/startxfce>
}

# vim:syntax=apparmor
