Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Screenshare indicator module (or even privacy indicator) #1776

Closed
ErikReider opened this issue Nov 7, 2022 · 4 comments · Fixed by #2612
Closed

Screenshare indicator module (or even privacy indicator) #1776

ErikReider opened this issue Nov 7, 2022 · 4 comments · Fixed by #2612
Labels
enhancement New feature or request

Comments

@ErikReider
Copy link
Contributor

ErikReider commented Nov 7, 2022

I'd add this myself but I'm completely clueless on how this could be done.

Help is very appreciated! :)

Going through the output of pw-dump command and looking for any node with "media.class": "Stream/Input/Video" looks promising until I realized that it appeared when the camera was used (which also would be a neat addition).

I've narrowed it down to these interfaces:

  {
    "id": 120,
    "type": "PipeWire:Interface:Client",
    "version": 3,
    "permissions": [ "r", "w", "x", "m" ],
    "info": {
      "change-mask": [ "props" ],
      "props": {
        "pipewire.protocol": "protocol-native",
        "pipewire.sec.pid": 2024,
        "pipewire.sec.uid": 1000,
        "pipewire.sec.gid": 1000,
        "pipewire.sec.label": "hex:69000000000000008255b1e1887f0000f073dc8de155000000000000000000003967b3e1887f0000e044b3e1887f000069000000000000002362b1e1887f000002000000e1550000000000000e00000000000000000000000e00000000000000a08b6de2887f0000002cf46ad7f00b820400000004000000000000000000000098010000000000002ad6b2e1887f00000000000000000000002cf46ad7f00b82f00bb58de1550000f00bb58de1550000000000000000000018f3b2e1887f0000e044b3e1887f0000716db1e1887f000069000000000000002362b1e10e00000000000000000000008255b1e10e000000f00bb58de155000000000000000000003967b3e1887f0000000000000000000069000000000000000000000000000000c84ddc8de15500002853dc8d0e00000000000000010000000100000000000000040000000400000079000000000000003000000030000000308ecfb6fe7f0000e08ccfb6fe7f0000002cf46ad7f00b82f08ccfb6fe7f0000c0e5b48de1550000c80200000000000020ebb48de155000068e7b48de15500008255b1e1887f0000f00bb58de155000000000000000000003967b3e1887f0000e044b3e1887f000069000000000000002362b1e1887f00000000000000000000000000000e0000000000000000000000002cf46ad7f00b820000000000000000c0e5b48de1550000f00bb58de1550000000000000000000068e7b48de1550000da59b1e1887f000050fb078ee155000004000000e15500000400000004000000f123004000000000f00bb58de155000000000000000000003000000030000000d08ecfb6fe7f0000e08dcfb6fe7f0000002cf46ad7f00b820000000000000000c0e5b48de1550000280000000000000020ebb48de155000068e7b48de155000028ebb48de1550000cb54004000000000f8d0b2e1887f0000c8e7b48de155000028ebb48de15500000000000000000000002cf46ad7f00b82000000000000000020ebb48de155000010000000000000008a9c60e2887f0000c08ecfb6fe7f0000200000004000004020ebb48de155000028c0b2e1887f000068e7b48de1550000aa8060e2887f0000700cb68de1550000f00bb58d01000000c08ecfb6fe7f000020000000fffffffff00bb58de155000069e67ee2887f0000010000005064ae8de1550000887f0000008fcfb6fe7f00000803000000000000208fcfb6fe7f0000800000004040000040000040000000004fc8b2e1887f0000b0fbb48de1550000b0fbb48de1550000000000000000000020ebb48de155000000000000000000000000000000000000608fcfb6fe7f00000100000000000000000000000000000000000000000000000000000000000000f1230040000000002061d48de15500000803000000000000",
        "module.id": 2,
        "object.id": 120,
        "object.serial": 872,
        "pipewire.access.portal.app_id": "org.mozilla.firefox",
        "pipewire.access.portal.media_roles": "",
        "log.level": 0,
        "cpu.max-align": 32,
        "default.clock.rate": 48000,
        "default.clock.quantum": 1024,
        "default.clock.min-quantum": 32,
        "default.clock.max-quantum": 8192,
        "default.clock.quantum-limit": 8192,
        "default.video.width": 640,
        "default.video.height": 480,
        "default.video.rate.num": 25,
        "default.video.rate.denom": 1,
        "clock.power-of-two-quantum": true,
        "link.max-buffers": 64,
        "mem.warn-mlock": false,
        "mem.allow-mlock": true,
        "settings.check-quantum": false,
        "settings.check-rate": false,
        "application.name": "firefox-bin",
        "application.process.binary": "firefox-bin",
        "application.language": "en_US.UTF-8",
        "application.process.id": 2,
        "application.process.user": "erikreider",
        "application.process.host": "Erik-Arch-Desktop",
        "window.x11.display": ":0",
        "core.version": "0.3.35",
        "core.name": "pipewire-erikreider-2",
        "pipewire.access": "portal",
        "default.clock.allowed-rates": "[ 48000 ]",
        "application.process.session-id": 3
      }
    }
  },
  {
    "id": 122,
    "type": "PipeWire:Interface:Node",
    "version": 3,
    "permissions": [ "r", "w", "x", "m" ],
    "info": {
      "max-input-ports": 1,
      "max-output-ports": 0,
      "change-mask": [ "input-ports", "output-ports", "state", "props", "params" ],
      "n-input-ports": 1,
      "n-output-ports": 0,
      "state": "running",
      "error": null,
      "props": {
        "pipewire.client.reuse": 1,
        "media.name": "webrtc-consume-stream",
        "stream.is-live": true,
        "node.name": "firefox-bin",
        "node.target": 121,
        "node.autoconnect": true,
        "media.class": "Stream/Input/Video",
        "client.id": 120,
        "object.id": 122,
        "object.serial": 873
      },
      "params": {
        "Props": [ ]
      }
    }
  },
  {
    "id": 119,
    "type": "PipeWire:Interface:Port",
    "version": 3,
    "permissions": [ "r", "w", "x", "m" ],
    "info": {
      "direction": "input",
      "change-mask": [ "props", "params" ],
      "props": {
        "port.id": 0,
        "port.direction": "in",
        "port.name": "in_0",
        "port.alias": "firefox-bin:in_0",
        "node.id": 122,
        "object.id": 119,
        "object.serial": 874
      },
      "params": {
        "EnumFormat": [
          {
            "mediaType": "video",
            "mediaSubtype": "raw",
            "format": {
              "default": "BGRx",
              "alt1": "RGBx",
              "alt2": "RGBA",
              "alt3": "BGRx",
              "alt4": "BGRA"
            },
            "size": { "default": { "width": 1, "height": 1 }, "min": { "width": 1, "height": 1 }, "max": { "width": 4294967295, "height": 4294967295 } }
          }
        ],
        "Meta": [
          {
            "type": "Busy",
            "size": 8
          },
          {
            "type": "Header",
            "size": 32
          },
          {
            "type": "VideoCrop",
            "size": 16
          }
        ],
        "IO": [
          {
            "id": "Buffers",
            "size": 8
          }
        ],
        "Format": [
          {
            "mediaType": "video",
            "mediaSubtype": "raw",
            "format": "RGBx",
            "size": { "width": 2560, "height": 1440 },
            "framerate": { "num": 0, "denom": 1 },
            "maxFramerate": { "num": 60, "denom": 1 }
          }
        ],
        "Buffers": [
          {
            "dataType": {
              "default": 6
            },
            "size": 14745600,
            "stride": 10240,
            "buffers": { "default": 8, "min": 1, "max": 32 }
          }
        ],
        "Latency": [ ]
      }
    }
  },

