-
-
Save eigenpaul/e1e5d136ff822e3c4ade47d07f654799 to your computer and use it in GitHub Desktop.
Revisions
-
brunoanc revised this gist
Mar 14, 2023 . 1 changed file with 2 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ - [Screen sharing on Hyprland (Arch Linux)](#screen-sharing-on-hyprland--arch-linux-) * [Introduction](#introduction) * [Install PipeWire and friends](#install-pipewire-and-friends) * [Install xdg-desktop-portal and friends](#install-xdg-desktop-portal-and-friends) + [Option #1: xdg-desktop-portal-hyprland (recommended)](#option--1--xdg-desktop-portal-hyprland--recommended-) + [Option #2: xdg-desktop-portal-wlr (not recommended)](#option--2--xdg-desktop-portal-wlr--not-recommended-) * [Remove other portal implementations](#remove-other-portal-implementations) @@ -35,7 +35,7 @@ First, we need to install `pipewire` and `wireplumber`. To do that, run the foll sudo pacman -S pipewire wireplumber ``` ## Install xdg-desktop-portal and friends ### Option #1: xdg-desktop-portal-hyprland (recommended) We will install the [`xdg-desktop-portal-hyprland-git`](https://aur.archlinux.org/packages/xdg-desktop-portal-hyprland-git) package from the AUR, which provides additional functionality such as window sharing. With an AUR helper such as `yay`, you can install it this way: ``` @@ -115,8 +115,6 @@ uint32_t wlr_output_preferred_read_format(struct wlr_output *output) { ``` Afterwards, compile and install by running `sudo make install`, then restart your session. ## Troubleshooting OBS You can try the [wlrobs-hg](https://aur.archlinux.org/packages/wlrobs-hg) plugin. -
brunoanc revised this gist
Feb 26, 2023 . 1 changed file with 25 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,18 +1,41 @@ # Screen sharing on Hyprland (Arch Linux) ## Table of contents - [Screen sharing on Hyprland (Arch Linux)](#screen-sharing-on-hyprland--arch-linux-) * [Introduction](#introduction) * [Install PipeWire and friends](#install-pipewire-and-friends) * [Install xdg-desktop-portal-hyprland and friends](#install-xdg-desktop-portal-hyprland-and-friends) + [Option #1: xdg-desktop-portal-hyprland (recommended)](#option--1--xdg-desktop-portal-hyprland--recommended-) + [Option #2: xdg-desktop-portal-wlr (not recommended)](#option--2--xdg-desktop-portal-wlr--not-recommended-) * [Remove other portal implementations](#remove-other-portal-implementations) * [Edit the configuration file](#edit-the-configuration-file) * [Restart your session](#restart-your-session) * [Troubleshooting PipeWire](#troubleshooting-pipewire) * [Troubleshooting desktop portal](#troubleshooting-desktop-portal) + [`Portal service (wlroots implementation) was skipped because of a failed condition check`](#-portal-service--wlroots-implementation--was-skipped-because-of-a-failed-condition-check-) + [`unsupported wl_shm format 0x34324742` (after trying to share the screen on NVIDIA)](#-unsupported-wl-shm-format-0x34324742---after-trying-to-share-the-screen-on-nvidia-) * [Troubleshooting OBS](#troubleshooting-obs) * [Troubleshooting your browser](#troubleshooting-your-browser) + [Firefox](#firefox) + [Chromium](#chromium) * [Troubleshooting your app](#troubleshooting-your-app) * [It still doesn't work!](#it-still-doesn-t-work-) * [References](#references) ## Introduction This guide will go through the setup and troubleshooting steps required to get screen sharing working on OBS with the [Hyprland](https://github.com/vaxerski/Hyprland) compositor. This guide will use the `yay` AUR helper for AUR package installation, but the commands should be similar for other helpers such as `paru`. **WARNING:** This guide demands that the user has a basic understanding on installing packages (both official and AUR), using git, compiling from source, and some patience. ## Install PipeWire and friends First, we need to install `pipewire` and `wireplumber`. To do that, run the following command: ``` sudo pacman -S pipewire wireplumber ``` ## Install xdg-desktop-portal-hyprland and friends ### Option #1: xdg-desktop-portal-hyprland (recommended) We will install the [`xdg-desktop-portal-hyprland-git`](https://aur.archlinux.org/packages/xdg-desktop-portal-hyprland-git) package from the AUR, which provides additional functionality such as window sharing. With an AUR helper such as `yay`, you can install it this way: ``` -
brunoanc revised this gist
Feb 26, 2023 . 1 changed file with 28 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,25 +2,36 @@ This guide will go through the setup and troubleshooting steps required to get screen sharing working on OBS with the [Hyprland](https://github.com/vaxerski/Hyprland) compositor. This guide will use the `yay` AUR helper for AUR package installation, but the commands should be similar for other helpers such as `paru`. **WARNING:** This guide demands that the user has a basic understanding on installing packages (both official and AUR), using git, compiling from source, and some patience. ## Installing PipeWire and friends First, we need to install `pipewire` and `wireplumber`. To do that, run the following command: ``` sudo pacman -S pipewire wireplumber ``` ## Installing xdg-desktop-portal-hyprland and friends ### Option #1: xdg-desktop-portal-hyprland (recommended) We will install the [`xdg-desktop-portal-hyprland-git`](https://aur.archlinux.org/packages/xdg-desktop-portal-hyprland-git) package from the AUR, which provides additional functionality such as window sharing. With an AUR helper such as `yay`, you can install it this way: ``` yay -S xdg-desktop-portal-hyprland-git ``` ### Option #2: xdg-desktop-portal-wlr (not recommended) This option provides less options than `xdg-desktop-portal-wlr`, but it will still allow fullscreen sharing. Install it running the following command: ``` sudo pacman -S xdg-desktop-portal-wlr ``` **WARNING:** The rest of this guide will assume `xdg-desktop-portal-hyprland` was choosed. If you picked this option, replace any `-hyprland` mentions for `-wlr` in the rest of this guide. ## Remove other portal implementations Make sure you don't have any other `xdg-desktop-portal-*` packages installed (except possibly `xdg-desktop-portal-gtk` for file dialogs), as this could cause problems later. To check if you have any, run the following command: ``` pacman -Q | grep xdg-desktop-portal- ``` then delete all of the listed packages except the `-hyprland` one we just installed and the `-gtk` one if you so chose. Also make sure to install the optional dependencies `grim` and `slurp`: ``` @@ -32,7 +43,7 @@ Open your Hyprland config file (usually located at `~/.config/hypr/hyprland.conf ``` exec-once=dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP ``` This will make sure that `xdg-desktop-portal-hyprland` can get the required variables on startup. ## Restart your session Now log out and then log back in, or reboot your system. Once you're back into Hyprland, try sharing in OBS with the "Screen Capture (PipeWire)" option. @@ -46,20 +57,26 @@ systemctl --user status pipewire wireplumber ``` This should return "active (running)" for both. If it doesn't, follow the [Arch Wiki article](https://wiki.archlinux.org/title/PipeWire) for troubleshooting. ## Troubleshooting desktop portal Run the following command to check for errors in `xdg-desktop-portal-hyprland`: ``` systemctl --user status xdg-desktop-portal-hyprland ``` This should return "active (running)". If it doesn't, check the errors it gives you. Here's some workarounds for common errors: ### `Portal service (wlroots implementation) was skipped because of a failed condition check` Make sure you added the required line to the Hyprland configuration. Check for typos. ### `unsupported wl_shm format 0x34324742` (after trying to share the screen on NVIDIA) Install the modified [hyprland-nvidia-git](https://aur.archlinux.org/packages/hyprland-nvidia-git) AUR package: ``` yay -S hyprland-nvidia-git ``` Alternatively, you can modify the source code manually: We'll need to modify the `wlroots` submodule source code to make it choose a viable format. First, clone the [Hyprland](https://github.com/vaxerski/Hyprland) repo if you haven't already: ``` git clone --recursive https://github.com/vaxerski/Hyprland ``` @@ -102,7 +119,7 @@ Notable programs that still don't have full support for this are Discord and Zoo ## It still doesn't work! Follow the [official xdg-desktop-portal-wlr troubleshooting guide](https://github.com/emersion/xdg-desktop-portal-wlr/wiki/"It-doesn't-work"-Troubleshooting-Checklist). If it still doesn't work, consider opening an issue in the [`xdg-desktop-portal-hyprland` repo](https://github.com/hyprwm/xdg-desktop-portal-hyprland). ## References * <https://wiki.archlinux.org/title/PipeWire> -
brunoanc revised this gist
Nov 15, 2022 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -81,7 +81,6 @@ Alternatively, you can install the modified [hyprland-nvidia-git](https://aur.ar You can try the [wlrobs-hg](https://aur.archlinux.org/packages/wlrobs-hg) plugin. ## Troubleshooting your browser If you're trying to share your screen in your browser, first make sure that it supports Wayland and screen sharing on it, else it will not work. ### Firefox -
brunoanc revised this gist
Nov 15, 2022 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -77,6 +77,9 @@ Afterwards, compile and install by running `sudo make install`, then restart you Alternatively, you can install the modified [hyprland-nvidia-git](https://aur.archlinux.org/packages/hyprland-nvidia-git) AUR package. ## Troubleshooting OBS You can try the [wlrobs-hg](https://aur.archlinux.org/packages/wlrobs-hg) plugin. ## Troubleshooting your browser If you're trying to share your screen in your browser, first make sure that it supports Wayland and screen sharing on it, else it will not work. -
brunoanc revised this gist
Nov 15, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -75,7 +75,7 @@ uint32_t wlr_output_preferred_read_format(struct wlr_output *output) { ``` Afterwards, compile and install by running `sudo make install`, then restart your session. Alternatively, you can install the modified [hyprland-nvidia-git](https://aur.archlinux.org/packages/hyprland-nvidia-git) AUR package. ## Troubleshooting your browser -
brunoanc revised this gist
Aug 2, 2022 . 1 changed file with 0 additions and 32 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -56,38 +56,6 @@ This should return "active (running)". If it doesn't, check the errors it gives ### `Portal service (wlroots implementation) was skipped because of a failed condition check` Make sure you added the required line to the Hyprland configuration. Check for typos. ### `unsupported wl_shm format 0x34324742` (after trying to share the screen on NVIDIA) We'll need to modify the `wlroots` submodule source code to make it choose a viable format. -
brunoanc revised this gist
Aug 2, 2022 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,13 +7,13 @@ This guide will go through the setup and troubleshooting steps required to get s ## Installing PipeWire and friends First, we need to install `pipewire` and `wireplumber`. To do that, run the following command: ``` sudo pacman -S pipewire wireplumber ``` ## Installing xdg-desktop-portal-wlr Now we need to install the `xdg-desktop-portal-wlr` package. Run the following command: ``` sudo pacman -S xdg-desktop-portal-wlr ``` Make sure you don't have any other `xdg-desktop-portal-*` packages installed, as this could cause problems later. To check if you have any, run the following command: @@ -24,7 +24,7 @@ then delete all of the listed packages except the `-wlr` one we just installed. Also make sure to install the optional dependencies `grim` and `slurp`: ``` sudo pacman -S grim slurp ``` ## Editing the configuration file @@ -97,7 +97,7 @@ git clone --recursive https://github.com/vaxerski/Hyprland ``` Then, install all required dependencies for building, as specified in the wiki: ``` sudo pacman -S gdb ninja gcc cmake libxcb xcb-proto xcb-util xcb-util-keysyms libxfixes libx11 libxcomposite xorg-xinput libxrender pixman wayland-protocols cairo pango --needed ``` Open the `wlroots/types/output/render.c` file, look for the `wlr_output_preferred_read_format`, and replace it with the following: ``` -
brunoanc revised this gist
Jun 17, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -120,7 +120,7 @@ If it isn't, set the environment variable `MOZ_ENABLE_WAYLAND=1` in an environme If it still doesn't work, open `about:config` and make sure the `media.peerconnection.enabled` flag is set to true. ### Chromium To run on Wayland, set the `--ozone-platform-hint=auto` flag in the chromium flags file (`~/.config/chromium-flags.conf` for the default package, `~/.config/chrome-flags.conf` for Chrome). Also ensure the "WebRTC PipeWire support" flag is enabled by opening `chrome://flags/#enable-webrtc-pipewire-capturer` and enabling it. -
brunoanc revised this gist
Jun 17, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # Screen sharing on Hyprland (Arch Linux) This guide will go through the setup and troubleshooting steps required to get screen sharing working on OBS with the [Hyprland](https://github.com/vaxerski/Hyprland) compositor. **WARNING:** This guide demands that the user has a basic understanding on installing packages, using git, compiling from source, and some patience. -
brunoanc created this gist
Jun 17, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,143 @@ # Screen sharing on Hyprland (Arch Linux) This guide will go through the setup and troubleshooting steps required to get screen sharing working on OBS with the Hyprland compositor. **WARNING:** This guide demands that the user has a basic understanding on installing packages, using git, compiling from source, and some patience. ## Installing PipeWire and friends First, we need to install `pipewire` and `wireplumber`. To do that, run the following command: ``` sudo pacman -Syu pipewire wireplumber ``` ## Installing xdg-desktop-portal-wlr Now we need to install the `xdg-desktop-portal-wlr` package. Run the following command: ``` sudo pacman -Syu xdg-desktop-portal-wlr ``` Make sure you don't have any other `xdg-desktop-portal-*` packages installed, as this could cause problems later. To check if you have any, run the following command: ``` pacman -Q | grep xdg-desktop-portal- ``` then delete all of the listed packages except the `-wlr` one we just installed. Also make sure to install the optional dependencies `grim` and `slurp`: ``` sudo pacman -Syu grim slurp ``` ## Editing the configuration file Open your Hyprland config file (usually located at `~/.config/hypr/hyprland.conf`) with a text editor, and add the following line at the end: ``` exec-once=dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP ``` This will make sure that `xdg-desktop-portal-wlr` can get the required variables on startup. ## Restart your session Now log out and then log back in, or reboot your system. Once you're back into Hyprland, try sharing in OBS with the "Screen Capture (PipeWire)" option. If it works, congratulations! You may exit this guide now. If not, follow along: ## Troubleshooting PipeWire Make sure both `pipewire` and `wireplumber` are running. Run the following command: ``` systemctl --user status pipewire wireplumber ``` This should return "active (running)" for both. If it doesn't, follow the [Arch Wiki article](https://wiki.archlinux.org/title/PipeWire) for troubleshooting. ## Troubleshooting xdg-desktop-portal-wlr Run the following command to check for errors in `xdg-desktop-portal-wlr`: ``` systemctl --user status xdg-desktop-portal-wlr ``` This should return "active (running)". If it doesn't, check the errors it gives you. Here's some workarounds for common errors: ### `Portal service (wlroots implementation) was skipped because of a failed condition check` Make sure you added the required line to the Hyprland configuration. Check for typos. ### `Failed with result 'core-dump'` Run the following command: ``` /usr/lib/xdg-desktop-portal-wlr -r -l TRACE ``` If you get the following at the end: ``` xdg-desktop-portal-wlr: ../src/screencast/wlr_screencast.c:612: linux_dmabuf_feedback_handle_main_device: Assertion `ctx->gbm == NULL' failed. [1] 3414 IOT instruction (core dumped) /usr/lib/xdg-desktop-portal-wlr -r -l TRACE ``` then you'll need to apply **ONLY ONE** of the following workarounds: 1. Change the failed assert in the source code to an if statement. To do it manually, first you'll need to clone the [xdg-desktop-portal-wlr](https://github.com/emersion/xdg-desktop-portal-wlr) source code. Then, go to file `src/screencast/wlr_screencast.c`, and look for the `assert(ctx->gbm == NULL);` statement in the `linux_dmabuf_feedback_handle_main_device` function. Change it to `if (ctx->gbm != NULL) return;`, then compile and install it. Alternatively, you can install the modified [xdg-desktop-portal-wlr-hyprland-git](https://aur.archlinux.org/packages/xdg-desktop-portal-wlr-hyprland-git) AUR package. 2. Downgrade the `xdg-desktop-portal-wlr` package to version `0.5.0`. Run the following command: ``` sudo pacman -U https://archive.archlinux.org/packages/x/xdg-desktop-portal-wlr/xdg-desktop-portal-wlr-0.5.0-1-x86_64.pkg.tar.zst ``` Then, to prevent pacman from updating this package, add it to the `IgnorePkg` section in `/etc/pacman.conf`: ``` IgnorePkg = xdg-desktop-portal-wlr ``` Afterwards, reload your session. ### `unsupported wl_shm format 0x34324742` (after trying to share the screen on NVIDIA) We'll need to modify the `wlroots` submodule source code to make it choose a viable format. To do this manually, clone the [Hyprland](https://github.com/vaxerski/Hyprland) repo if you haven't already: ``` git clone --recursive https://github.com/vaxerski/Hyprland ``` Then, install all required dependencies for building, as specified in the wiki: ``` sudo pacman -Syu gdb ninja gcc cmake libxcb xcb-proto xcb-util xcb-util-keysyms libxfixes libx11 libxcomposite xorg-xinput libxrender pixman wayland-protocols cairo pango --needed ``` Open the `wlroots/types/output/render.c` file, look for the `wlr_output_preferred_read_format`, and replace it with the following: ``` uint32_t wlr_output_preferred_read_format(struct wlr_output *output) { return DRM_FORMAT_XRGB8888; } ``` Afterwards, compile and install by running `sudo make install`, then restart your session. Alternatively, you can install the modified [hyprland-nvidia-screenshare-git](https://aur.archlinux.org/packages/hyprland-nvidia-screenshare-git) AUR package. ## Troubleshooting your browser If you're trying to share your screen in your browser, first make sure that it supports Wayland and screen sharing on it, else it will not work. ### Firefox Make sure you're running on Wayland. To do this, go to `about:support`, look for "Window Protocol", and make sure it is set to "wayland". If it isn't, set the environment variable `MOZ_ENABLE_WAYLAND=1` in an environment file, like `/etc/environment`, `/etc/profile`, `~/.bash_profile`, `~/.zshenv`, etc. If it still doesn't work, open `about:config` and make sure the `media.peerconnection.enabled` flag is set to true. ### Chromium To run on Wayland, set the `--ozone-platform-hint=auto` flag in the chromium flags file (`~/.config/chromium-flags.conf` for the default package, `~/.config/chrome-flags` for chrome). Also ensure the "WebRTC PipeWire support" flag is enabled by opening `chrome://flags/#enable-webrtc-pipewire-capturer` and enabling it. ## Troubleshooting your app Make sure the app you're trying to share the screen with supports Wayland and sharing the screen with it. Notable programs that still don't have full support for this are Discord and Zoom. ## It still doesn't work! Follow the [official xdg-desktop-portal-wlr troubleshooting guide](https://github.com/emersion/xdg-desktop-portal-wlr/wiki/"It-doesn't-work"-Troubleshooting-Checklist). If it still doesn't work, consider opening an issue. ## References * <https://wiki.archlinux.org/title/PipeWire> * <https://github.com/emersion/xdg-desktop-portal-wlr/issues/216> * <https://github.com/emersion/xdg-desktop-portal-wlr/issues/190#issuecomment-1144287165> * <https://github.com/emersion/xdg-desktop-portal-wlr/wiki> * <https://wiki.archlinux.org/title/Firefox#Wayland> * <https://wiki.archlinux.org/title/chromium#Native_Wayland_support>