# 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}/plasma-emojier
@{att} = ""
profile plasma-emojier /{,usr/}bin/plasma-emojier flags=(complain) {
  include <abstractions/base-strict>
  include <abstractions/graphics>
  include <abstractions/kde-strict>
  include <abstractions/nameservice-strict>

  @{exec_path} mr,

  /usr/share/plasma/emoji/*.dict r,

  owner @{user_cache_dirs}/qtshadercache-@{arch}-little_endian-lp64/@{hex38}@{int2} rwk,
  owner @{user_cache_dirs}/plasma.emojier/ rw,
  owner @{user_cache_dirs}/plasma.emojier/** rwlk,

  owner @{user_config_dirs}/plasma.emojierrc rwl -> @{user_config_dirs}/#@{int},
  owner @{user_config_dirs}/plasma.emojierrc.lock rwk,

  owner @{user_state_dirs}/plasma.emojierstaterc rw,
  owner @{user_state_dirs}/plasma.emojierstaterc.lock rwk,
  owner @{user_state_dirs}/plasma.emojierstaterc.@{rand6} rwk,

  owner @{user_state_dirs}/plasma.emojierstaterc.@{rand6} rwlk -> @{user_state_dirs}/#@{int},

  include if exists <local/plasma-emojier>
}

# vim:syntax=apparmor
