canonical / xdg_desktop_portal.dart

Mozilla Public License 2.0
12 stars 6 forks source link

Implement MemoryMonitor portal #11

Open robert-ancell opened 2 years ago

robert-ancell commented 2 years ago

https://flatpak.github.io/xdg-desktop-portal/#gdbus-org.freedesktop.portal.MemoryMonitor

aospiridonov commented 2 years ago

How should it work? I started doing in my repository (branch: memory-monitor), but I can't get the LowMemoryMonitor signal. Could you explain to me how I should do it?

robert-ancell commented 2 years ago

This portal should just contain a stream that listens to the "LowMemoryWarning" signal. This is basically:

return DBusRemoteObjectSignalStream(
        object: _object,
        interface: 'org.freedesktop.portal.MemoryMonitor',
        name: 'LowMemoryWarning',
        signature: DBusSignature('y')).map((signal) => signal.values[0].asByte());