dark theme

This commit is contained in:
2026-09-23 00:29:45 +05:00
parent aeacd41521
commit 12fea5c39e
3 changed files with 70 additions and 0 deletions
+1
View File
@@ -10,6 +10,7 @@
./nano.nix
./obs.nix
./sway.nix
./theme.nix
];
home.username = "shihaam";
+61
View File
@@ -0,0 +1,61 @@
# Dark theme for GTK and Qt apps.
#
# There is no desktop environment on this machine to hand apps a theme, so
# every toolkit has to be told separately:
#
# GTK2 ~/.gtkrc-2.0 + GTK2_RC_FILES -- adw-gtk3 has no GTK2 variant, so
# old apps get Adwaita-dark from gnome-themes-extra instead.
# GTK3 gtk-3.0/settings.ini (gtk-theme-name + prefer-dark).
# GTK4 libadwaita apps ignore gtk-theme-name; they follow the
# color-scheme=prefer-dark that the gtk3 module also writes into
# dconf, which is why programs.dconf.enable is on system-side.
# Electron/ Chromium, Brave, Firefox and friends ask the settings portal for
# browsers color-scheme, and xdg-desktop-portal-gtk answers from that same
# dconf key.
# Qt5/Qt6 qt5ct/qt6ct, because nixpkgs builds qtbase without the qgtk3
# platform theme (withGtk3 = false), so QT_QPA_PLATFORMTHEME=gtk3
# would silently do nothing.
{ pkgs, ... }:
{
gtk = {
enable = true;
colorScheme = "dark";
theme = {
name = "adw-gtk3-dark";
package = pkgs.adw-gtk3;
};
iconTheme = {
name = "Adwaita";
package = pkgs.adwaita-icon-theme;
};
gtk2.theme = {
name = "Adwaita-dark";
package = pkgs.gnome-themes-extra;
};
};
qt = {
enable = true;
platformTheme.name = "qtct";
# Pulls adwaita-qt{,6} in without setting QT_STYLE_OVERRIDE -- that
# variable makes qt5ct/qt6ct skip their own config entirely.
style.package = [ pkgs.adwaita-qt pkgs.adwaita-qt6 ];
qt5ctSettings.Appearance = {
style = "Adwaita-Dark";
icon_theme = "Adwaita";
standard_dialogs = "xdgdesktopportal";
};
qt6ctSettings.Appearance = {
style = "Adwaita-Dark";
icon_theme = "Adwaita";
standard_dialogs = "xdgdesktopportal";
};
};
}
+8
View File
@@ -250,9 +250,17 @@ security.doas.extraRules = [
default = [ "wlr" "gtk" ];
"org.freedesktop.impl.portal.ScreenCast" = [ "wlr" ];
"org.freedesktop.impl.portal.Screenshot" = [ "wlr" ];
# How browsers and Electron apps learn the dark preference; wlr has no
# Settings implementation, so it has to be pinned to gtk explicitly.
"org.freedesktop.impl.portal.Settings" = [ "gtk" ];
};
};
# GTK4/libadwaita apps and the settings portal read the dark preference out
# of dconf (see home/theme.nix), which needs a real dconf backend -- there is
# no desktop environment here to enable one.
programs.dconf.enable = true;
programs.waybar.enable = true;
programs.xfconf.enable = true;