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

提供: ArchWiki
ナビゲーションに移動 検索に移動
(→‎Backends: 飜訳)
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"
 
|-
 
|-
  +
! バックエンド !! ファイルチューザー !! スクリーンショットとスクリーンキャスト
! Backend !! File chooser !! Screenshot and screen cast
 
 
|-
 
|-
 
| {{Pkg|xdg-desktop-portal-gnome}} || {{G|Yes}} || {{G|Yes, on [[GNOME]]}}
 
| {{Pkg|xdg-desktop-portal-gnome}} || {{G|Yes}} || {{G|Yes, on [[GNOME]]}}
54行目: 54行目:
 
|}
 
|}
   
  +
#すべての wlroots ベースのコンポジタで動作しますが、[[Hyprland]] と併用すると、個々のウィンドウの共有などの追加機能が提供されます。
#works with all wlroots-based compositors, but provides extra functionality when used with [[Hyprland]] such as sharing individual windows.
 
#redirects requests to GNOME/GTK/KDE/LXQt backends
+
#リクエストを GNOME/GTK/KDE/LXQt バックエンドにリダイレクトします
  +
#[[アプリケーション一覧/ユーティリティ#コンソール|ターミナルファイルマネージャー]]をファイルチューザーとして使用できるようにします
#allows using a [[List of applications/Utilities#Console|terminal file manager]] as a file chooser
 
   
 
== Troubleshooting ==
 
== Troubleshooting ==

2023年5月19日 (金) 10:30時点における版

関連記事

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 を使用するかもしれません。

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

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

バックエンド ファイルチューザー スクリーンショットとスクリーンキャスト
xdg-desktop-portal-gnome Yes Yes, on GNOME
xdg-desktop-portal-gtk Yes No
xdg-desktop-portal-kde Yes Yes, on KDE
xdg-desktop-portal-hyprland1 No Yes, on wlroots
xdg-desktop-portal-lxqt Yes No
xdg-desktop-portal-wlr No Yes, on wlroots
xdg-desktop-portal-liri-gitAUR Yes Yes, on Liri
xdg-desktop-portal-shanaAUR Yes2 No
xdg-desktop-portal-tdAUR Yes No
xdg-desktop-portal-termfilechooser-gitAUR Yes3 No
  1. すべての wlroots ベースのコンポジタで動作しますが、Hyprland と併用すると、個々のウィンドウの共有などの追加機能が提供されます。
  2. リクエストを GNOME/GTK/KDE/LXQt バックエンドにリダイレクトします
  3. ターミナルファイルマネージャーをファイルチューザーとして使用できるようにします

Troubleshooting

xdg-desktop-portal-wlr does not start automatically on sway

For xdg-desktop-portal-wlr to work, the XDG_CURRENT_DESKTOP and WAYLAND_DISPLAY environment variables have to be set in the systemd user session. XDG_CURRENT_DESKTOP has to be set to the name of your compositor, e.g. XDG_CURRENT_DESKTOP=sway. WAYLAND_DISPLAY is set automatically by the compositor.

Check whether these variables are set with 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).

$ systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
$ dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=compositor_name
ヒント: Sway provides a drop-in file which does this automatically, see Sway#Configuration.

See [1] and [2] for more details.

Using multiple monitors with xdg-desktop-portal-wlr

xdg-desktop-portal-wlr requires an external chooser to select the shared monitor. By default, it looks for slurp, wofi and 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, xdg-desktop-portal-wlr will fallback to the first monitor found. For more information, see xdg-desktop-portal-wlr(5) § SCREENCAST OPTIONS.

See also