「XDG デスクトップ ポータル」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
 
(3人の利用者による、間の9版が非表示)
1行目: 1行目:
 
{{Template:Related articles start}}
 
{{Template:Related articles start}}
 
{{Template:Related|Flatpak}}
 
{{Template:Related|Flatpak}}
{{Template:Related|PipeWire#WebRTC screen sharing}}
+
{{Template:Related|PipeWire#WebRTC 画面共有}}
 
{{Template:Related articles end}}
 
{{Template:Related articles end}}
 
[[Category:Freedesktop.org]]
 
[[Category:Freedesktop.org]]
16行目: 16行目:
 
{{Pkg|xdg-desktop-portal}} と一つ以上の[[#バックエンド|バックエンド]]を[[インストール]]します。パッケージには、[[D-Bus]] を通じて自動的に起動される [[systemd/ユーザー]] サービスが含まれています。
 
{{Pkg|xdg-desktop-portal}} と一つ以上の[[#バックエンド|バックエンド]]を[[インストール]]します。パッケージには、[[D-Bus]] を通じて自動的に起動される [[systemd/ユーザー]] サービスが含まれています。
   
== Backends ==
+
== バックエンド ==
   
  +
アプリケーションがポータルを通じてリクエストを行うと、それは {{ic|xdg-desktop-portal}} によって処理され、それからバックエンドの実装に転送されます。これにより、さまざまなデスクトップ環境にフィットする適切なユーザーインターフェースを提供し、通知の表示や画面の録画などのリクエストに対して環境固有の API へアクセスするクリーンな方法を可能にします。
When an application makes a request through a portal, it is handled by {{ic|xdg-desktop-portal}}, which then forwards it to a backend implementation. This allows a clean way to provide suitable user interfaces that fit into different desktop environments, and access environment-specific APIs for requests like showing notifications or recording the screen.
 
   
  +
複数のバックエンドをインストールでき、それらは {{ic|/usr/share/xdg-desktop-portal/portals/*.portal}} に配置しています。それぞれのポータルバックエンドファイルには、それが扱うことができるインターフェースのリストと、それが使用できるデスクトップ環境が含まれています。リクエストが行われると、{{ic|xdg-desktop-portal}} は {{ic|XDG_CURRENT_DESKTOP}} [[環境変数]] を使用して、そのリクエストにどのバックエンドを使用するかを決定します。現在のデスクトップに対して使用できるバックエンドが複数ある場合、アルファベット順で最初のものが選択されます。現在のデスクトップに対してインターフェースを扱うバックエンドがない、現在のデスクトップに対して利用可能なバックエンドがない、または {{ic|xdg-desktop-portal}} が現在のデスクトップを決定できない場合、それは要求されたインターフェースをサポートする全てのインストールされたポータルの中からアルファベット順で最初のポータルを選択します。
Multiple backends can be installed, and they are located in {{ic|/usr/share/xdg-desktop-portal/portals/*.portal}}. Each portal backend file contains a list of interfaces that it can handle, and the desktop environments that it can be used in. When a request is made, {{ic|xdg-desktop-portal}} will use the {{ic|XDG_CURRENT_DESKTOP}} [[environment variable]] to determine which backend it will use for the request. If more than one backend can be used for the current desktop, the first one in alphabetical order is chosen. If no backend for the current desktop can handle the interface, no backend is available for the current desktop, or {{ic|xdg-desktop-portal}} can't determine the current desktop, then it will choose the first portal in alphabetical order between all of the installed portals that support the requested interface.
 
   
  +
例えば、[[Sway]] ユーザーはスクリーンシェアリングサポートのために {{Pkg|xdg-desktop-portal-wlr}} を使用し、''xdg-desktop-portal-wlr'' が実装していない他のすべてのインターフェースに対してフォールバックとして {{Pkg|xdg-desktop-portal-gtk}} を使用するかもしれません。
For example, a [[Sway]] user may use {{Pkg|xdg-desktop-portal-wlr}} for screen sharing support and {{Pkg|xdg-desktop-portal-gtk}} as a fallback for all other interfaces that ''xdg-desktop-portal-wlr'' does not implement.
 
   
  +
=== バックエンドとインターフェースのリスト ===
=== List of backends and interfaces ===
 
   
  +
以下の表では、利用可能な全てのバックエンドと、特定の一般的なインターフェースに対するサポートを一覧表示しています。
The following table lists all backends available and their support for certain common interfaces.
 
   
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
  +
! バックエンド !! サポート環境 !! ツールキット !! Access portal !! Account portal !! App chooser portal !! Background portal !! Clipboard portal !! Dynamic launcher portal !! Email portal !! File chooser portal !! Global shortcuts portal !! Inhibit portal !! Input capture portal !! Notification portal !! Print portal !! Remote desktop portal !! Screen cast portal !! Screenshot portal !! Secret portal !! Settings portal !! Wallpaper portal
! Backend !! File chooser !! Screenshot and screen cast
 
 
|-
 
|-
| {{Pkg|xdg-desktop-portal-gnome}} || {{G|Yes}} || {{G|Yes, on [[GNOME]]}}
+
| {{Pkg|xdg-desktop-portal-cosmic}} || [[COSMIC]] || iced || {{Yes}} || {{No}} || {{No}} || {{No}} || {{No}} || {{No}} || {{No}} || {{Yes}} || {{No}} || {{No}} || {{No}} || {{No}} || {{No}} || {{{No}} || {{Yes}} || {{Yes}} || {{No}} || {{Yes}} || {{No}}
 
|-
 
|-
  +
| {{Pkg|xdg-desktop-portal-dde}} || [[Deepin]] || [[Qt]] 5 || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || {{No}} || {{No}} || {{No}} || {{Yes}} || {{Yes}} || {{Yes}} || {{No}} || {{Yes}} || {{No}} || {{No}} || {{No}} || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}}
| {{Pkg|xdg-desktop-portal-gtk}} || {{Yes}} || {{No}}
 
 
|-
 
|-
| {{Pkg|xdg-desktop-portal-kde}} || {{Yes}} || {{G|Yes, on [[KDE]]}}
+
| {{Pkg|xdg-desktop-portal-gnome}} || [[GNOME]] || [[GTK]] 4 || {{Yes}} || {{{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || {{No}} || {{G|Yes}} || {{No}} || {{No}} || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || {{No}} || {{Yes}} || {{Yes}}
 
|-
 
|-
| {{Pkg|xdg-desktop-portal-hyprland}}<sup>1</sup> || {{No}} || {{G|Yes, on {{Pkg|wlroots}}}}
+
| {{Pkg|xdg-desktop-portal-gtk}} || ''generic'' || [[GTK]] 3 || {{Yes}} || {{Yes}} || {{Yes}} || {{No}} || {{No}} || {{Yes}} || {{Yes}} || {{Yes}} || {{No}} || {{Yes}} || {{No}} || {{Yes}} || {{Yes}} || {{No}} || {{No}} || {{No}} || {{No}} || {{Yes}} || {{No}}
 
|-
 
|-
  +
| {{Pkg|xdg-desktop-portal-hyprland}} || [[Hyprland]]<sup>1</sup> || [[Qt]] 6 || {{No}} || {{No}} || {{No}} || {{No}} || {{No}} || {{No}} || {{No}} || {{No}} || {{Yes}} || {{No}} || {{Yes}} || {{No}} || {{No}} || {{No}} || {{Yes}} || {{Yes}} || {{No}} || {{No}} || {{No}}
| {{Pkg|xdg-desktop-portal-lxqt}} || {{Yes}} || {{No}}
 
 
|-
 
|-
| {{Pkg|xdg-desktop-portal-wlr}} || {{No}} || {{G|Yes, on {{Pkg|wlroots}}}}
+
| {{Pkg|xdg-desktop-portal-kde}} || [[KDE Plasma]] || [[Qt]] 6 || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || {{No}} || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || {{No}} || {{Yes}} || {{No}}
 
|-
 
|-
| {{AUR|xdg-desktop-portal-liri-git}} || {{Yes}} || {{G|Yes, on [[Liri]]}}
+
| {{AUR|xdg-desktop-portal-liri-git}} || [[Liri]] || [[Qt]] 5 || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || {{No}} || {{No}} || {{Yes}} || {{Yes}} || {{No}} || {{Yes}} || {{No}} || {{Yes}} || {{Yes}} || {{No}} || {{Yes}} || {{Yes}} || {{No}} || {{Yes}} || {{Yes}}
 
|-
 
|-
  +
| {{Pkg|xdg-desktop-portal-lxqt}} || [[LXQt]] || [[Qt]] 6 || {{No}} || {{No}} || {{No}} || {{No}} || {{No}} || {{No}} || {{No}} || {{Yes}} || {{No}} || {{No}} || {{No}} || {{No}} || {{No}} || {{No}} || {{No}} || {{No}} || {{No}} || {{No}} || {{No}}
| {{AUR|xdg-desktop-portal-shana}} || {{Yes}}<sup>2</sup> || {{No}}
 
 
|-
 
|-
| {{AUR|xdg-desktop-portal-td}} || {{Yes}} || {{No}}
+
| {{AUR|xdg-desktop-portal-td}} || theDesk || [[Qt]] 6 || {{Yes}} || {{Yes}} || {{No}} || {{No}} || {{No}} || {{No}} || {{No}} || {{Yes}} || {{No}} || {{No}} || {{No}} || {{Yes}} || {{No}} || {{{No}} || {{No}} || {{Yes}} || {{No}} || {{Yes}} || {{No}}
 
|-
 
|-
  +
| {{Pkg|xdg-desktop-portal-wlr}} || wlroots || {{-}} || {{No}} || {{No}} || {{No}} || {{No}} || {{No}} || {{No}} || {{No}} || {{No}} || {{No}} || {{No}} || {{No}} || {{No}} || {{No}} || {{No}} || {{Yes}} || {{Yes}} || {{No}} || {{No}} || {{No}}
| {{AUR|xdg-desktop-portal-termfilechooser-git}} || {{Yes}}<sup>3</sup> || {{No}}
 
  +
|-
  +
| {{Pkg|xdg-desktop-portal-xapp}} || [[Cinnamon]]<sup>2</sup> || {{-}} || {{No}} || {{No}} || {{No}} || {{Yes}} || {{No}} || {{No}} || {{No}} || {{No}} || {{No}} || {{Yes}} || {{No}} || {{No}} || {{No}} || {{No}} || {{No}} || {{Yes}} || {{No}} || {{Yes}} || {{Yes}}
 
|-
 
|-
 
|}
 
|}
   
  +
# すべてのwlrootsベースのコンポジターで動作しますが、[[Hyprland]] で使用すると、個々のウィンドウの共有など、追加機能を提供します。
#works with all wlroots-based compositors, but provides extra functionality when used with [[Hyprland]] such as sharing individual windows.
 
  +
# [[MATE]] および [[Xfce]] の部分的なサポートも提供します。
#redirects requests to GNOME/GTK/KDE/LXQt backends
 
#allows using a [[List of applications/Utilities#Console|terminal file manager]] as a file chooser
 
   
  +
以下のパッケージは、特定のバックエンドのみを提供し、特定のデスクトップ環境に特化したものではありません。
== Troubleshooting ==
 
   
  +
* {{Pkg|darkman}} は(カラースキーム設定専用の)Settings ポータルバックエンドを実装します。
=== xdg-desktop-portal-wlr does not start automatically on sway ===
 
  +
* {{Pkg|gnome-keyring}} はSecretポータルバックエンドを実装します。
  +
* {{Pkg|kwallet}} は Secret ポータルバックエンドを実装します。
  +
* {{AUR|xdg-desktop-portal-shana}} は File chooser ポータルバックエンドを実装します。これは、GNOME/GTK/KDE/LXQt バックエンドにリクエストをリダイレクトします。
  +
* {{AUR|xdg-desktop-portal-termfilechooser-git}} は File chooser ポータルバックエンドを実装します。これにより、[[アプリケーション一覧/ユーティリティ#ターミナルエミュレータ|ターミナルファイルマネージャー]]をファイル選択ダイアログとして使用できます。
   
  +
== 設定 ==
For {{ic|xdg-desktop-portal-wlr}} to work, the {{ic|XDG_CURRENT_DESKTOP}} and {{ic|WAYLAND_DISPLAY}} environment variables have to be set in the [[Systemd/User#Environment variables|systemd user session]]. {{ic|XDG_CURRENT_DESKTOP}} has to be set to the name of your compositor, e.g. {{ic|1=XDG_CURRENT_DESKTOP=sway}}. {{ic|WAYLAND_DISPLAY}} is set automatically by the compositor.
 
   
  +
リクエストの発行時、{{ic|xdg-desktop-portal}} は設定ファイル {{ic|/usr/share/xdg-desktop-portal/''DE''-portals.conf}} を使用します (''DE'' の部分には {{ic|XDG_CURRENT_DESKTOP}} [[環境変数]]の値が使用されます)。この設定ファイルはデスクトップ環境自体によって提供され、特定のデスクトップ環境が実行中である場合にどのバックエンドを使用するべきかを決定します。
Check whether these variables are set with {{ic|systemctl --user show-environment}}. If they are not set, import these environment variables into the systemd user session and dbus by running the following commands after launching the compositor (e.g., include them in the compositor's configuration file).
 
  +
  +
デスクトップ環境によるデフォルト値を上書きしたい場合や、デスクトップ環境がデフォルトの設定を提供していない場合、ポータルの設定ファイル {{ic|$XDG_CONFIG_HOME/xdg-desktop-portal/portals.conf}} を作成することで、全て、または個々のインターフェイスに対してどのバックエンドを使用するかを指定することができます。複数のデスクトップ環境を使用している場合、{{ic|$XDG_CONFIG_HOME/xdg-desktop-portal/''DE''-portals.conf}} を作成することで、それぞれのデスクトップ環境に対して設定を上書きすることができます。
  +
  +
例えば、デスクトップ環境がポータルバックエンドを提供しておらず、{{Pkg|xdg-desktop-portal-gtk}} を汎用のフォールバックとして使用し、{{Pkg|xdg-desktop-portal-lxqt}} で LXQt のファイル選択ダイアログを使用したい場合、設定は以下のようになります:
  +
  +
{{hc|1=~/.config/xdg-desktop-portal/portals.conf|2=
  +
[preferred]
  +
default=gtk
  +
org.freedesktop.impl.portal.FileChooser=lxqt
  +
}}
  +
  +
詳細は {{man|5|portals.conf}} を参照してください。
  +
  +
=== デスクトップ環境を強制する ===
  +
  +
場合によっては (スタンドアローンな[[ウィンドウマネージャ]]を使用している場合など)、特定のデスクトップ環境が実行中であると {{ic|xdg-desktop-portal}} に思わせる必要があるでしょう。これは、[[ドロップインスニペット]]を使って {{ic|xdg-desktop-portal.service}} [[ユーザーユニット]]に対して [[XDG_CURRENT_DESKTOP]] 環境変数を設定することで可能です。例えば、KDE に付属しているバックエンドを使うには:
  +
  +
{{hc|~/.config/systemd/user/xdg-desktop-portal.service.d/override.conf|2=
  +
[Service]
  +
Environment="XDG_CURRENT_DESKTOP=KDE"
  +
}}
  +
  +
[[Systemd#ユニットファイルを置換する|systemctl]] を使わずに手動でドロップインファイルを作成した場合は、[[daemon-reload]] を実行してください。
  +
  +
== トラブルシューティング ==
  +
  +
=== xdg-desktop-portal-wlr が sway で自動的に開始しない ===
  +
  +
{{ic|xdg-desktop-portal-wlr}} を動作させるには、{{ic|XDG_CURRENT_DESKTOP}} と {{ic|WAYLAND_DISPLAY}} 環境変数が [[Systemd/ユーザー#環境変数|systemd ユーザーセッション]] 内に設定されている必要があります。{{ic|XDG_CURRENT_DESKTOP}} は、あなたのコンポジタの名前に設定する必要があります(例えば、{{ic|1=XDG_CURRENT_DESKTOP=sway}})。{{ic|WAYLAND_DISPLAY}} はコンポジタによって自動的に設定されます。
  +
  +
これらの変数が設定されているかどうかは {{ic|systemctl --user show-environment}} で確認します。設定されていない場合、次のコマンドをコンポジタの起動後に実行して、これらの環境変数を systemd ユーザーセッションと dbus にインポートします(例えば、コンポジタの設定ファイルに含めます)。
   
 
$ systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
 
$ systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
 
$ dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=''compositor_name''
 
$ dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=''compositor_name''
   
  +
{{Note|これらの環境変数は、コンポジターが起動する前に設定する必要があります。これは通常、コンポジター自身の設定を通して行われます。詳細については、そのドキュメントを参照してください。}}
{{Tip|[[Sway]] provides a drop-in file which does this automatically, see [[Sway#Configuration]].}}
 
  +
  +
{{Tip|
  +
* [[Sway]] はこれを自動的に行う drop-in ファイルを提供しています。詳細は [[Sway#設定]] を参照してください。
  +
* [[Hyprland]] はこれらの環境変数を自動的に設定しない場合があります。手動で指定できます。詳細については、[https://wiki.hyprland.org/Configuring/Environment-variables/#xdg-specifications Hyprland Wiki]. を参照してください。
  +
}}
  +
  +
詳細は [https://github.com/emersion/xdg-desktop-portal-wlr#running] と [https://github.com/emersion/xdg-desktop-portal-wlr/wiki] を参照してください。
  +
  +
=== xdg-desktop-portal-wlr を使って複数のモニターを使用する ===
  +
  +
{{ic|xdg-desktop-portal-wlr}} は共有するモニターを選択するために外部のチューザーが必要です。デフォルトでは、{{Pkg|slurp}}、{{Pkg|wofi}}、そして {{Pkg|bemenu}} をこの順に探します。''slurp'' を使用している場合、画面共有のリクエスト後に十字カーソルが表示され、共有したい画面をクリックする必要があります。''wofi'' や ''bemenu'' を使用している場合、共有可能なディスプレイのメニューが表示されます。チューザーが利用できない場合、{{ic|xdg-desktop-portal-wlr}} は最初に見つけたモニターにフォールバックします。詳細は {{man|5|xdg-desktop-portal-wlr|SCREENCAST OPTIONS}} を参照してください。
  +
  +
=== KDE Plasma で GTK アプリケーションのフォント描画が汚い ===
  +
  +
一部の GTK アプリケーションは Plasma 上でフォントを正しく描画するために {{Pkg|xdg-desktop-portal-gtk}} を必要とします。このパッケージをインストールし、以下を実行してください:
   
  +
$ /usr/lib/xdg-desktop-portal --replace
See [https://github.com/emersion/xdg-desktop-portal-wlr#running] and [https://github.com/emersion/xdg-desktop-portal-wlr/wiki] for more details.
 
   
  +
=== GTK (その他) ファイル選択ダイアログが動作しない場合 ===
=== Using multiple monitors with xdg-desktop-portal-wlr ===
 
   
  +
アプリケーションが {{ic|xwayland}} 上で実行されている場合(確認する最も簡単な方法は {{ic|xeyes}} を実行し、問題のアプリケーション上でマウスを追跡するかどうかを確認することです)、{{ic|xdg-desktop-portal-gtk}} がオンデマンドで表示されますが、ファイルを選択した後、何も起こりません。その場合は、{{ic|xdg-desktop-portal-gtk}} の環境に {{ic|1=DISPLAY=:0}} を追加すると役立つ可能性があります。これを行うには、上記の {{ic|import-environment}} に関する指示に従うか、{{ic|xdg-desktop-portal-gtk}} の systemd ユーザーユニットファイルを編集します。あるいは、アプリケーションを wayland 下で強制的に実行することもできます(例えば、{{ic|electron}} を使用している場合)
{{ic|xdg-desktop-portal-wlr}} requires an external chooser to select the shared monitor. By default, it looks for {{Pkg|slurp}}, {{Pkg|wofi}} and {{Pkg|bemenu}} in this order. When using ''slurp'', after a request for screen sharing you will be presented with a crosshair cursor and you will need to click the screen you want to share. When using ''wofi'' or ''bemenu'', you will be presented with a menu of available displays to share. If no choosers are available, {{ic|xdg-desktop-portal-wlr}} will fallback to the first monitor found. For more information, see {{man|5|xdg-desktop-portal-wlr|SCREENCAST OPTIONS}}.
 
   
== See also ==
+
== 参照 ==
   
* [https://flatpak.github.io/xdg-desktop-portal/ Portal Documentation]: Lists all APIs applications and backends can implement.
+
* [https://flatpak.github.io/xdg-desktop-portal/ Portal Documentation]: すべての API を一覧表にしたもので、アプリケーションやバックエンドが実装できます。

2025年2月22日 (土) 01:58時点における最新版

関連記事

Flatpak のドキュメンテーションから:

Portals は、アプリケーションのサンドボックスの外部から安全にリソースにアクセスするためのフレームワークです。それらは、ネットワークのステータスを決定する、ファイルチューザーでファイルを開く、URIを開く、スクリーンショットやスクリーンキャストを取るなど、アプリケーションに一連の共通機能を提供します [...]

Portals は Flatpak を通じてサンドボックス化されたアプリケーションで使用するために設計されましたが、任意のアプリケーションは Portals を使用して、デスクトップやツールキットに関係なく特徴に均一なアクセスを提供できます。これは一般的に、例えば、 PipeWire 経由で Wayland にスクリーン共有を許可するためや、現在の デスクトップ環境 と同じツールキットを使用する Firefox 上でファイルの開くと保存のダイアログを使用するために使用されます。

インストール

xdg-desktop-portal と一つ以上のバックエンドインストールします。パッケージには、D-Bus を通じて自動的に起動される systemd/ユーザー サービスが含まれています。

バックエンド

アプリケーションがポータルを通じてリクエストを行うと、それは xdg-desktop-portal によって処理され、それからバックエンドの実装に転送されます。これにより、さまざまなデスクトップ環境にフィットする適切なユーザーインターフェースを提供し、通知の表示や画面の録画などのリクエストに対して環境固有の API へアクセスするクリーンな方法を可能にします。

複数のバックエンドをインストールでき、それらは /usr/share/xdg-desktop-portal/portals/*.portal に配置しています。それぞれのポータルバックエンドファイルには、それが扱うことができるインターフェースのリストと、それが使用できるデスクトップ環境が含まれています。リクエストが行われると、xdg-desktop-portalXDG_CURRENT_DESKTOP 環境変数 を使用して、そのリクエストにどのバックエンドを使用するかを決定します。現在のデスクトップに対して使用できるバックエンドが複数ある場合、アルファベット順で最初のものが選択されます。現在のデスクトップに対してインターフェースを扱うバックエンドがない、現在のデスクトップに対して利用可能なバックエンドがない、または xdg-desktop-portal が現在のデスクトップを決定できない場合、それは要求されたインターフェースをサポートする全てのインストールされたポータルの中からアルファベット順で最初のポータルを選択します。

例えば、Sway ユーザーはスクリーンシェアリングサポートのために xdg-desktop-portal-wlr を使用し、xdg-desktop-portal-wlr が実装していない他のすべてのインターフェースに対してフォールバックとして xdg-desktop-portal-gtk を使用するかもしれません。

バックエンドとインターフェースのリスト

以下の表では、利用可能な全てのバックエンドと、特定の一般的なインターフェースに対するサポートを一覧表示しています。

バックエンド サポート環境 ツールキット Access portal Account portal App chooser portal Background portal Clipboard portal Dynamic launcher portal Email portal File chooser portal Global shortcuts portal Inhibit portal Input capture portal Notification portal Print portal Remote desktop portal Screen cast portal Screenshot portal Secret portal Settings portal Wallpaper portal
xdg-desktop-portal-cosmic COSMIC iced Yes No No No No No No Yes No No No No No No Yes Yes No Yes No
xdg-desktop-portal-dde Deepin Qt 5 Yes Yes Yes Yes No No No Yes Yes Yes No Yes No No No Yes Yes Yes Yes
xdg-desktop-portal-gnome GNOME GTK 4 Yes Yes Yes Yes Yes Yes No Yes No No Yes Yes Yes Yes Yes Yes No Yes Yes
xdg-desktop-portal-gtk generic GTK 3 Yes Yes Yes No No Yes Yes Yes No Yes No Yes Yes No No No No Yes No
xdg-desktop-portal-hyprland Hyprland1 Qt 6 No No No No No No No No Yes No Yes No No No Yes Yes No No No
xdg-desktop-portal-kde KDE Plasma Qt 6 Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes No
xdg-desktop-portal-liri-gitAUR Liri Qt 5 Yes Yes Yes Yes No No Yes Yes No Yes No Yes Yes No Yes Yes No Yes Yes
xdg-desktop-portal-lxqt LXQt Qt 6 No No No No No No No Yes No No No No No No No No No No No
xdg-desktop-portal-tdAUR theDesk Qt 6 Yes Yes No No No No No Yes No No No Yes No No No Yes No Yes No
xdg-desktop-portal-wlr wlroots No No No No No No No No No No No No No No Yes Yes No No No
xdg-desktop-portal-xapp Cinnamon2 No No No Yes No No No No No Yes No No No No No Yes No Yes Yes
  1. すべてのwlrootsベースのコンポジターで動作しますが、Hyprland で使用すると、個々のウィンドウの共有など、追加機能を提供します。
  2. MATE および Xfce の部分的なサポートも提供します。

以下のパッケージは、特定のバックエンドのみを提供し、特定のデスクトップ環境に特化したものではありません。

  • darkman は(カラースキーム設定専用の)Settings ポータルバックエンドを実装します。
  • gnome-keyring はSecretポータルバックエンドを実装します。
  • kwallet は Secret ポータルバックエンドを実装します。
  • xdg-desktop-portal-shanaAUR は File chooser ポータルバックエンドを実装します。これは、GNOME/GTK/KDE/LXQt バックエンドにリクエストをリダイレクトします。
  • xdg-desktop-portal-termfilechooser-gitAUR は File chooser ポータルバックエンドを実装します。これにより、ターミナルファイルマネージャーをファイル選択ダイアログとして使用できます。

設定

リクエストの発行時、xdg-desktop-portal は設定ファイル /usr/share/xdg-desktop-portal/DE-portals.conf を使用します (DE の部分には XDG_CURRENT_DESKTOP 環境変数の値が使用されます)。この設定ファイルはデスクトップ環境自体によって提供され、特定のデスクトップ環境が実行中である場合にどのバックエンドを使用するべきかを決定します。

デスクトップ環境によるデフォルト値を上書きしたい場合や、デスクトップ環境がデフォルトの設定を提供していない場合、ポータルの設定ファイル $XDG_CONFIG_HOME/xdg-desktop-portal/portals.conf を作成することで、全て、または個々のインターフェイスに対してどのバックエンドを使用するかを指定することができます。複数のデスクトップ環境を使用している場合、$XDG_CONFIG_HOME/xdg-desktop-portal/DE-portals.conf を作成することで、それぞれのデスクトップ環境に対して設定を上書きすることができます。

例えば、デスクトップ環境がポータルバックエンドを提供しておらず、xdg-desktop-portal-gtk を汎用のフォールバックとして使用し、xdg-desktop-portal-lxqt で LXQt のファイル選択ダイアログを使用したい場合、設定は以下のようになります:

~/.config/xdg-desktop-portal/portals.conf
[preferred]
default=gtk
org.freedesktop.impl.portal.FileChooser=lxqt

詳細は portals.conf(5) を参照してください。

デスクトップ環境を強制する

場合によっては (スタンドアローンなウィンドウマネージャを使用している場合など)、特定のデスクトップ環境が実行中であると xdg-desktop-portal に思わせる必要があるでしょう。これは、ドロップインスニペットを使って xdg-desktop-portal.service ユーザーユニットに対して XDG_CURRENT_DESKTOP 環境変数を設定することで可能です。例えば、KDE に付属しているバックエンドを使うには:

~/.config/systemd/user/xdg-desktop-portal.service.d/override.conf
[Service]
Environment="XDG_CURRENT_DESKTOP=KDE"

systemctl を使わずに手動でドロップインファイルを作成した場合は、daemon-reload を実行してください。

トラブルシューティング

xdg-desktop-portal-wlr が sway で自動的に開始しない

xdg-desktop-portal-wlr を動作させるには、XDG_CURRENT_DESKTOPWAYLAND_DISPLAY 環境変数が systemd ユーザーセッション 内に設定されている必要があります。XDG_CURRENT_DESKTOP は、あなたのコンポジタの名前に設定する必要があります(例えば、XDG_CURRENT_DESKTOP=sway)。WAYLAND_DISPLAY はコンポジタによって自動的に設定されます。

これらの変数が設定されているかどうかは systemctl --user show-environment で確認します。設定されていない場合、次のコマンドをコンポジタの起動後に実行して、これらの環境変数を systemd ユーザーセッションと dbus にインポートします(例えば、コンポジタの設定ファイルに含めます)。

$ systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
$ dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=compositor_name
ノート: これらの環境変数は、コンポジターが起動する前に設定する必要があります。これは通常、コンポジター自身の設定を通して行われます。詳細については、そのドキュメントを参照してください。
ヒント:
  • Sway はこれを自動的に行う drop-in ファイルを提供しています。詳細は Sway#設定 を参照してください。
  • Hyprland はこれらの環境変数を自動的に設定しない場合があります。手動で指定できます。詳細については、Hyprland Wiki. を参照してください。

詳細は [1][2] を参照してください。

xdg-desktop-portal-wlr を使って複数のモニターを使用する

xdg-desktop-portal-wlr は共有するモニターを選択するために外部のチューザーが必要です。デフォルトでは、slurpwofi、そして bemenu をこの順に探します。slurp を使用している場合、画面共有のリクエスト後に十字カーソルが表示され、共有したい画面をクリックする必要があります。wofibemenu を使用している場合、共有可能なディスプレイのメニューが表示されます。チューザーが利用できない場合、xdg-desktop-portal-wlr は最初に見つけたモニターにフォールバックします。詳細は xdg-desktop-portal-wlr(5) § SCREENCAST OPTIONS を参照してください。

KDE Plasma で GTK アプリケーションのフォント描画が汚い

一部の GTK アプリケーションは Plasma 上でフォントを正しく描画するために xdg-desktop-portal-gtk を必要とします。このパッケージをインストールし、以下を実行してください:

$ /usr/lib/xdg-desktop-portal --replace

GTK (その他) ファイル選択ダイアログが動作しない場合

アプリケーションが xwayland 上で実行されている場合(確認する最も簡単な方法は xeyes を実行し、問題のアプリケーション上でマウスを追跡するかどうかを確認することです)、xdg-desktop-portal-gtk がオンデマンドで表示されますが、ファイルを選択した後、何も起こりません。その場合は、xdg-desktop-portal-gtk の環境に DISPLAY=:0 を追加すると役立つ可能性があります。これを行うには、上記の import-environment に関する指示に従うか、xdg-desktop-portal-gtk の systemd ユーザーユニットファイルを編集します。あるいは、アプリケーションを wayland 下で強制的に実行することもできます(例えば、electron を使用している場合)

参照

  • Portal Documentation: すべての API を一覧表にしたもので、アプリケーションやバックエンドが実装できます。