diff options
| author | sommerfeld <sommerfeld@sommerfeld.dev> | 2026-09-22 13:57:08 +0100 |
|---|---|---|
| committer | sommerfeld <sommerfeld@sommerfeld.dev> | 2026-09-22 13:57:08 +0100 |
| commit | d4eddbc4a7b46c9e53fdd47b9feff0c2e75ec8d7 (patch) | |
| tree | d535d38eb24ba1a8d04cae12e5d6bbdc96c3b43a /scripts/mattermost_keyring.py | |
| parent | 1e19a0c7cbb87302bbe7fa6a60ad53738719a095 (diff) | |
| download | dotfiles-d4eddbc4a7b46c9e53fdd47b9feff0c2e75ec8d7.tar.gz dotfiles-d4eddbc4a7b46c9e53fdd47b9feff0c2e75ec8d7.tar.bz2 dotfiles-d4eddbc4a7b46c9e53fdd47b9feff0c2e75ec8d7.zip | |
Permit Mattermost Snap tray communication
Diffstat (limited to 'scripts/mattermost_keyring.py')
| -rw-r--r-- | scripts/mattermost_keyring.py | 48 |
1 files changed, 44 insertions, 4 deletions
diff --git a/scripts/mattermost_keyring.py b/scripts/mattermost_keyring.py index a54ed6d..59bec1b 100644 --- a/scripts/mattermost_keyring.py +++ b/scripts/mattermost_keyring.py @@ -1,4 +1,4 @@ -"""Permit the Mattermost Snap to use the desktop Secret Service.""" +"""Permit the Mattermost Snap to use the desktop keyring and tray.""" import os import re @@ -22,15 +22,55 @@ dbus (receive, send) interface=org.freedesktop.Secret.{Collection,Item,Prompt,Service,Session} peer=(label=unconfined), """ +TRAY_MARKER = "# dotfiles: Mattermost Chromium tray access" +TRAY_RULES = """ +dbus (receive) + bus=session + path=/org/chromium/StatusNotifierItem/[0-9]* + interface=org.freedesktop.DBus.Properties + member=Get{,All} + peer=(label=unconfined), +dbus (send) + bus=session + path=/org/chromium/StatusNotifierItem/[0-9]* + interface=org.freedesktop.DBus.Properties + member=PropertiesChanged + peer=(label=unconfined), +dbus (send) + bus=session + path=/org/chromium/StatusNotifierItem/[0-9]* + interface=org.kde.StatusNotifierItem + member=New* + peer=(label=unconfined), +dbus (receive) + bus=session + path=/org/chromium/StatusNotifierItem/[0-9]* + interface=org.kde.StatusNotifierItem + member={Activate,ContextMenu,Scroll,SecondaryActivate,ProvideXdgActivationToken,XAyatanaSecondaryActivate} + peer=(label=unconfined), +dbus (send) + bus=session + path=/org/chromium/DbusMenu{,/[0-9]*} + interface=com.canonical.dbusmenu + member={LayoutUpdated,ItemsPropertiesUpdated} + peer=(label=unconfined), +dbus (receive) + bus=session + path=/org/chromium/DbusMenu{,/[0-9]*} + interface={org.freedesktop.DBus.Properties,com.canonical.dbusmenu} + member={Get*,AboutTo*,Event*} + peer=(label=unconfined), +""" def patch_profile(text: str) -> str: profiles = re.findall(r'^profile "([^"]+)"', text, re.MULTILINE) if profiles != [PROFILE.name] or not text.rstrip().endswith("}"): raise ValueError("Unexpected Mattermost AppArmor profile format.") - if MARKER in text: - return text - return text.rstrip()[:-1] + MARKER + "\n" + RULES + "}\n" + for marker, rules in [(MARKER, RULES), (TRAY_MARKER, TRAY_RULES)]: + if marker not in text: + text = text.rstrip()[:-1] + marker + "\n" + rules + "}\n" + return text def install_profile(text: str) -> None: |
