linuxmint / linuxmint/timeshift
"Browse Files" button does nothing on Wayland compositors (missing WAYLAND_DISPLAY and XDG_RUNTIME_DIR in exec_user_async)
Nobody has claimed this yet.
- Dominant language
- Vala
- Stars
- 4.3k
- Forks
- 155
- PR merge metrics
- No merged PRs in 30d
Description
Bug Description
The "Browse Files" button (and "View Timeshift Logs") does nothing on Wayland compositors. The file manager (Thunar, Nautilus, etc.) silently fails and never appears.
This is a different root cause from the issues previously closed (#517, #520). While PR #518 fixed those by switching from exec_script_async() to exec_user_async() to drop root privileges, exec_user_async() itself does not pass the Wayland-specific environment variables needed for GTK apps to connect to the compositor.
Root Cause
1. TeeJee.Process.vala — exec_user_async() missing Wayland env vars
In src/Utility/TeeJee.Process.vala, the exec_user_async() function constructs this pkexec command:
cmd = "pkexec --user %s env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS ".printf(user) + cmd;
It passes X11 variables (DISPLAY, XAUTHORITY) and DBUS_SESSION_BUS_ADDRESS, but does NOT pass:
WAYLAND_DISPLAY(e.g.,wayland-1)XDG_RUNTIME_DIR(e.g.,/run/user/1000)
Without these, GTK apps launched via pkexec cannot connect to the Wayland compositor socket. The file manager silently fails because it has no display to connect to.
2. Main.vala — setup_env() breaks Wayland variable resolution
In src/Core/Main.vala, the setup_env() function has an additional problem:
if (wayland_display != null && xdg_runtime_dir != null) {
string path = "%s/%s".printf(xdg_runtime_dir, wayland_display);
GLib.Environment.set_variable("WAYLAND_DISPLAY", path, true);
GLib.Environment.set_variable("XDG_RUNTIME_DIR", "/run/user/0", true);
}
This code:
- Changes
WAYLAND_DISPLAYfrom the normal valuewayland-1to the full path/run/user/1000/wayland-1 - Overwrites
XDG_RUNTIME_DIRto/run/user/0(root's runtime dir)
This breaks the standard Wayland resolution where GTK apps combine XDG_RUNTIME_DIR/WAYLAND_DISPLAY to find the compositor socket. After this transformation, the Wayland socket can't be found because the path construction becomes nonsensical (/run/user/0/wayland-1 doesn't exist, and /run/user/1000/wayland-1 is now unreachable via normal variable resolution).
Steps to Reproduce
- Use a Wayland compositor (e.g., Niri, Hyprland, Sway, GNOME on Wayland)
- Start Timeshift
- Select a snapshot
- Click "Browse Files"
- Nothing happens — no file manager window appears, no error dialog
Environment
- OS: Arch Linux
- Compositor: Niri (Wayland)
- Timeshift Version: 24.06.5
- File Manager: Thunar (also confirmed on Nautilus)
Suggested Fix
Fix 1: Add Wayland env vars to exec_user_async() in TeeJee.Process.vala
cmd = "pkexec --user %s env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS WAYLAND_DISPLAY=$WAYLAND_DISPLAY XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR ".printf(user) + cmd;
Fix 2: Correct setup_env() in Main.vala
The setup_env() function should not mangle the WAYLAND_DISPLAY value or override XDG_RUNTIME_DIR for the root process in a way that breaks child process resolution. The Wayland socket needs to remain accessible. Possible approaches:
- Keep
WAYLAND_DISPLAYas the socket name (e.g.,wayland-1) and preserve the originalXDG_RUNTIME_DIRso child processes can resolve the socket path correctly - Or, if the full path must be set for the root process's own use, ensure the original variables are restored/passed correctly when launching user processes via
exec_user_async()
Workaround
Create a wrapper script for your file manager at /usr/local/bin/thunar (or equivalent for your file manager) that forces X11 fallback when Wayland is unavailable:
#!/bin/bash
if [ -z "$WAYLAND_DISPLAY" ] && [ -n "$DISPLAY" ]; then
export GDK_BACKEND=x11
fi
exec /usr/bin/thunar "$@"
This works because DISPLAY is still passed through by exec_user_async(), so the file manager can fall back to XWayland.
Related Issues
- #520 — "Browse button does nothing" (closed as duplicate of #517, but this is a different root cause specific to Wayland)
- #338 — "Browse does not open Dolphin in KDE" (mentions
XDG_RUNTIME_DIR not setbut on X11) - #206 — "Cannot launch timeshift on wayland" (about app launch failure, not Browse Files)
- #517 — "View TimeShift Logs button doesn't work" (fixed by PR #518 which introduced
exec_user_async(), but the Wayland env passthrough was missed)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with exec_user_async() in src/Utility/TeeJee.Process.vala and setup_env() in src/Core/Main.vala, comparing the current DISPLAY, WAYLAND_DISPLAY, XDG_RUNTIME_DIR, and DBUS_SESSION_BUS_ADDRESS handling. Reproduce the Browse Files and View Timeshift Logs actions under a Wayland compositor; done means both launch the expected file manager or log viewer.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100