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 …

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 in eww 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?

@jokeyrhyme@lemmy.ml
creator
link
fedilink
23Y

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.

@jokeyrhyme@lemmy.ml
creator
link
fedilink
03Y

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

Is there a good intro document for xdg coding?#

@jokeyrhyme@lemmy.ml
creator
link
fedilink
03Y

Start with the home page: https://www.freedesktop.org/wiki/Software/dbus/

There are a few “introduction” resources and an FAQ linked there that seem like a good start

The “dbus” part is really the hard part of working with xdg-desktop-portal, at least in my own experience

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

  • Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
  • No misinformation
  • No NSFW content
  • No hate speech, bigotry, etc

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

  • 0 users online
  • 5 users / day
  • 20 users / week
  • 27 users / month
  • 16 users / 6 months
  • 20 subscribers
  • 684 Posts
  • 1.7K Comments
  • Modlog