From e093e7ecadd7965ebee051dc837887f5d3868533 Mon Sep 17 00:00:00 2001 From: isabel Date: Wed, 16 Aug 2023 20:42:48 +0100 Subject: [PATCH] themeing update --- .../gui/confs/bars/waybar/default.nix | 3 +- home/isabel/themes/global.nix | 2 + home/isabel/themes/gtk.nix | 2 + home/isabel/themes/qt.nix | 20 +-- modules/common/options/themes/default.nix | 13 +- .../shared/home-manager/gtklock/default.nix | 136 +++++++----------- 6 files changed, 82 insertions(+), 94 deletions(-) diff --git a/home/isabel/programs/gui/confs/bars/waybar/default.nix b/home/isabel/programs/gui/confs/bars/waybar/default.nix index 9d925ed21..4c5feb4f9 100644 --- a/home/isabel/programs/gui/confs/bars/waybar/default.nix +++ b/home/isabel/programs/gui/confs/bars/waybar/default.nix @@ -2,7 +2,6 @@ config, pkgs, lib, - inputs', osConfig, defaults, ... @@ -17,7 +16,7 @@ in { home.packages = with pkgs; [wlogout]; programs.waybar = { enable = true; - package = inputs'.hyprland.packages.waybar-hyprland; + package = pkgs.waybar-hyprland; settings = { mainBar = { layer = "top"; diff --git a/home/isabel/themes/global.nix b/home/isabel/themes/global.nix index 93a924638..4585b90db 100644 --- a/home/isabel/themes/global.nix +++ b/home/isabel/themes/global.nix @@ -16,6 +16,8 @@ in { }; }; + /* i18n.inputMethod.enabled = "fcitx5"; i18n.inputMethod.fcitx5.addons = with pkgs; [fcitx5-mozc]; + */ } diff --git a/home/isabel/themes/gtk.nix b/home/isabel/themes/gtk.nix index b85fcffa5..766e71b28 100644 --- a/home/isabel/themes/gtk.nix +++ b/home/isabel/themes/gtk.nix @@ -19,6 +19,8 @@ in { home = { packages = with pkgs; [ glib # gsettings + cfg.gtk.theme.package + cfg.gtk.iconTheme.package ]; sessionVariables = { diff --git a/home/isabel/themes/qt.nix b/home/isabel/themes/qt.nix index 348f3db7b..d2828dd56 100644 --- a/home/isabel/themes/qt.nix +++ b/home/isabel/themes/qt.nix @@ -4,23 +4,22 @@ osConfig, ... }: let + inherit (lib) mkIf; inherit (osConfig.modules) device; sys = osConfig.modules.system; + cfg = osConfig.modules.style; acceptedTypes = ["laptop" "desktop" "hybrid" "lite"]; in { - config = lib.mkIf (builtins.elem device.type acceptedTypes && sys.video.enable) { - xdg.configFile."kdeglobals".source = "${(pkgs.catppuccin-kde.override { - flavour = ["mocha"]; - accents = ["blue"]; - winDecStyles = ["modern"]; - })}/share/color-schemes/CatppuccinMochaBlue.colors"; + config = mkIf (builtins.elem device.type acceptedTypes && sys.video.enable) { + xdg.configFile."kdeglobals".source = cfg.qt.kdeglobals.source; + qt = { enable = true; - platformTheme = "gtk"; # just an override for QT_QPA_PLATFORMTHEME, takes "gtk" or "gnome" + platformTheme = mkIf cfg.forceGtk "gtk"; # just an override for QT_QPA_PLATFORMTHEME, takes "gtk" or "gnome" style = { - package = pkgs.catppuccin-kde; - name = "Catpuccin-Mocha-Dark"; + name = "${cfg.qt.theme.name}"; + package = cfg.qt.theme.package; }; }; @@ -32,6 +31,9 @@ in { libsForQt5.qtstyleplugin-kvantum libsForQt5.qt5ct breeze-icons + + # add theme package to path just in case + cfg.qt.theme.package ]; home.sessionVariables = { diff --git a/modules/common/options/themes/default.nix b/modules/common/options/themes/default.nix index 4eef7ef85..045bf8a27 100644 --- a/modules/common/options/themes/default.nix +++ b/modules/common/options/themes/default.nix @@ -55,10 +55,14 @@ in { # qt specific options qt = { - style = { + theme = { package = mkOption { type = types.package; - default = pkgs.catppucin-kde; + default = pkgs.catppucin-kde.override { + flavour = ["mocha"]; + accents = ["sapphire"]; + winDecStyles = ["modern"]; + }; description = "The theme package to be used for QT programs"; }; name = mkOption { @@ -67,6 +71,11 @@ in { description = "The name for the QT theme package"; }; }; + + kdeglobals.source = mkOption { + type = types.path; + default = "${cfg.qt.theme.package}/"; + }; }; # gtk specific options diff --git a/modules/extra/shared/home-manager/gtklock/default.nix b/modules/extra/shared/home-manager/gtklock/default.nix index ce7757001..d215abbef 100644 --- a/modules/extra/shared/home-manager/gtklock/default.nix +++ b/modules/extra/shared/home-manager/gtklock/default.nix @@ -1,97 +1,71 @@ { - config, - lib, pkgs, + lib, + config, + osConfig, ... }: -with builtins; let - cfg = config.programs.gtklock; +with lib; let + dev = osConfig.modules.device; + vid = osConfig.modules.system.video; + env = osConfig.modules.usrEnv; - inherit (lib) types mkIf mkOption mkEnableOption mkPackageOptionMD mdDoc literalExpression optionals optionalString; - inherit (lib.generators) toINI; + acceptedTypes = ["desktop" "laptop" "lite" "hybrid"]; +in { + config = mkIf ((builtins.elem dev.type acceptedTypes && env.screenLock == "gtklock") && (vid.enable && env.isWayland)) { + programs.gtklock = { + enable = true; + package = pkgs.gtklock; - baseConfig = '' - [main] - ${optionalString (cfg.config.gtk-theme != "") "gtk-theme=${cfg.config.gtk-theme}"} - ${optionalString (cfg.config.style != "") "style=${cfg.config.style}"} - ${optionalString (cfg.config.modules != []) "modules=${concatStringsSep ";" cfg.config.modules}"} - ''; + config = { + modules = [ + "${pkgs.gtklock-powerbar-module.outPath}/lib/gtklock/powerbar-module.so" + ]; - finalConfig = baseConfig + optionals (cfg.extraConfig != null) (toINI {} cfg.extraConfig); -in { - meta.maintainers = [maintainers.NotAShelf]; - options.programs.gtklock = { - enable = mkEnableOption "GTK-based lockscreen for Wayland"; - package = mkPackageOptionMD pkgs "gtklock" {}; + style = pkgs.writeText "gtklock-style.css" '' + window { + background-size: cover; + background-repeat: no-repeat; + background-position: center; + } - config = { - gtk-theme = mkOption { - type = types.str; - default = ""; - description = mdDoc '' - GTK theme to use for gtklock. - ''; - example = "Adwaita-dark"; - }; - style = mkOption { - type = with types; oneOf [str path]; - default = ""; - description = mdDoc '' - The css file to be used for gtklock. - ''; - example = literalExpression '' - pkgs.writeText "gtklock-style.css" ''' - window { - background-size: cover; - background-repeat: no-repeat; - background-position: center; - } - ''' - ''; - }; + #clock-label { + margin-bottom: 30px; + font-size: 800%; + font-weight: bold; + color: white; + text-shadow: 0px 2px 10px rgba(0,0,0,.1) + } - modules = mkOption { - type = with types; listOf (either package str); - default = []; - description = mdDoc '' - A list of gtklock modulesto use. Can either be packages, absolute paths, or strings. - ''; - example = literalExpression '' - [ - "${pkgs.gtklock-powerbar-module.outPath}/lib/gtklock/powerbar-module.so" - "${pkgs.gtklock-playerctl-module.outPath}/lib/gtklock/playerctl-module.so" - ]; + #body { + margin-top: 50px; + } + + #unlock-button { + all: unset; + color: transparent; + } + + entry { + border-radius: 12px; + margin: 1px; + box-shadow: 1px 2px 4px rgba(0,0,0,.1) + } + + #input-label { + color: transparent; + margin: -20rem; + } + + #powerbar-box * { + border-radius: 12px; + box-shadow: 1px 2px 4px rgba(0,0,0,.1) + } ''; }; - }; - extraConfig = mkOption { - type = with types; nullOr attrs; - default = { - countdown = { - countdown-position = "top-right"; - justify = "right"; - countdown = 20; - }; - }; - description = mdDoc '' - Extra configuration to append to gtklock configuration file. - Mostly used for appending module configurations. - ''; - example = literalExpression '' - countdown = { - countdown-position = "top-right"; - justify = "right"; - countdown = 20; - } - ''; + extraConfig = {}; }; }; - - config = mkIf cfg.enable { - home.packages = [cfg.package]; - - xdg.configFile."gtklock/config.ini".source = pkgs.writeText "gtklock-config.ini" finalConfig; - }; }