186 lines
5.4 KiB
Nix
186 lines
5.4 KiB
Nix
{ pkgs, lib, config, ... }:
|
|
|
|
with lib;
|
|
with lib.my;
|
|
let
|
|
cfg = config.modules.desktop.themes;
|
|
in {
|
|
options.modules.desktop.themes = with types; {
|
|
active = mkOption {
|
|
type = types.nullOr types.str;
|
|
default = null;
|
|
description = "Name of the theme to apply; see modules/desktop/themes for a list of valid options";
|
|
};
|
|
|
|
dark = mkOpt bool false;
|
|
|
|
gtkTheme = {
|
|
name = mkOpt str "";
|
|
package = mkPackageOption pkgs "gtk" {};
|
|
};
|
|
kvantumTheme = {
|
|
name = mkOpt str "";
|
|
package = mkPackageOption pkgs "kvantum" {};
|
|
};
|
|
iconTheme = {
|
|
name = mkOpt str "";
|
|
package = mkPackageOption pkgs "icon" {};
|
|
};
|
|
cursorTheme = {
|
|
name = mkOpt str "";
|
|
package = mkPackageOption pkgs "cursor" {};
|
|
size = mkOpt int 24;
|
|
};
|
|
|
|
editor = {
|
|
vscode = {
|
|
colorTheme = {
|
|
name = mkOpt str "";
|
|
extension = mkPackageOption pkgs "extension" {};
|
|
};
|
|
iconTheme = {
|
|
name = mkOpt str "";
|
|
extension = mkPackageOption pkgs "extension" {};
|
|
};
|
|
};
|
|
};
|
|
|
|
niri = {
|
|
accent = mkOpt str "";
|
|
inactive = mkOpt str "";
|
|
shadow = mkOpt str "";
|
|
};
|
|
|
|
waybar = mkOpt str "";
|
|
|
|
wob = {
|
|
borderColor = mkOpt (nullOr str) null;
|
|
backgroundColor = mkOpt (nullOr str) null;
|
|
barColor = mkOpt (nullOr str) null;
|
|
};
|
|
|
|
rofi = mkOpt (nullOr str) null;
|
|
|
|
fuzzel = mkOpt (nullOr str) null;
|
|
|
|
wezterm = mkOpt (nullOr str) null;
|
|
};
|
|
|
|
config = mkIf (cfg.active != null) {
|
|
programs.dconf.enable = true;
|
|
# i think this may be done by ohome-manager already??
|
|
# better safe than sorry
|
|
hm.dconf = {
|
|
enable = true;
|
|
settings."org/gnome/desktop/interface".color-scheme = mkIf cfg.dark "prefer-dark";
|
|
settings."org/gnome/desktop/interface".gtk-theme = cfg.gtkTheme.name;
|
|
settings."org/gnome/desktop/interface".icon-theme = cfg.iconTheme.name;
|
|
settings."org/gnome/desktop/interface".cursor-theme = cfg.cursorTheme.name;
|
|
settings."org/gnome/desktop/interface".cursor-size = cfg.cursorTheme.size;
|
|
|
|
settings."org/gnome/shell/extensions/user-theme".name = cfg.gtkTheme.name;
|
|
};
|
|
|
|
hm.gtk = {
|
|
enable = true;
|
|
cursorTheme = {
|
|
name = cfg.cursorTheme.name;
|
|
package = cfg.cursorTheme.package;
|
|
size = cfg.cursorTheme.size;
|
|
};
|
|
iconTheme = cfg.iconTheme;
|
|
theme = cfg.gtkTheme;
|
|
gtk3.extraConfig.gtk-application-prefer-dark-theme = mkIf cfg.dark "1";
|
|
gtk4.extraConfig.gtk-application-prefer-dark-theme = mkIf cfg.dark "1";
|
|
};
|
|
|
|
hm.qt = {
|
|
enable = true;
|
|
platformTheme.name = "qtct";
|
|
style.name = "kvantum";
|
|
};
|
|
|
|
hm.home.pointerCursor = {
|
|
gtk.enable = true;
|
|
x11.enable = true;
|
|
name = cfg.cursorTheme.name;
|
|
package = cfg.cursorTheme.package;
|
|
size = cfg.cursorTheme.size;
|
|
};
|
|
|
|
hm.services.dunst.iconTheme = {
|
|
name = cfg.iconTheme.name;
|
|
package = cfg.iconTheme.package;
|
|
};
|
|
|
|
hm.programs.vscode.profiles.default = {
|
|
extensions = [
|
|
cfg.editor.vscode.colorTheme.extension
|
|
cfg.editor.vscode.iconTheme.extension
|
|
];
|
|
userSettings = {
|
|
"workbench.colorTheme" = cfg.editor.vscode.colorTheme.name;
|
|
"workbench.iconTheme" = cfg.editor.vscode.iconTheme.name;
|
|
};
|
|
};
|
|
|
|
hm.programs.waybar.style = cfg.waybar;
|
|
|
|
hm.services.wob.settings."" = {
|
|
border_color = cfg.wob.borderColor;
|
|
background_color = cfg.wob.backgroundColor;
|
|
bar_color = cfg.wob.barColor;
|
|
};
|
|
|
|
# silly litle hack--rofi hm module doesn't play nice with strings
|
|
# so, we have to write the config to a file and then read it :P
|
|
# ...and then back to a string
|
|
hm.programs.rofi.theme = "${pkgs.writeTextFile {
|
|
name = "rofi-theme.rasi";
|
|
text = cfg.rofi;
|
|
}}";
|
|
|
|
hm.programs.fuzzel.settings.main = {
|
|
include = cfg.fuzzel;
|
|
icon-theme = cfg.iconTheme.name;
|
|
};
|
|
|
|
hm.xdg.configFile = let
|
|
iniFmt = pkgs.formats.ini {};
|
|
|
|
# souls are forged in the fires of hell
|
|
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";
|
|
};
|
|
|
|
Fonts = with config.modules.desktop.fonts.fonts; {
|
|
general = ''"${sansSerif.family},${toString sansSerif.size},-1,5,${toString weight},${zeros},1"'';
|
|
fixed = ''"${monospace.family},-1,${toString monospace.size},5,${toString weight},${zeros},1"'';
|
|
};
|
|
};
|
|
in {
|
|
# technically could cause issues with KDE if we use that
|
|
# not a concern for now
|
|
"kdeglobals".text = ''
|
|
[Icons]
|
|
Theme=${cfg.iconTheme.name}
|
|
'';
|
|
|
|
"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);
|
|
};
|
|
};
|
|
}
|