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

abi <abi/3.0>,

include <tunables/global>

@{exec_path} = @{bin}/im-launch
profile im-launch @{exec_path} {
  include <abstractions/base>

  @{exec_path} mr,

  @{sh_path}                   rix,
  @{bin}/dpkg-query            rpx,
  @{bin}/env                   rix,
  @{bin}/gettext{,.sh}         rix,
  @{bin}/gnome-session         rix,
  @{bin}/gsettings             rPx,
  @{bin}/locale                rix,
  @{bin}/sed                   rix,
  @{bin}/sleep                 rix,
  @{bin}/startplasma-x11       rPx,
  @{bin}/true                  rix,
  @{bin}/uim-toolbar-gtk3     rPUx,
  @{bin}/uim-xim              rPUx,
  @{lib}/gnome-session-binary  rPx,

  @{HOME}/.xsession-errors rw,
  /usr/share/im-config/{,**} r,

  /etc/default/im-config r,
  /etc/X11/xinit/xinputrc r,
  /etc/X11/Xsession.d/70im-config_launch r,

  owner @{HOME}/.xinputrc r,

  owner /dev/tty@{int} rw,

  include if exists <local/im-launch>
}

# vim:syntax=apparmor
