xdg-desktop-portal-gnome: get working as a xdp backend, on lappy
probably needs some porting to moby before it works there
This commit is contained in:
@@ -180,6 +180,7 @@
|
||||
./wvkbd.nix
|
||||
./xarchiver.nix
|
||||
./xdg-desktop-portal.nix
|
||||
./xdg-desktop-portal-gnome
|
||||
./xdg-desktop-portal-gtk.nix
|
||||
./xdg-desktop-portal-wlr.nix
|
||||
./xdg-terminal-exec.nix
|
||||
|
@@ -172,6 +172,7 @@ in
|
||||
"wireplumber" # used by sway config
|
||||
"wl-clipboard"
|
||||
"xdg-desktop-portal"
|
||||
# "xdg-desktop-portal-gnome"
|
||||
# xdg-desktop-portal-gtk provides portals for:
|
||||
# - org.freedesktop.impl.portal.Access
|
||||
# - org.freedesktop.impl.portal.Account
|
||||
@@ -226,7 +227,7 @@ in
|
||||
fs.".config/xdg-desktop-portal/sway-portals.conf".symlink.text = ''
|
||||
# portals.conf docs: <https://flatpak.github.io/xdg-desktop-portal/docs/portals.conf.html>
|
||||
[preferred]
|
||||
default=wlr;gtk
|
||||
default=wlr;gnome;gtk
|
||||
'';
|
||||
|
||||
fs.".config/sway/config".symlink.target = pkgs.substituteAll {
|
||||
|
30
hosts/common/programs/xdg-desktop-portal-gnome/default.nix
Normal file
30
hosts/common/programs/xdg-desktop-portal-gnome/default.nix
Normal file
@@ -0,0 +1,30 @@
|
||||
# XXX(2024-08-07): xdg-desktop-portal-gnome has a nicer filechooser than xdg-desktop-portal-gtk.
|
||||
# especially, mobile friendly.
|
||||
# but starting with 47.0 (unreleased), it will switch to Nautilus. so expect some work in porting.
|
||||
{ config, pkgs, ... }:
|
||||
let
|
||||
cfg = config.sane.programs.xdg-desktop-portal-gnome;
|
||||
in
|
||||
{
|
||||
sane.programs.xdg-desktop-portal-gnome = {
|
||||
packageUnwrapped = pkgs.xdg-desktop-portal-gnome.overrideAttrs (base: {
|
||||
patches = (base.patches or []) ++ [
|
||||
./init_display_no_mutter.diff
|
||||
];
|
||||
});
|
||||
|
||||
fs.".config/xdg-desktop-portal/portals/gnome.portal".symlink.target =
|
||||
"${cfg.packageUnwrapped}/share/xdg-desktop-portal/portals/gnome.portal";
|
||||
# XXX: overcome bug when manually setting `$XDG_DESKTOP_PORTAL_DIR`
|
||||
# which causes *.portal files to be looked for in the toplevel instead of under `portals/`
|
||||
fs.".config/xdg-desktop-portal/gnome.portal".symlink.target = "portals/gnome.portal";
|
||||
|
||||
services.xdg-desktop-portal-gnome = {
|
||||
description = "xdg-desktop-portal-gnome backend (provides file chooser and other functionality for xdg-desktop-portal)";
|
||||
dependencyOf = [ "xdg-desktop-portal" ];
|
||||
|
||||
command = "XDG_SESSION_TYPE=wayland ${cfg.package}/libexec/xdg-desktop-portal-gnome";
|
||||
readiness.waitDbus = "org.freedesktop.impl.portal.desktop.gnome";
|
||||
};
|
||||
};
|
||||
}
|
@@ -0,0 +1,38 @@
|
||||
diff --git a/src/externalwindow-wayland.c b/src/externalwindow-wayland.c
|
||||
index 4ed62c7..329b9a8 100644
|
||||
--- a/src/externalwindow-wayland.c
|
||||
+++ b/src/externalwindow-wayland.c
|
||||
@@ -259,33 +259,6 @@ init_external_window_wayland_display (GError **error)
|
||||
g_autofree char *fd_str = NULL;
|
||||
GdkDisplay *display;
|
||||
|
||||
- proxy = org_gnome_mutter_service_channel_proxy_new_for_bus_sync (
|
||||
- G_BUS_TYPE_SESSION,
|
||||
- (G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START |
|
||||
- G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
|
||||
- G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS),
|
||||
- "org.gnome.Mutter.ServiceChannel",
|
||||
- "/org/gnome/Mutter/ServiceChannel",
|
||||
- NULL, error);
|
||||
- if (!proxy)
|
||||
- return NULL;
|
||||
-
|
||||
- if (!org_gnome_mutter_service_channel_call_open_wayland_service_connection_sync (
|
||||
- proxy,
|
||||
- SERVICE_CLIENT_TYPE_PORTAL_BACKEND,
|
||||
- NULL,
|
||||
- &fd_variant,
|
||||
- &fd_list,
|
||||
- NULL, error))
|
||||
- return NULL;
|
||||
-
|
||||
- fd = g_unix_fd_list_get (fd_list, g_variant_get_handle (fd_variant), error);
|
||||
- if (fd < 0)
|
||||
- return NULL;
|
||||
-
|
||||
- fd_str = g_strdup_printf ("%d", fd);
|
||||
-
|
||||
- g_setenv ("WAYLAND_SOCKET", fd_str, TRUE);
|
||||
gdk_set_allowed_backends ("wayland");
|
||||
display = gdk_display_open (NULL);
|
||||
g_assert (display);
|
Reference in New Issue
Block a user