I upgraded my desktop system to Ubuntu 26.04 and noticed slowness in loading apps in my GNOME session. I had Claude Code investigate and it came up with this script which fixes the error.
#!/bin/bash
# Fix for xdg-desktop-portal-gnome bug in Ubuntu 26.04
# The GNOME portal crashes due to schema name mismatch (wm-preferences vs wm.preferences)
# This script masks the broken GNOME portal and uses the GTK portal instead
set -e
echo "Checking xdg-desktop-portal-gnome status..."
if systemctl --user is-active xdg-desktop-portal-gnome &>/dev/null; then
echo "GNOME portal is running - no fix needed"
exit 0
fi
if systemctl --user is-enabled xdg-desktop-portal-gnome 2>/dev/null | grep -q masked; then
echo "GNOME portal is already masked"
exit 0
fi
# Check if it's failing with the known error
if journalctl --user -u xdg-desktop-portal-gnome -b --no-pager 2>/dev/null | grep -q "wm-preferences.*not installed"; then
echo "Detected known schema bug in xdg-desktop-portal-gnome"
echo "Masking broken GNOME portal and using GTK portal instead..."
systemctl --user mask xdg-desktop-portal-gnome
systemctl --user restart xdg-desktop-portal
echo "Fix applied. App launching should be faster now."
echo ""
echo "To undo later (when Ubuntu fixes the bug):"
echo " systemctl --user unmask xdg-desktop-portal-gnome"
echo " systemctl --user restart xdg-desktop-portal"
else
echo "GNOME portal is not running, but the known schema bug was not detected."
echo "Check manually with: journalctl --user -u xdg-desktop-portal-gnome -b"
exit 1
fi
