From f9d5ec2a63c4df23ec70ea0e7b9762ff104b8300 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Wed, 20 May 2026 10:17:29 -0500 Subject: [PATCH] [fix] use cosmic xdg --- home/home.nix | 2 +- home/modules/niri.nix | 18 ++++++++++++++++++ modules/emacs.nix | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/home/home.nix b/home/home.nix index 46c8e50..2a6e947 100644 --- a/home/home.nix +++ b/home/home.nix @@ -49,7 +49,7 @@ in { config = { common = { default = [ "kde" ]; - "org.freedesktop.impl.portal.FileChooser" = [ "kde" ]; + "org.freedesktop.impl.portal.FileChooser" = [ "cosmic" ]; "org.freedesktop.impl.portal.Access" = [ "kde" ]; "org.freedesktop.impl.portal.OpenUri" = [ "kde" ]; "org.freedesktop.impl.portal.Desktop" = [ "kde" ]; diff --git a/home/modules/niri.nix b/home/modules/niri.nix index c10600b..04b4892 100644 --- a/home/modules/niri.nix +++ b/home/modules/niri.nix @@ -63,11 +63,29 @@ export MOZ_ENABLE_WAYLAND=1 export QT_QPA_PLATFORM="wayland;xcb" export QT_AUTO_SCREEN_SCALE_FACTOR=1 export QT_ENABLE_HIGHDPI_SCALING=1 +export DCONF_PROFILE=cosmic + +# Set the QT platform theme to CuteCosmic. Fallback to qt6ct if CuteCosmic is not installed. +if [ -z "$QT_QPA_PLATFORMTHEME" ]; then + export QT_QPA_PLATFORMTHEME=cosmic + for QT_PLUGIN_PATH in /usr/lib{*,/*}/qt6/plugins; do + if [ -f "''${QT_PLUGIN_PATH}/platformthemes/libcutecosmictheme.so" ]; then + # CuteCosmic found, no need for a fallback. + export QT_QPA_PLATFORMTHEME=cosmic + break + elif [ -f "''${QT_PLUGIN_PATH}/platformthemes/libqt6ct.so" ] || [ -f "''${QT_PLUGIN_PATH}/platformthemes/libqt5ct.so" ]; then + # Fallback to qt6ct, but keep looking for CuteCosmic. + # Note that "qt5ct" is compatible with both qt5ct and qt6ct. + export QT_QPA_PLATFORMTHEME=qt5ct + fi + done +fi if command -v systemctl >/dev/null; then # set environment variables for new units started by user service manager systemctl --user import-environment XDG_SESSION_TYPE XDG_CURRENT_DESKTOP fi + # Run cosmic-session if [[ -z "''${DBUS_SESSION_BUS_ADDRESS}" ]]; then exec dbus-run-session -- ${pkgs.cosmic-session}/bin/cosmic-session niri diff --git a/modules/emacs.nix b/modules/emacs.nix index c4fa075..d08282e 100644 --- a/modules/emacs.nix +++ b/modules/emacs.nix @@ -195,6 +195,7 @@ melpaPackages.gptel-agent melpaPackages.aidermacs melpaPackages.async + treesit-grammars.with-all-grammars pkgs.ispell pkgs.mu pkgs.openjdk