# vim:syntax=apparmor
# ------------------------------------------------------------------
#
#    Copyright (C) 2016 Canonical Ltd.
#
#    This program is free software; you can redistribute it and/or
#    modify it under the terms of version 2 of the GNU General Public
#    License published by the Free Software Foundation.
#
# ------------------------------------------------------------------

  abi <abi/4.0>,

  include <abstractions/dbus-session-strict>

  dbus send
      bus=fcitx
      path=/org/freedesktop/DBus
      interface=org.freedesktop.DBus
      member={Hello,AddMatch,RemoveMatch,GetNameOwner,NameHasOwner,StartServiceByName}
      peer=(name=org.freedesktop.DBus),

  owner @{HOME}/.config/fcitx/dbus/* r,

  # Allow access to the Fcitx portal, supported by fcitx/fcitx5
  dbus (send)
      bus=session
      path=/{,org/freedesktop/portal/}inputmethod
      interface=org.fcitx.Fcitx.InputMethod1
      member={CreateInputContext,Version}
      peer=(name=org.freedesktop.portal.Fcitx),

  dbus (send, receive)
      bus=session
      path=/{,org/freedesktop/portal/}inputcontext/**
      interface=org.fcitx.Fcitx.InputContext1,

  # Include additions to the abstraction
  include if exists <abstractions/fcitx-strict.d>
