From 70a8b66d0185d71331c804679135c8f8447a6bc9 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Thu, 20 Jun 2024 22:03:30 +0200 Subject: [PATCH 1/5] Add dconf.enable=true to dconf.nix (even though we do it system-wide) --- home/misc/dconf.nix | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/home/misc/dconf.nix b/home/misc/dconf.nix index f876c1a..b7a7b17 100644 --- a/home/misc/dconf.nix +++ b/home/misc/dconf.nix @@ -1,10 +1,13 @@ { - dconf.settings = { - # This is like a system-wide dark mode swithc that some apps respect - # Equivalent of the following dconf command: - # `conf write /org/gnome/desktop/interface/color-scheme "'prefer-dark'"` - "org/gnome/desktop/interface" = { - color-scheme = "prefer-dark"; + dconf = { + enable = true; + settings = { + # This is like a system-wide dark mode swithc that some apps respect + # Equivalent of the following dconf command: + # `conf write /org/gnome/desktop/interface/color-scheme "'prefer-dark'"` + "org/gnome/desktop/interface" = { + color-scheme = "prefer-dark"; + }; }; }; } From 1d519de3fe62cfddf7314f660686e7ee70ba7603 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Thu, 20 Jun 2024 22:03:48 +0200 Subject: [PATCH 2/5] Add Noto Sans to sansSerif fonts --- system/roles/workstation/fonts.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/system/roles/workstation/fonts.nix b/system/roles/workstation/fonts.nix index 0dedb34..00e7477 100644 --- a/system/roles/workstation/fonts.nix +++ b/system/roles/workstation/fonts.nix @@ -24,6 +24,7 @@ in { sansSerif = [ "Lexend" + "Noto Sans" ] ++ common; From 042514bb3a5fe6d19f561db5e2e32d7503bcc51f Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Thu, 20 Jun 2024 22:04:05 +0200 Subject: [PATCH 3/5] Add theme configuration (gtk,qt,cursor) --- home/default.nix | 1 + home/themes/cursor.nix | 16 ++++++ home/themes/default.nix | 7 +++ home/themes/gtk.nix | 80 +++++++++++++++++++++++++++++ home/themes/qt.nix | 57 +++++++++++++++++++++ options/home/default.nix | 1 + options/home/theme.nix | 108 +++++++++++++++++++++++++++++++++++++++ 7 files changed, 270 insertions(+) create mode 100644 home/themes/cursor.nix create mode 100644 home/themes/default.nix create mode 100644 home/themes/gtk.nix create mode 100644 home/themes/qt.nix create mode 100644 options/home/theme.nix diff --git a/home/default.nix b/home/default.nix index 709e6d6..fc15a74 100644 --- a/home/default.nix +++ b/home/default.nix @@ -33,6 +33,7 @@ in ./packages ./programs ./impermanence + ./themes ]; config = { diff --git a/home/themes/cursor.nix b/home/themes/cursor.nix new file mode 100644 index 0000000..265bdd2 --- /dev/null +++ b/home/themes/cursor.nix @@ -0,0 +1,16 @@ +{ + osConfig, + ... +}: let + cfg = osConfig.myOptions.home-manager.theme.cursor; +in { + home = { + pointerCursor = { + package = cfg.package; + name = cfg.name; + size = cfg.size; + gtk.enable = true; + x11.enable = true; + }; + }; +} diff --git a/home/themes/default.nix b/home/themes/default.nix new file mode 100644 index 0000000..f2802d1 --- /dev/null +++ b/home/themes/default.nix @@ -0,0 +1,7 @@ +{ + imports = [ + ./gtk.nix + ./qt.nix + ./cursor.nix + ]; +} diff --git a/home/themes/gtk.nix b/home/themes/gtk.nix new file mode 100644 index 0000000..131c421 --- /dev/null +++ b/home/themes/gtk.nix @@ -0,0 +1,80 @@ +{ + osConfig, + config, + pkgs, + lib, + ... +}: let + cfg = osConfig.myOptions.home-manager.theme.gtk; +in { + home = { + packages = with pkgs; [ + glib # gsettings + cfg.theme.package + cfg.iconTheme.package + ]; + + sessionVariables = { + # set GTK theme to the name specified by the gtk theme package + GTK_THEME = "${cfg.theme.name}"; + + # gtk applications should use filepickers specified by xdg + GTK_USE_PORTAL = "${toString (if cfg.usePortal then 1 else 0)}"; + }; + }; + + gtk = { + enable = true; + + theme = { + name = cfg.theme.name; + package = cfg.theme.package; + }; + + iconTheme = { + name = cfg.iconTheme.name; + package = cfg.iconTheme.package; + }; + + font = { + name = cfg.font.name; + size = cfg.font.size; + }; + + gtk2 = { + configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc"; + extraConfig = '' + gtk-xft-antialias=1 + gtk-xft-hinting=1 + gtk-xft-hintstyle="hintslight" + gtk-xft-rgba="rgb" + ''; + }; + + gtk3.extraConfig = { + gtk-toolbar-style = "GTK_TOOLBAR_BOTH"; + gtk-toolbar-icon-size = "GTK_ICON_SIZE_LARGE_TOOLBAR"; + gtk-decoration-layout = "appmenu:none"; + gtk-button-images = 1; + gtk-menu-images = 1; + gtk-enable-event-sounds = 0; + gtk-enable-input-feedback-sounds = 0; + gtk-xft-antialias = 1; + gtk-xft-hinting = 1; + gtk-xft-hintstyle = "hintslight"; + gtk-error-bell = 0; + gtk-application-prefer-dark-theme = true; + }; + + gtk4.extraConfig = { + gtk-decoration-layout = "appmenu:none"; + gtk-enable-event-sounds = 0; + gtk-enable-input-feedback-sounds = 0; + gtk-xft-antialias = 1; + gtk-xft-hinting = 1; + gtk-xft-hintstyle = "hintslight"; + gtk-error-bell = 0; + gtk-application-prefer-dark-theme = true; + }; + }; +} diff --git a/home/themes/qt.nix b/home/themes/qt.nix new file mode 100644 index 0000000..0e257a7 --- /dev/null +++ b/home/themes/qt.nix @@ -0,0 +1,57 @@ +{ + pkgs, + lib, + osConfig, + ... +}: let + inherit (lib) mkIf mkMerge; + + cfg = osConfig.myOptions.home-manager.theme.qt; +in { + qt = { + enable = true; + platformTheme.name = mkIf cfg.forceGtk "gtk"; # just an override for QT_QPA_PLATFORMTHEME, takes "gtk", "gnome", "qtct" or "kde" + style = mkIf (!cfg.forceGtk) { + name = cfg.theme.name; + package = cfg.theme.package; + }; + }; + + home = { + packages = with pkgs; + mkMerge [ + [ + # libraries and programs to ensure that qt applications load without issue + # breeze-icons is added as a fallback + libsForQt5.qt5ct + kdePackages.qt6ct + breeze-icons + ] + + (mkIf cfg.forceGtk [ + # libraries to ensure that "gtk" platform theme works + # as intended after the following PR: + # + libsForQt5.qtstyleplugins + qt6Packages.qt6gtk2 + ]) + ]; + + sessionVariables = { + # scaling - 1 means no scaling + QT_AUTO_SCREEN_SCALE_FACTOR = "1"; + + # use wayland as the default backend, fallback to xcb if wayland is not available + QT_QPA_PLATFORM = "wayland;xcb"; + + # disable window decorations everywhere + QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; + + # remain backwards compatible with qt5 + DISABLE_QT5_COMPAT = "0"; + + # tell calibre to use the dark theme, because the light one hurts my eyes + CALIBRE_USE_DARK_PALETTE = "1"; + }; + }; +} diff --git a/options/home/default.nix b/options/home/default.nix index 9f3f0c2..8e7f5a8 100644 --- a/options/home/default.nix +++ b/options/home/default.nix @@ -6,6 +6,7 @@ in ./programs ./git.nix ./wms.nix + ./theme.nix ]; options.myOptions.home-manager = { diff --git a/options/home/theme.nix b/options/home/theme.nix new file mode 100644 index 0000000..0c7952e --- /dev/null +++ b/options/home/theme.nix @@ -0,0 +1,108 @@ +{ lib, pkgs, ... }: let + inherit (lib) mkEnableOption mkOption types; +in +{ + options.myOptions.home-manager.theme = { + gtk = { + enable = mkEnableOption "GTK theming optionss"; + usePortal = mkEnableOption "native desktop portal use for filepickers"; + + theme = { + name = mkOption { + type = types.str; + default = "Catppuccin-Mocha-Standard-Blue-dark"; + description = "The name for the GTK theme package"; + }; + + package = mkOption { + type = types.package; + description = "The theme package to be used for GTK programs"; + default = pkgs.catppuccin-gtk.override { + size = "standard"; + accents = ["blue"]; + variant = "mocha"; + tweaks = ["normal"]; + }; + }; + }; + + iconTheme = { + name = mkOption { + type = types.str; + description = "The name for the icon theme that will be used for GTK programs"; + default = "Papirus-Dark"; + }; + + package = mkOption { + type = types.package; + description = "The GTK icon theme package to be used"; + default = pkgs.catppuccin-papirus-folders.override { + accent = "blue"; + flavor = "mocha"; + }; + }; + }; + + font = { + name = mkOption { + type = types.str; + description = "The name of the font that will be used for GTK applications"; + default = "Lexend"; # Noto Sans + }; + + size = mkOption { + type = types.int; + description = "The size of the font"; + default = 14; # 10 + }; + }; + }; + + qt = { + forceGtk = mkOption { + type = types.bool; + default = false; + description = "Whether to force QT applications to try and use the GTK theme."; + }; + + theme = { + name = mkOption { + type = types.str; + default = "Catppuccin-Mocha-Dark"; + description = "The name for the QT theme package"; + }; + + package = mkOption { + type = types.package; + description = "The theme package to be used for QT programs"; + default = pkgs.catppuccin-kde.override { + flavour = ["mocha"]; + accents = ["blue"]; + winDecStyles = ["modern"]; + }; + }; + }; + }; + + cursor = { + name = mkOption { + type = types.str; + default = "catppuccin-mocha-dark-cursors"; + description = "The name of the cursor inside the package"; + }; + + package = mkOption { + type = types.package; + default = pkgs.catppuccin-cursors.mochaDark; + description = "The package providing the cursors"; + }; + + size = mkOption { + type = types.int; + default = 24; + description = "The size of the cursor"; + }; + }; + + }; +} From 217cf71d4386d69532e5914afacbb1ca9e05d37b Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Thu, 20 Jun 2024 22:09:27 +0200 Subject: [PATCH 4/5] Add material-symbols & jost fonts --- system/roles/workstation/fonts.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/system/roles/workstation/fonts.nix b/system/roles/workstation/fonts.nix index 00e7477..a464040 100644 --- a/system/roles/workstation/fonts.nix +++ b/system/roles/workstation/fonts.nix @@ -25,6 +25,7 @@ in { sansSerif = [ "Lexend" "Noto Sans" + "Jost" ] ++ common; @@ -63,6 +64,7 @@ in { inter lato lexend + jost dejavu_fonts noto-fonts noto-fonts-cjk @@ -73,6 +75,7 @@ in { openmoji-color openmoji-black font-awesome + material-symbols # defaults worth keeping dejavu_fonts From f1bda719c6c7cabe521fab6af1278b57748390eb Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Thu, 20 Jun 2024 22:12:20 +0200 Subject: [PATCH 5/5] Use Noto Sans instead of Lexend as gtk font --- options/home/theme.nix | 4 ++-- system/roles/workstation/fonts.nix | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/options/home/theme.nix b/options/home/theme.nix index 0c7952e..a2e76bb 100644 --- a/options/home/theme.nix +++ b/options/home/theme.nix @@ -47,13 +47,13 @@ in name = mkOption { type = types.str; description = "The name of the font that will be used for GTK applications"; - default = "Lexend"; # Noto Sans + default = "Noto Sans"; # Lexend }; size = mkOption { type = types.int; description = "The size of the font"; - default = 14; # 10 + default = 10; # 10 }; }; }; diff --git a/system/roles/workstation/fonts.nix b/system/roles/workstation/fonts.nix index a464040..600b778 100644 --- a/system/roles/workstation/fonts.nix +++ b/system/roles/workstation/fonts.nix @@ -23,9 +23,9 @@ in { ++ common; sansSerif = [ - "Lexend" "Noto Sans" "Jost" + "Lexend" ] ++ common;