abi <abi/4.0>,

include <tunables/global>

profile plasmashell /usr/bin/plasmashell flags=(attach_disconnected.path=/att/plasmashell/ mediate_deleted) {
  include <abstractions/dbus-session>

  capability,
  userns,
  network,
  dbus,
  mount,
  umount,
  remount,
  signal,
  mqueue,
  unix,
  ptrace,

  # allow executing QtWebEngineProcess with full permissions including userns (using profile stacking to avoid no_new_privs issues)
  priority=1 /usr/lib{,64,exec}/{,@{multiarch}/}qt{,5,6}/{,libexec/}QtWebEngineProcess cx -> &plasmashell//QtWebEngineProcess,

  # allow to execute all other programs under their own profile, or to run unconfined
  /** pux,

  /{,**} mrwlk,

  # even if it's covered by the very generous rules above... (to document the disconnected path)
  /att/plasmashell/systemd/journal/socket w,

  profile QtWebEngineProcess {
    capability,
    userns,
    network,
    dbus,
    mount,
    umount,
    remount,
    signal,
    mqueue,
    unix,
    ptrace,
    /** pux,
    /{,**} mrwlk,
  }

  # Site-specific additions and overrides.  See local/README for details.
  include if exists <local/plasmashell>
}
