Add Qt/GTK2 theming, default apps, LibreOffice; fix display.conf race

- Add qt-theme-set: a working Qt theming pipeline via qt6ct (the
  QT_QPA_PLATFORMTHEME=qt6ct env var was pointing at a platform theme
  plugin that wasn't even installed, so every Qt app fell back to its
  own default style). Also regenerates kdeglobals' KColorScheme groups
  and sets QT_QUICK_CONTROLS_STYLE=org.kde.desktop for Kirigami-based
  KDE apps, whose QML-drawn chrome ignores QPalette/qt6ct entirely.
  Gwenview's dialogs/content now follow the theme; its toolbar/statusbar
  chrome is a known remaining gap tied to Kirigami's platform-theme
  detection outside a full Plasma session
- Add GTK2 compat (~/.gtkrc-2.0: icon theme + font follow the theme;
  no dark variant exists for GTK2's Adwaita engine)
- Add modules/default-apps.nix: Gwenview/Ark as system-default image
  viewer/archive manager via /etc/xdg/mimeapps.list, LibreOffice
  (Qt6 build), and a working Thunar "Open Terminal Here" (it shipped
  calling exo-open, which isn't installed and never resolved)
- Fix display-set.sh: mktemp defaulted to /tmp, a different filesystem
  than ~/.config/hypr here, making the mv into display.conf a
  non-atomic copy+unlink. Hyprland's file watcher could catch it
  mid-replace and throw "source= globbing error: found no match" on
  any monitor mode/orientation change. Stress-tested with 60 concurrent
  write+reload cycles after the fix with zero errors
This commit is contained in:
Nexoniarz 2026-08-30 16:51:39 +02:00
commit d1ff0a11e0
9 changed files with 224 additions and 2 deletions

65
modules/default-apps.nix Normal file
View file

@ -0,0 +1,65 @@
{ config, pkgs, lib, ... }:
{
environment.systemPackages = with pkgs; [
libreoffice-qt6 # Qt6-styled build — fits the Qt theming work in theme.nix
# better than the default GTK3 build would.
];
# System-level fallback defaults (XDG spec: only consulted for a
# mimetype the user's own ~/.config/mimeapps.list doesn't already
# claim), so a future "Open With" choice always wins over this without
# needing to touch it. Mimetype lists taken directly from Gwenview's
# and Ark's own .desktop files, not guessed.
#
# One mimetype=desktopfile pair per line: the semicolon only separates
# multiple desktop-file candidates for the SAME key, it doesn't chain
# separate mimetype=value pairs on one line — mimeapps.list parsers
# (verified against xdg-utils' own xdg-mime script) match by scanning
# for a line that STARTS WITH "mimetype=", so cramming several pairs
# onto one semicolon-joined line silently hides every key after the
# first from ever being found.
environment.etc."xdg/mimeapps.list".text =
let
gwenviewMimes = [
"inode/directory" "image/avif" "image/gif" "image/heif" "image/jpeg"
"image/jxl" "image/png" "image/bmp" "image/x-eps" "image/x-icns"
"image/x-ico" "image/x-portable-bitmap" "image/x-portable-graymap"
"image/x-portable-pixmap" "image/x-xbitmap" "image/x-xpixmap"
"image/tiff" "image/x-psd" "image/x-webp" "image/webp" "image/x-tga"
"image/x-xcf" "image/openraster" "image/svg+xml" "image/svg+xml-compressed"
];
arkMimes = [
"application/x-cd-image" "application/x-bcpio" "application/x-cpio"
"application/x-cpio-compressed" "application/x-rpm" "application/x-compress"
"application/gzip" "application/x-bzip" "application/x-bzip2"
"application/x-lzma" "application/x-xz" "application/zstd" "application/x-lz4"
"application/x-source-rpm" "application/vnd.debian.binary-package"
"application/vnd.ms-cab-compressed" "application/x-archive" "application/x-tar"
"application/x-compressed-tar" "application/x-bzip-compressed-tar"
"application/x-bzip2-compressed-tar" "application/x-tarz"
"application/x-xz-compressed-tar" "application/x-lzma-compressed-tar"
"application/x-7z-compressed" "application/vnd.rar" "application/zip"
"application/x-java-archive" "application/x-arj"
];
line = desktop: mime: "${mime}=${desktop}";
in
''
[Default Applications]
${lib.concatMapStringsSep "\n" (line "org.kde.gwenview.desktop") gwenviewMimes}
${lib.concatMapStringsSep "\n" (line "org.kde.ark.desktop") arkMimes}
'';
# Thunar's own "Open Terminal Here" custom action (Edit > Configure
# Custom Actions) shipped pointing at `exo-open --launch
# TerminalEmulator` — exo isn't installed on this system at all (no
# XFCE session, so its helpers.rc mechanism has nothing to resolve
# against), so the action silently did nothing. `f`, not `w`: only
# creates this baseline for a fresh account — once it exists, further
# edits made through Thunar's own UI (adding more custom actions) are
# never overwritten by a rebuild.
systemd.tmpfiles.rules = [
"d /home/nexoniarz/.config/Thunar 0755 nexoniarz users -"
''f /home/nexoniarz/.config/Thunar/uca.xml 0644 nexoniarz users - <?xml version="1.0" encoding="UTF-8"?><actions><action><icon>utilities-terminal</icon><name>Open Terminal Here</name><submenu></submenu><unique-id>1788014825097143-1</unique-id><command>kitty --working-directory %f</command><description>Open a terminal in this folder</description><range></range><patterns>*</patterns><startup-notify/><directories/></action></actions>''
];
}