xdp-hook

Crates.ioxdp-hook
lib.rsxdp-hook
version0.1.3
sourcesrc
created_at2022-04-09 08:47:33.888832
updated_at2022-04-23 21:12:41.588849
descriptiontrigger user-configured actions when other apps use xdg-desktop-portal ( https://github.com/flatpak/xdg-desktop-portal )
homepagehttps://gitlab.com/jokeyrhyme/xdp-hook-rs
repositoryhttps://gitlab.com/jokeyrhyme/xdp-hook-rs.git
max_upload_size
id564694
size98,147
Ron Waldon-Howe (jokeyrhyme)

documentation

README

xdp-hook-rs Status Gitlab pipeline status Crates.io docs.rs

trigger user-configured actions when other apps use xdg-desktop-portal ( https://github.com/flatpak/xdg-desktop-portal )

what?

  • xdg-desktop-portals are a mechanism built on top of dbus and pipewire, used by Linux apps when direct access to sensitive system capabilities is unavailable (or when explicit user consent is desirable)

  • we can use dbus-monitor to observe the negotiation and usage of such portals, but it doesn't make it convenient to create a bird's-eye view of active sessions, and might not be the easiest way to trigger portal-related automation, etc

  • xdp-hook's purpose is not to offer privacy indicators like those on Android, but rather to make it easier for others to offer such features, by reacting to portal usage and performing user-configured tasks e.g. executing scripts

  • this project depends upon Linux and offers functionality for Linux systems (no support for other environments)

installation

from https://crates.io/ via cargo

configuration

hook environment

when xdp-hook runs a hook that you have configured, it attempts to set certain environment variables to expose more information:

  • XDP_HOOK_APP_ID: the name of the (flatpak app-like) process (if any) that initiated the portal session
  • XDP_HOOK_PROCESS_COMMAND: the name of the process that initiated the portal session
  • XDP_HOOK_PROCESS_ID: the process ID of the process that initiated the portal session

note that these are "best-effort" and might be empty strings when information is unavailable

features/roadmap

  • connect to user's dbus session
  • identify and log out general messages relating to portal requests
  • track open/close for prolonged portal sessions (e.g. Location, ScreenCast, RemoteDesktop)
  • track open/close for prolonged portal sessions (e.g. Inhibit)
  • read configuration file ~/.config/xdp-hook/config.toml
  • perform user-configured tasks upon portal request/session event e.g. executing scripts
  • user-scope systemd unit file for convenient startup
  • properly differentiate between concurrent clients for portals (e.g. both Chrome and Firefox using jitsi): https://gitlab.com/jokeyrhyme/xdp-hook-rs/-/issues/3
  • identify app/process that is initiating the portal request: https://gitlab.com/jokeyrhyme/xdp-hook-rs/-/issues/3
  • identify the portal implementation that handles the portal request (impossible?)

see also

Commit count: 61

cargo fmt