Enumerate available screens in Tauri / with Rust

94 Views Asked by At

I'm considering migrating our existing electron application to Tauri.

We're not using any fancy features, except for one where I'm not sure if/how it can be achieved in Tauri (or with a plugin written in Rust): We need to enumerate all available screens. Today we are doing this with electron's desktopCapturer.getSources(...).

Is there a similar feature in Tauri? Or does Rust support this, so we can write a Rust plugin for Tauri?

Note that the resulting screen objects must contain an id which is compatible with Chrome's getUserMedia(...):

const stream = await navigator.mediaDevices.getUserMedia({
  audio: false,
  video: {
    mandatory: {
      chromeMediaSource: 'desktop',
      chromeMediaSourceId: SCREEN_ID_FROM_LIST_OF_ENUMERATED_SCREENS
    }
  }
0

There are 0 best solutions below