It would also be nice to be able to see when legacy X11 applications capture other X11 windows and help with this would also be very much appreciated. :)

If this were to be a Privacy Indicator, the microphone side of it would be pretty "easy" on my part due to SwayAudioIdleInhibit. A location indicator could be possible with Geoclue i guess?

@Alexays Alexays added the enhancement New feature or request label Nov 24, 2022
@BoomerangNebula
Copy link

"media.name": "webrtc-consume-stream" jumps off the page.

https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API

@anarcat
Copy link

anarcat commented Aug 30, 2023

I believe this has become more urgent now that Firefox has removed its own sharing indicator, see:

https://floss.social/@rmader/110753816659396916

and:

https://bugzilla.mozilla.org/show_bug.cgi?id=1628431#c27

@hvhaugwitz
Copy link

FWIW I use the following command to get a sharing indication:

pw-dump | jq -r 'map(.info?.props?) | map(select(.["media.name"]? == "webrtc-consume-stream")) | map(.["stream.is-live"]? == true | "LIVE") | .[]?'

The output is LIVE if a screen is shared and empty otherwise.

@ErikReider
Copy link
Contributor Author

FWIW I use the following command to get a sharing indication:

pw-dump | jq -r 'map(.info?.props?) | map(select(.["media.name"]? == "webrtc-consume-stream")) | map(.["stream.is-live"]? == true | "LIVE") | .[]?'

The output is LIVE if a screen is shared and empty otherwise.

Thanks! This seems to work better:
pw-dump | jq -r 'map(.info?.props?) | map(select(.["node.name"]? == "xdg-desktop-portal-wlr")) | map(.["stream.is-live"]? == true | "LIVE") | .[]?'

@ErikReider ErikReider mentioned this issue Oct 26, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants