2024-02-20 22:16:07 +02:00
---
2025-10-17 14:20:47 +01:00
weight: 7
2024-02-20 22:16:07 +02:00
title: xdg-desktop-portal-hyprland
---
2024-02-19 16:52:58 +00:00
2024-07-30 17:07:06 +03:00
An XDG Desktop Portal is a program that lets other applications communicate with
the compositor through D-Bus.
A portal implements certain functionalities, such as opening file pickers or
screen sharing.
[xdg-desktop-portal-hyprland ](https://github.com/hyprwm/xdg-desktop-portal-hyprland )
is Hyprland's xdg-desktop-portal implementation. It allows for screensharing,
global shortcuts, etc.
2025-10-30 19:46:30 +01:00
> [!NOTE]
> Throughout this document, `xdg-desktop-portal-hyprland` will be referred to as
> XDPH.
2024-07-30 17:07:06 +03:00
2025-10-29 20:52:11 +01:00
> [!WARNING]
> XDPH doesn't implement a file picker. For that, it is recommended to install
> `xdg-desktop-portal-gtk` alongside XDPH.
2024-07-30 17:07:06 +03:00
## Installing
{{< tabs items = "Arch Linux,NixOS,Gentoo,Manual" > }}
{{< tab " Arch Linux " > }}
2024-11-06 22:55:14 +02:00
```sh
2024-07-30 17:07:06 +03:00
pacman -S xdg-desktop-portal-hyprland
```
or, for -git:
2024-11-06 22:55:14 +02:00
```sh
2024-07-30 17:07:06 +03:00
yay -S xdg-desktop-portal-hyprland-git
```
{{< / tab > }}
{{< tab " NixOS " > }}
On NixOS, XDPH is already enabled by the
[NixOS module for Hyprland ](../../Nix/Hyprland-on-NixOS ), through
`programs.hyprland.enable = true;` .
{{< / tab > }}
{{< tab " Gentoo " > }}
2025-11-17 22:54:57 +01:00
### Unmask Dependencies
2024-07-30 17:07:06 +03:00
2024-11-06 22:55:14 +02:00
```plain {filename="/etc/portage/profile/package.unmask"}
2024-07-30 17:07:06 +03:00
dev-qt/qtbase
dev-qt/qtwayland
dev-qt/qtdeclarative
dev-qt/qtshadertools
```
2025-11-17 22:54:57 +01:00
### Apply Necessary useflags
2024-07-30 17:07:06 +03:00
2024-11-06 22:55:14 +02:00
```plain {filename="/etc/portage/package.use"}
2024-07-30 17:07:06 +03:00
dev-qt/qtbase opengl egl eglfs gles2-only
dev-qt/qtdeclarative opengl
sys-apps/xdg-desktop-portal screencast
```
2025-11-17 22:54:57 +01:00
### Unmask Dependencies and xdph
2024-07-30 17:07:06 +03:00
2024-11-06 22:55:14 +02:00
```plain {filename="/etc/portage/package.accept_keywords"}
2024-07-30 17:07:06 +03:00
gui-libs/xdg-desktop-portal-hyprland
dev-qt/qtbase
dev-qt/qtwayland
dev-qt/qtdeclarative
dev-qt/qtshadertools
```
btw those are the useflags that I have tested, you could also test others.
2025-11-17 22:54:57 +01:00
### Installation
2024-07-30 17:07:06 +03:00
```sh
eselect repository enable guru
emaint sync -r guru
emerge --ask --verbose gui-libs/xdg-desktop-portal-hyprland
```
{{< / tab > }}
{{< tab " Manual " > }}
See
2024-10-10 18:02:08 +03:00
[The GitHub repo's readme ](https://github.com/hyprwm/xdg-desktop-portal-hyprland ).
2024-07-30 17:07:06 +03:00
{{< / tab > }}
{{< / tabs > }}
## Usage
XDPH is automatically started by D-Bus, once Hyprland starts.
To check if everything is OK is, try to screenshare anything, or opening OBS and
2025-11-17 22:54:57 +01:00
select the PipeWire source.
If XDPH is running, a Qt menu will pop up asking you what to share.
2024-07-30 17:07:06 +03:00
XDPH will work on other wlroots compositors, but features available only on
Hyprland will not work (e.g. window sharing).
2026-05-04 16:59:13 +01:00
For a nuclear option, you can use this script and autostart it:
2024-07-30 17:07:06 +03:00
```sh
2025-06-07 17:38:42 +00:00
#!/bin/sh
2024-07-30 17:07:06 +03:00
sleep 1
killall -e xdg-desktop-portal-hyprland
killall xdg-desktop-portal
/usr/lib/xdg-desktop-portal-hyprland &
sleep 2
/usr/lib/xdg-desktop-portal &
```
Adjust the paths if they're incorrect.
2025-11-17 22:54:57 +01:00
## Share Picker Doesn't Use the System Theme
2024-07-30 17:07:06 +03:00
Try one or both:
```sh
dbus-update-activation-environment --systemd --all
systemctl --user import-environment QT_QPA_PLATFORMTHEME
```
2026-05-04 16:59:13 +01:00
If it works, add it to your config in autostarts.
2024-07-30 17:07:06 +03:00
2025-11-17 22:54:57 +01:00
## Using the KDE File Picker With XDPH
2024-07-30 17:07:06 +03:00
XDPH does not implement a file picker and uses the GTK one as a fallback by
default (see `/usr/share/xdg-desktop-portal/hyprland-portals.conf` ). If you want
to use the KDE file picker but let XDPH handle everything else, create a file
`~/.config/xdg-desktop-portal/hyprland-portals.conf` with the following content:
2024-11-06 22:55:14 +02:00
```ini {filename="~/.config/xdg-desktop-portal/hyprland-portals.conf"}
2024-07-30 17:07:06 +03:00
[preferred]
default = hyprland;gtk
org.freedesktop.impl.portal.FileChooser = kde
```
You can read more about this in the
[xdg-desktop-portal documentation in the Arch Wiki ](https://wiki.archlinux.org/title/XDG_Desktop_Portal ).
Note that some applications like Firefox may require additional configuration to
use the KDE file picker.
## Debugging
If you get long app launch times, or screensharing does not work, consult the
logs.
`systemctl --user status xdg-desktop-portal-hyprland`
If you see a crash, it's likely you are missing either `qt6-wayland` or
`qt5-wayland` .
2024-02-19 16:52:58 +00:00
2024-11-06 20:34:37 +02:00
If the portal does not autostart, does not function when manually started,
2026-05-02 03:38:58 +05:00
and does not produce any error logs, it's very likely your [XDG env variables ](../../Configuring/Advanced-and-Cool/Environment-variables/#xdg-specifications )
2024-09-29 20:01:15 -04:00
are messed up
2024-02-19 16:52:58 +00:00
## Configuration
2024-05-02 20:14:19 +01:00
Example:
2024-07-30 17:07:06 +03:00
2024-05-02 20:14:19 +01:00
```ini
screencopy {
max_fps = 60
}
```
Config file `~/.config/hypr/xdph.conf` allows for these variables:
### category screencopy
2025-11-17 22:54:57 +01:00
| Variable | Description | Type | Default |
| -- | -- | -- | -- |
| `max_fps` | Maximum fps of a screensharing session. < br > `0` means no limit. | int | `120` |
| `allow_token_by_default` | If enabled, will tick the "Allow restore token" box by default. | bool | `false` |
| `custom_picker_binary` | If non-empty, will use that **binary** as your share picker. < br > Please note that it has to conform to the stdout selection layout of `hyprland-share-picker` . | string | `"hyprland-share-picker"` |
2026-03-05 01:04:21 +01:00
| `force_shm` | If enabled, will skip DMA-BUF and always use SHM for screensharing. SHM is slower than DMA-BUF (especially at high resolutions) but can work around DMA-BUF allocation failures on multi-GPU systems. | bool | `false` |