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

abi <abi/3.0>,

include <tunables/global>

@{exec_path} = @{bin}/qt5ct
profile qt5ct @{exec_path} {
  include <abstractions/base>
  include <abstractions/base>
  include <abstractions/gtk>
  include <abstractions/fonts>
  include <abstractions/fontconfig-cache-read>
  include <abstractions/freedesktop.org>
  include <abstractions/dri-common>
  include <abstractions/dri-enumerate>
  include <abstractions/mesa>
  include <abstractions/qt5-compose-cache-write>
  include <abstractions/nameservice-strict>

  @{exec_path} mr,

  owner @{user_config_dirs}/qt5ct/ rw,
  owner @{user_config_dirs}/qt5ct/** rwkl -> @{user_config_dirs}/qt5ct/#@{int},

  owner @{user_config_dirs}/fontconfig/ rw,
  owner @{user_config_dirs}/fontconfig/** rw,
  owner @{user_config_dirs}/fontconfig/fonts.conf.back rwl -> @{user_config_dirs}/fontconfig/#@{int},

  owner @{user_config_dirs}/kdeglobals r,

  owner @{user_cache_dirs}/ rw,
  owner @{user_cache_dirs}/icon-cache.kcache rw,

  /usr/share/qt5ct/** r,

  /usr/share/xsessions/{,*.desktop} r,

  owner @{PROC}/@{pid}/cmdline r,
        @{PROC}//sys/kernel/random/boot_id r,

  /etc/X11/cursors/*.theme r,

  /etc/machine-id r,
  /var/lib/dbus/machine-id r,

  /usr/share/hwdata/pnp.ids r,

  /dev/shm/#@{int} rw,

  include if exists <local/qt5ct>
}
