From 3ce57565b0969401e450272bd5d6604daef7c25e Mon Sep 17 00:00:00 2001 From: reidlab Date: Thu, 26 Dec 2024 00:34:43 -0800 Subject: [PATCH] qt font sizes... qt font sizes are real! --- README.md | 1 + modules/desktop/nwg-drawer.nix | 3 ++ modules/desktop/themes/default.nix | 51 ++++++++++++++++++++++-------- 3 files changed, 41 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index d7ce3b7..d060a9e 100755 --- a/README.md +++ b/README.md @@ -24,5 +24,6 @@ each host should have these files: - tags for pip and popups in hyprland config - make wl-clip-persist and networkmanager applet systemd services? - gtk cursors are MESSED UP. top priority rn + - qt icons just... don't apply - niri.. yum - do lockscreen better somehow diff --git a/modules/desktop/nwg-drawer.nix b/modules/desktop/nwg-drawer.nix index 6f6564f..05f000e 100644 --- a/modules/desktop/nwg-drawer.nix +++ b/modules/desktop/nwg-drawer.nix @@ -31,6 +31,9 @@ in { Restart = "on-failure"; RestartSec = 5; }; + }; + + hm.xdg.configFile."nwg-drawer/drawer.css".text = config.modules.desktop.themes.nwg-drawer; }; } diff --git a/modules/desktop/themes/default.nix b/modules/desktop/themes/default.nix index 54df4e4..bd5dc0f 100644 --- a/modules/desktop/themes/default.nix +++ b/modules/desktop/themes/default.nix @@ -1,4 +1,4 @@ -{ lib, config, ... }: +{ pkgs, lib, config, ... }: with lib; with lib.my; @@ -75,7 +75,6 @@ in { config = mkIf (cfg.active != null) { programs.dconf.enable = true; - hm.dconf = { enable = true; settings."org/gnome/desktop/interface".color-scheme = mkIf cfg.dark "prefer-dark"; @@ -102,7 +101,7 @@ in { hm.qt = { enable = true; - platformTheme.name = "kvantum"; + platformTheme.name = "qtct"; style.name = "kvantum"; }; @@ -145,18 +144,42 @@ in { hm.programs.rofi.theme = cfg.rofi; - hm.xdg.configFile = { - # kvantum - "Kvantum/${cfg.kvantumTheme.name}".source = "${cfg.kvantumTheme.package}/share/Kvantum/${cfg.kvantumTheme.name}"; - "Kvantum/kvantum.kvconfig" = { - text = '' - [General] - theme=${cfg.kvantumTheme.name} - ''; - }; + hm.xdg.configFile = let + iniFmt = pkgs.formats.ini {}; + mkQtctConf = version: let + zeroCount = if version == 5 then 5 else if version == 6 then 10 else builtins.throw "invalid qtct version"; + zeros = builtins.concatStringsSep "," (builtins.genList (_: "0") zeroCount); + weight = if version == 5 then 50 else if version == 6 then 400 else builtins.throw "invalid qtct version"; + in { + Appearance = { + icon_theme = cfg.iconTheme.name; + standard_dialogs = "xdgdesktopportal"; + style = "kvantum"; + }; - # nwg-drawer - "nwg-drawer/drawer.css".text = cfg.nwg-drawer; + Fonts = with config.modules.desktop.fonts.fonts; { + # i'm going to go on a rant here + # this actually SUCKS omg + # god is dead and The Qt Company killed him + # (for qt5, font weight is on a different scale where 50 is equivalent to 400 in qt6, even more fun) + # font weight is set to 400, this is the default weight for every font ever and it will fall back to something else if the font doesn't have a 400 weight (ex. cozette only has a 500 weight) + # setting the font style name is BAD!! i found it breaks font selection for others that aren't the weight that is given, and it's not required anyway + # technically this isn't perfect because we are setting the font size in points to -1, but it doesn't matter since we define it in pixels right afterwards. this causes only a warning in the logs for some qt apps!! so it's fine but it's still a bit annoying because i'm weird + # oh and, because why not, the qt5 font config has less zeros than the qt6 font config. the docs don't say anything about this. i am going to kill myself @The Qt Company + # yapping over. this is the best we can do for now + general = ''"${sansSerif.family},-1,${toString sansSerif.size},5,${toString weight},${zeros},1"''; + fixed = ''"${monospace.family},-1,${toString monospace.size},5,${toString weight},${zeros},1"''; + }; + }; + in { + "Kvantum/${cfg.kvantumTheme.name}".source = "${cfg.kvantumTheme.package}/share/Kvantum/${cfg.kvantumTheme.name}"; + "Kvantum/kvantum.kvconfig".text = '' + [General] + theme=${cfg.kvantumTheme.name} + ''; + + "qt5ct/qt5ct.conf".source = iniFmt.generate "qt5ct.conf" (mkQtctConf 5); + "qt6ct/qt6ct.conf".source = iniFmt.generate "qt6ct.conf" (mkQtctConf 6); }; }; }