From bcb9f5c73a6fdeec6e06076ca03b5df63cc1c7ac Mon Sep 17 00:00:00 2001 From: Bruno Lopes Date: Fri, 23 Jan 2026 07:51:39 -0300 Subject: [PATCH] build/linux: Add super-privileged 'personal-files' interface to GIMP snap See: #15547 This needs approval from Cannonical and allows migrating app data from older versions as well writting current app data outside the sandbox. --- build/linux/snap/snapcraft.yaml | 5 +++++ libgimpbase/gimpenv.c | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/build/linux/snap/snapcraft.yaml b/build/linux/snap/snapcraft.yaml index dafdb68555..79954f08aa 100644 --- a/build/linux/snap/snapcraft.yaml +++ b/build/linux/snap/snapcraft.yaml @@ -41,6 +41,7 @@ apps: - intel-npu - npu-libs - gimp-plugins + - gimp-config extensions: [gnome] layout: @@ -68,6 +69,10 @@ plugs: interface: content content: gimp-plugins-3 target: $SNAP/gimp-plugins + gimp-config: + interface: personal-files + write: + - $HOME/.config/GIMP parts: buildenv: diff --git a/libgimpbase/gimpenv.c b/libgimpbase/gimpenv.c index 0af4f2f653..3cc12b414a 100644 --- a/libgimpbase/gimpenv.c +++ b/libgimpbase/gimpenv.c @@ -361,6 +361,23 @@ gimp_directory (void) NULL); } + const gchar *snap_path = g_getenv ("SNAP"); + if (snap_path && g_file_test (snap_path, G_FILE_TEST_IS_DIR)) + { + const gchar *snap_real_home = g_getenv ("SNAP_REAL_HOME"); + + if (snap_real_home == NULL) + gimp_dir = g_build_filename (g_get_home_dir (), + ".config", + GIMPDIR, GIMP_USER_VERSION, + NULL); + else + gimp_dir = g_build_filename (snap_real_home, + ".config", + GIMPDIR, GIMP_USER_VERSION, + NULL); + } + if (gimp_dir == NULL) { /* g_get_user_config_dir () always returns a path as a non-null