(name . Guix-patches)(address . guix-patches@gnu.org)
Hi Guix,
Here is a little package from the Flatpak folks which is also useful in a guix shell container. This lets you run, for example, xdg-open in the container and it will open on the host side. So let's say you come across a URL, you can just use xdg-open from this package so it will open in the host's web browser, rather than trying in the container. This relies on having portals on the host side, like xdg-desktop-portal-gtk.
Here is a simple test example:
Toggle snippet (3 lines)
guix shell -NC flatpak-xdg-utils --preserve='^DBUS_SESSION_BUS_ADDRESS$' -- xdg-open "<https://guix.gnu.org>"
which will open Guix's website on the host side.
I've checked it works, the license (some files LGPL2+ other LGPL2.1+), linted, and styled. I adjusted the description from upstream slightly to indicate it is not just for Flatpak sandboxes.
Thanks!
John
From 8669a7fb0e1b9ba320c6312d7423500a56236edc Mon Sep 17 00:00:00 2001
From: John Kehayias <john.kehayias@protonmail.com>
Date: Sun, 4 Dec 2022 17:06:19 -0500
Subject: [PATCH] gnu: Add flatpak-xdg-utils.
* gnu/packages/freedesktop.scm (flatpak-xdg-utils): New variable.
---
gnu/packages/freedesktop.scm | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
Toggle diff (47 lines)
diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
index 077d56ad3d..073bc1e754 100644
--- a/gnu/packages/freedesktop.scm
+++ b/gnu/packages/freedesktop.scm
@@ -2530,6 +2530,40 @@ (define-public snixembed
@end itemize")
(license license:isc)))
+(define-public flatpak-xdg-utils
+ (package
+ (name "flatpak-xdg-utils")
+ (version "1.0.5")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/flatpak/flatpak-xdg-utils")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1q8wsc46fcjm737hz10jvgci5wl9sz8hj9aix2y2zdj11bqib9af"))))
+ (build-system meson-build-system)
+ (arguments
+ (list #:phases #~(modify-phases %standard-phases
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ (invoke "dbus-run-session" "--" "meson" "test"
+ "--print-errorlogs")))))))
+ (inputs (list glib))
+ (native-inputs (list dbus pkg-config))
+ (synopsis
+ "Simple portal-based commandline tools for use inside sandboxes")
+ (description
+ "This package contains a number of commandline utilities for use inside
+Flatpak sandboxes and other containers, like @command{guix shell --container}.
+They work by talking to portals. Currently, there is flatpak-spawn for
+running commands in sandboxes as well as xdg-open and xdg-email, which are
+compatible with the well-known scripts of the same name.")
+ (home-page "https://github.com/flatpak/flatpak-xdg-utils")
+ (license (list license:lgpl2.0+ license:lgpl2.1+))))
+
(define-public libportal
(package
(name "libportal")
--
2.38.1