Further progress, improved dark mode handling

This commit is contained in:
Jan Bulthuis 2024-07-19 01:00:39 +02:00
parent 36c9c7a90d
commit 23c2ef87b0
7 changed files with 295 additions and 163 deletions

View File

@ -11,6 +11,8 @@
./foot/default.nix
./mako/default.nix
./obsidian/default.nix
./rofi/default.nix
./rofi/rofi-rbw.nix
./shell/bash.nix
./shell/fish.nix
./steam/default.nix

View File

@ -11,6 +11,7 @@ in {
];
options.modules.desktop = {
wayland = mkEnableOption "wayland";
initScript = mkOption {
type = types.lines;
default = "${pkgs.bash}/bin/bash";
@ -19,6 +20,11 @@ in {
};
config = {
home.packages = optionals cfg.wayland (with pkgs; [
pkgs.wl-clipboard
pkgs.wtype
]);
home.file.".initrc" = {
enable = true;
executable = true;

View File

@ -10,6 +10,9 @@ in {
# };
config = lib.mkIf cfg.enable {
# Set desktop type to wayland
modules.desktop.wayland = true;
# Change desktop to execute river
modules.desktop.initScript = ''
river

View File

@ -0,0 +1,53 @@
{config, lib, pkgs, ... }:
with lib;
let
cfg = config.modules.rofi;
theme = config.theming;
colors = theme.colors;
in {
options.modules.rofi.enable = mkEnableOption "rofi";
config = mkIf cfg.enable {
programs.rofi = {
enable = true;
package = pkgs.rofi-wayland;
font = "${theme.fonts.monospace.name} ${toString theme.fonts.monospace.recommendedSize}";
theme = let
inherit (config.lib.formats.rasi) mkLiteral;
in {
"*" = {
background-color = mkLiteral "rgba(0, 0, 0, 0%)";
border-color = mkLiteral "#${colors.fg}";
text-color = mkLiteral "#${colors.fg}";
};
mainbox = {
background-color = mkLiteral "#${colors.bg}";
border = mkLiteral "${toString theme.layout.borderSize}px";
};
element-text = {
highlight = mkLiteral "#${colors.accent}";
};
inputbar = {
children = mkLiteral "[textbox-search, entry]";
};
listview = {
padding = mkLiteral "2px 0px";
};
textbox-search = {
expand = false;
content = "> ";
};
"inputbar, message" = {
padding = mkLiteral "2px";
};
element = {
padding = mkLiteral "0px 2px";
};
"element selected" = {
background-color = mkLiteral "#${colors.focused}";
};
};
};
};
}

View File

@ -0,0 +1,27 @@
{config, lib, pkgs, ... }:
with lib;
let
cfg = config.modules.rofi-rbw;
in {
options.modules.rofi-rbw.enable = mkEnableOption "rofi-rbw";
config = mkIf cfg.enable {
modules.rofi.enable = true;
home.packages = [
pkgs.rofi-rbw
];
# TODO: Move to separate module and make configurable
programs.rbw = {
enable = true;
settings = {
base_url = "https://keys.bulthuis.dev";
identity_url = "https://keys.bulthuis.dev";
email = "jan@bulthuis.dev";
pinentry = pkgs.pinentry;
};
};
};
}

View File

@ -104,6 +104,12 @@ in {
description = "Base 16 color scheme to use for styling. See stylix documentation for more information.";
};
clientSideDecorations = mkOption {
type = types.bool;
default = false;
description = "Whether to enable client side decorations for windows.";
};
schemeColors = mkOption {
type = types.attrsOf types.anything;
default = config.lib.stylix.colors;
@ -208,6 +214,45 @@ in {
# Install configured fonts
home.packages = fontPackageList;
# Configure gnome theme
dconf.settings = {
"org/gnome/desktop/interface" = {
color-scheme = if cfg.darkMode then "prefer-dark" else "prefer-light";
};
};
# Configure qt theme
qt = {
enable = true;
platformTheme.name = "adwaita";
style.name = if cfg.darkMode then "adwaita-dark" else "adwaita-light";
};
# Configure gtk theme
gtk = let
disableCSD = ''
headerbar.default-decoration {
margin-bottom: 50px;
margin-top: -100px;
}
window.csd,
window.csd decoration {
box-shadow: none;
}
'';
in {
enable = true;
theme = {
name = if cfg.darkMode then "Adwaita-dark" else "Adwaita-light";
package = pkgs.gnome-themes-extra;
};
gtk3.extraCss = mkIf !cfg.clientSideDecorations disableCSD;
gtk4.extraCss = mkIf !cfg.clientSideDecorations disableCSD;
}
# Enable stylix
# TODO: Move to own module
stylix = {

View File

@ -26,29 +26,25 @@ in {
# Utilities
pulsemixer
wl-clipboard
pinentry-rofi
wtype
# waylock
playerctl
nix-tree
# Fish plugin dependencies
# grc
# fzf
# Rust development
rustc
cargo
rustfmt
# rustc
# cargo
# rustfmt
# Bitwarden
rofi-rbw
# rofi-rbw
# LaTeX libraries
(pkgs.texlive.combine {
inherit (pkgs.texlive) scheme-full;
})
# (pkgs.texlive.combine {
# inherit (pkgs.texlive) scheme-full;
# })
];
# Stylix
@ -57,25 +53,25 @@ in {
# polarity = "dark";
# base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-hard.yaml";
fonts = {
# monospace = {
# package = pkgs.dina-font;
# name = "Dina";
# };
# fonts = {
# # monospace = {
# # package = pkgs.dina-font;
# # name = "Dina";
# # };
sizes = {
terminal = 9;
};
};
# sizes = {
# terminal = 9;
# };
# };
# autoEnable = false;
targets = {
foot.enable = true;
nixvim.enable = true;
qutebrowser.enable = true;
vscode.enable = true;
# zathura.enable = true;
};
# targets = {
# foot.enable = true;
# nixvim.enable = true;
# qutebrowser.enable = true;
# vscode.enable = true;
# # zathura.enable = true;
# };
};
# Fish shell
@ -136,128 +132,128 @@ in {
};
# Bitwarden client
programs.rbw = {
enable = true;
settings = {
base_url = "https://keys.bulthuis.dev";
identity_url = "https://keys.bulthuis.dev";
email = "jan@bulthuis.dev";
pinentry = pkgs.pinentry;
};
};
# programs.rbw = {
# enable = true;
# settings = {
# base_url = "https://keys.bulthuis.dev";
# identity_url = "https://keys.bulthuis.dev";
# email = "jan@bulthuis.dev";
# pinentry = pkgs.pinentry;
# };
# };
# Firefox
programs.firefox = {
enable = true;
policies = {
AppAutoUpdate = false;
BlockAboutAddons = true;
BlockAboutConfig = true;
BlockAboutProfiles = true;
DisableAppUpdate = true;
DisableFeedbackCommands = true;
DisableMasterPasswordCreation = true;
DisablePocket = true;
DisableProfileImport = true;
DisableProfileRefresh = true;
DisableSetDesktopBackground = true;
DisableTelemetry = true;
DisplayBookmarksToolbar = "never";
DisplayMenuBar = "never";
DNSOverHTTPS = { Enabled = false; };
DontCheckDefaultBrowser = true;
PasswordManagerEnabled = false;
TranslateEnabled = true;
UseSystemPrintDialog = true;
};
profiles.nixos = {
search.default = "DuckDuckGo";
# programs.firefox = {
# enable = true;
# policies = {
# AppAutoUpdate = false;
# BlockAboutAddons = true;
# BlockAboutConfig = true;
# BlockAboutProfiles = true;
# DisableAppUpdate = true;
# DisableFeedbackCommands = true;
# DisableMasterPasswordCreation = true;
# DisablePocket = true;
# DisableProfileImport = true;
# DisableProfileRefresh = true;
# DisableSetDesktopBackground = true;
# DisableTelemetry = true;
# DisplayBookmarksToolbar = "never";
# DisplayMenuBar = "never";
# DNSOverHTTPS = { Enabled = false; };
# DontCheckDefaultBrowser = true;
# PasswordManagerEnabled = false;
# TranslateEnabled = true;
# UseSystemPrintDialog = true;
# };
# profiles.nixos = {
# search.default = "DuckDuckGo";
extensions = with pkgs.nur.repos.rycee.firefox-addons; [
ublock-origin
];
# extensions = with pkgs.nur.repos.rycee.firefox-addons; [
# ublock-origin
# ];
settings = {
"browser.tabs.inTitlebar" = 0;
"extensions.autoDisableScopes" = 0;
};
# settings = {
# "browser.tabs.inTitlebar" = 0;
# "extensions.autoDisableScopes" = 0;
# };
# Force overwriting configuration file
search.force = true;
containersForce = true;
};
};
# # Force overwriting configuration file
# search.force = true;
# containersForce = true;
# };
# };
# Email setup
accounts.email.accounts = {
Personal = {
primary = true;
realName = "Jan Bulthuis";
userName = "jan@bulthuis.dev";
address = "jan@bulthuis.dev";
thunderbird.enable = true;
# # Email setup
# accounts.email.accounts = {
# Personal = {
# primary = true;
# realName = "Jan Bulthuis";
# userName = "jan@bulthuis.dev";
# address = "jan@bulthuis.dev";
# thunderbird.enable = true;
flavor = "plain";
imap = {
host = "mail.bulthuis.dev";
port = 993;
};
smtp = {
host = "mail.bulthuis.dev";
port = 465;
};
};
};
# flavor = "plain";
# imap = {
# host = "mail.bulthuis.dev";
# port = 993;
# };
# smtp = {
# host = "mail.bulthuis.dev";
# port = 465;
# };
# };
# };
# Thunderbird setup
programs.thunderbird = {
enable = true;
profiles.nixos = {
isDefault = true;
};
};
# # Thunderbird setup
# programs.thunderbird = {
# enable = true;
# profiles.nixos = {
# isDefault = true;
# };
# };
# Rofi setup
programs.rofi = {
enable = true;
package = pkgs.rofi-wayland;
font = "${fonts.monospace.name} ${toString fonts.sizes.terminal}";
theme = let
inherit (config.lib.formats.rasi) mkLiteral;
in {
"*" = {
background-color = mkLiteral "rgba(0, 0, 0, 0%)";
border-color = mkLiteral colors.withHashtag.base05;
text-color = mkLiteral colors.withHashtag.base05;
};
mainbox = {
background-color = mkLiteral colors.withHashtag.base00;
border = mkLiteral "${toString borderSize}px";
};
element-text = {
highlight = mkLiteral colors.withHashtag.base09;
};
inputbar = {
children = mkLiteral "[textbox-search, entry]";
};
listview = {
padding = mkLiteral "2px 0px";
};
textbox-search = {
expand = false;
content = "> ";
};
"inputbar, message" = {
padding = mkLiteral "2px";
};
element = {
padding = mkLiteral "0px 2px";
};
"element selected" = {
background-color = mkLiteral colors.withHashtag.base02;
};
};
};
# programs.rofi = {
# enable = true;
# package = pkgs.rofi-wayland;
# font = "${fonts.monospace.name} ${toString fonts.sizes.terminal}";
# theme = let
# inherit (config.lib.formats.rasi) mkLiteral;
# in {
# "*" = {
# background-color = mkLiteral "rgba(0, 0, 0, 0%)";
# border-color = mkLiteral colors.withHashtag.base05;
# text-color = mkLiteral colors.withHashtag.base05;
# };
# mainbox = {
# background-color = mkLiteral colors.withHashtag.base00;
# border = mkLiteral "${toString borderSize}px";
# };
# element-text = {
# highlight = mkLiteral colors.withHashtag.base09;
# };
# inputbar = {
# children = mkLiteral "[textbox-search, entry]";
# };
# listview = {
# padding = mkLiteral "2px 0px";
# };
# textbox-search = {
# expand = false;
# content = "> ";
# };
# "inputbar, message" = {
# padding = mkLiteral "2px";
# };
# element = {
# padding = mkLiteral "0px 2px";
# };
# "element selected" = {
# background-color = mkLiteral colors.withHashtag.base02;
# };
# };
# };
# Dark mode
dconf.settings = {
@ -270,34 +266,34 @@ in {
platformTheme.name = "adwaita";
style.name = "adwaita-dark";
};
systemd.user.sessionVariables = config.home.sessionVariables;
# systemd.user.sessionVariables = config.home.sessionVariables;
# Configure GTK
gtk = let
css = ''
headerbar.default-decoration {
margin-bottom: 50px;
margin-top: -100px;
}
# gtk = let
# css = ''
# headerbar.default-decoration {
# margin-bottom: 50px;
# margin-top: -100px;
# }
window.csd,
window.csd decoration {
box-shadow: none;
}
'';
in {
enable = true;
# window.csd,
# window.csd decoration {
# box-shadow: none;
# }
# '';
# in {
# enable = true;
# Dark mode
theme = {
name = "Adwaita-dark";
package = pkgs.gnome-themes-extra;
};
# # Dark mode
# theme = {
# name = "Adwaita-dark";
# package = pkgs.gnome-themes-extra;
# };
# Disable CSD
gtk3.extraCss = css;
gtk4.extraCss = css;
};
# # Disable CSD
# gtk3.extraCss = css;
# gtk4.extraCss = css;
# };
# Cursors
home.pointerCursor = {
@ -647,5 +643,5 @@ in {
'';
};
home.stateVersion = "24.05";
# home.stateVersion = "24.05";
}