- cross-posted to:
- rust
- cross-posted to:
- rust
I’d like to share a side-project that I finally got to a minimally-useful state this weekend, in case others find it useful
Repository: https://gitlab.com/jokeyrhyme/xdp-hook-rs
Features (as of 0.1.2):
- monitors Location, ScreenCast, and RemoteDesktop portal sessions
- triggers configured scripts/command when these sessions are created/closed
Example use case:
- I’m using
eww
as my status bar across the top of my screen - I wanted to show/hide indicators whenever an application was using the ScreenCast portal (e.g. https://meet.jit.si/ or Zoom, or Teams, or whatever)
- so I’m using
xdp-hook
to detect when any application creates a ScreenCast session, and update the state ineww
accordingly so that a blinking widget is displayed/removed
Suggestions and code contributions are welcome :)
Ooh that’s nice ! Didn’t read the code but could it support generic hooks so that you can catch all portal events to “profile” whatever certain flatpak app is doing?
So far, from what I’ve learned about dbus and xdg-desktop-portal messages, we could definitely have catch-all hooks like that ( https://gitlab.com/jokeyrhyme/xdp-hook-rs/-/issues/2 )
What’s not clear to me yet, however, is how i can trace the ownership of such messages back to the processes that initiated them
dbus sender/receiver IDs are just arbitrary text, and don’t seem to have a reliable relationship with the caller
I do have this on my roadmap though ( https://gitlab.com/jokeyrhyme/xdp-hook-rs#roadmap )
I’m not familiar with dbus, but i had a quick look. I don’t know the difference between a bus and a connection, btu apparently:
Not sure if the latter would accept the result from the former as a valid parameter, but this SO thread suggested so.
I’ve raised https://gitlab.com/jokeyrhyme/xdp-hook-rs/-/issues/3
Oh, nice
And it looks like the “zbus” library that I’m using exposes the equivalent functionality: https://docs.rs/zbus/2.1.1/zbus/fdo/struct.DBusProxy.html#method.get_connection_unix_process_id