mirror of
https://github.com/ItsDrike/nixdots
synced 2025-06-29 08:20:43 +00:00
Add theme configuration (gtk,qt,cursor)
This commit is contained in:
parent
1d519de3fe
commit
042514bb3a
7 changed files with 270 additions and 0 deletions
|
@ -33,6 +33,7 @@ in
|
|||
./packages
|
||||
./programs
|
||||
./impermanence
|
||||
./themes
|
||||
];
|
||||
|
||||
config = {
|
||||
|
|
16
home/themes/cursor.nix
Normal file
16
home/themes/cursor.nix
Normal file
|
@ -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;
|
||||
};
|
||||
};
|
||||
}
|
7
home/themes/default.nix
Normal file
7
home/themes/default.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
imports = [
|
||||
./gtk.nix
|
||||
./qt.nix
|
||||
./cursor.nix
|
||||
];
|
||||
}
|
80
home/themes/gtk.nix
Normal file
80
home/themes/gtk.nix
Normal file
|
@ -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;
|
||||
};
|
||||
};
|
||||
}
|
57
home/themes/qt.nix
Normal file
57
home/themes/qt.nix
Normal file
|
@ -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:
|
||||
# <https://github.com/nix-community/home-manager/pull/5156>
|
||||
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";
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue