Skip to content

Instantly share code, notes, and snippets.

@nate-moo
Last active April 2, 2024 22:55
Show Gist options
  • Save nate-moo/c9d9db08c56f6389e1c12126bd47d360 to your computer and use it in GitHub Desktop.
Save nate-moo/c9d9db08c56f6389e1c12126bd47d360 to your computer and use it in GitHub Desktop.
Screensharing full screen on discord under wayland

warning: Very cursed

image

things required:

  • wf-recorder
  • mpv
  • wayland

steps:

  1. have multiple workspaces
  2. go into a workspace dedicated for workaround
  3. open 2 terminals
  4. in one terminal type this command: wf-recorder --muxer=mpegts --codec=libx264 --file=udp://0.0.0.0:1111
  5. in other terminal type this command: mpv -vo=xv udp://0.0.0.0:1111 --no-cache --untimed --no-demuxer-thread --video-sync=audio --vd-lavc-threads=1
  6. in discord select the mpv window for screen sharing
  7. profit $$$

Why this works?

well its kinda dumb but since discord runs in xwayland mode instead of native wayland it can only screenshare xwayland apps, so we have to run mpv in x11 mode for discord to see it and we capture the wayland screen using wf-recorder and output that to a udp uri, add a bunch of latency crap to mpv to lower it and voila you have a working wayland screen viewer!

@dudebloke
Copy link

I'm getting the error "compositor doesn't support wlr-screencopy-unstable-v1"

@nate-moo
Copy link
Author

the compositor doesn't support wlr-screencopy-unstable-v1, get a different version, just read the error next time

@nate-moo
Copy link
Author

-vo=xv

You shouldn't use this vo, it's deprecated and only intended for old potato PCs. Use --gpu-context=x11vk or --gpu-context=x11egl instead for x11 vulkan or x11 opengl respectively.

You should also instead use tools like xwaylandvideobridge instead.

good to know, this was made over a year ago, so I wouldn't necessarily advise using this anymore especially if there is a much better way of doing it now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment