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

abi <abi/3.0>,

include <tunables/global>

@{exec_path} = @{bin}/kcminit
profile kcminit @{exec_path} {
  include <abstractions/base>
  include <abstractions/bus-session>
  include <abstractions/gtk>
  include <abstractions/kde-strict>

  @{exec_path} mr,

  @{bin}/xrdb      rPx,
  @{bin}/xsetroot  rPx,

  /etc/machine-id r,
  /etc/xdg/kcmdisplayrc r,

  owner @{HOME}/.Xdefaults r,

  owner @{user_config_dirs}/#@{int} rw,
  owner @{user_config_dirs}/gtkrc-2.0{,.@{rand6}} rwl,
  owner @{user_config_dirs}/gtkrc{,.@{rand6}} rwl,
  owner @{user_config_dirs}/kgammarc r,
  owner @{user_config_dirs}/touchpadrc r,
  owner @{user_config_dirs}/touchpadxlibinputrc r,
  owner @{user_config_dirs}/Trolltech.conf.lock rwk,
  owner @{user_config_dirs}/Trolltech.conf{,.@{rand6}} rwl,

  owner @{tmp}/#@{int} rw,
  owner @{tmp}/kcminit.@{rand6} rwl,

  owner @{tmp}/.touchpaddefaults wl,
  owner @{tmp}/.touchpaddefaults.lock rwk,

  @{run}/user/@{uid}/xauth_@{rand6} rl,

  @{PROC}/sys/kernel/random/boot_id r,

  /dev/tty r,

  include if exists <local/kcminit>
}

# vim:syntax=apparmor
