From cc8a463068641171dab71db0eb4b56400c7101e9 Mon Sep 17 00:00:00 2001 From: winston Date: Fri, 3 May 2024 04:56:26 +0200 Subject: [PATCH] feat(darkman): fix config & sync gtk, waybar --- home/apps/colorscheme-sync.nix | 23 +++-- home/apps/waybar.nix | 151 +++++++++++++++++++-------------- 2 files changed, 105 insertions(+), 69 deletions(-) diff --git a/home/apps/colorscheme-sync.nix b/home/apps/colorscheme-sync.nix index 96c8116..fad8e5d 100644 --- a/home/apps/colorscheme-sync.nix +++ b/home/apps/colorscheme-sync.nix @@ -7,9 +7,7 @@ inherit (pkgs.stdenv) isDarwin isLinux; vividBuilder = flavor: - pkgs.runCommand "vivid-${flavor}" { - nativeBuildInputs = [pkgs.vivid]; - } '' + pkgs.runCommand "vivid-${flavor}" {nativeBuildInputs = [pkgs.vivid];} '' vivid generate ${pkgs.vivid.src}/themes/catppuccin-${flavor}.yml > $out ''; vividLatte = vividBuilder "latte"; @@ -19,7 +17,10 @@ in { home.packages = [ (pkgs.writeShellApplication { name = "dark-mode-ternary"; - runtimeInputs = lib.optionals isLinux [pkgs.dbus pkgs.gnugrep]; + runtimeInputs = lib.optionals isLinux [ + pkgs.dbus + pkgs.gnugrep + ]; text = let queryCommand = if isLinux @@ -43,9 +44,21 @@ in { enable = isLinux; settings = { lat = config.location.latitude; - lon = config.location.longitude; + lng = config.location.longitude; useGeoclue = false; }; + lightModeScripts = { + gtk-theme = '' + ${pkgs.dconf}/bin/dconf write \ + /org/gnome/desktop/interface/color-scheme "'prefer-light'" + ''; + }; + darkModeScripts = { + gtk-theme = '' + ${pkgs.dconf}/bin/dconf write \ + /org/gnome/desktop/interface/color-scheme "'prefer-dark'" + ''; + }; }; programs.zsh = { diff --git a/home/apps/waybar.nix b/home/apps/waybar.nix index daf0ae3..86ef503 100644 --- a/home/apps/waybar.nix +++ b/home/apps/waybar.nix @@ -13,7 +13,12 @@ margin = "2"; modules-center = ["hyprland/window"]; - modules-right = ["tray" "idle_inhibitor" "pulseaudio" "clock"]; + modules-right = [ + "tray" + "idle_inhibitor" + "pulseaudio" + "clock" + ]; idle_inhibitor = { format = "{icon}"; @@ -27,10 +32,86 @@ pulseaudio = { format = "{icon} {volume}%"; - format-icons.default = ["" "" ""]; + format-icons.default = [ + "" + "" + "" + ]; on-click = "pavucontrol"; }; }; + + darkColors = '' + @define-color red #f38ba8; + @define-color pink #f5c2e7; + @define-color crust #11111c; + @define-color base #1e1e2e; + @define-color text #cdd6f4; + @define-color surface0 #313244; + @define-color surface2 #585b70; + ''; + lightColors = '' + @define-color red #d20f39; + @define-color pink #ea76cb; + @define-color crust #dce0e8; + @define-color base #eff1f5; + @define-color text #4c4f69; + @define-color surface0 #ccd0da; + @define-color surface2 #acb0be; + ''; + style = '' + * { + font-family: Symbols Nerd Font, IBM Plex Sans; + font-size: 16px; + color: @text; + } + + window#waybar { + background-color: @base; + border: 2px solid @crust; + border-radius: 5px; + } + + #workspaces button:first-child { + padding: 0 5px; + border-radius: 5px 0 0 5px; + border-left: 2px solid @crust; + } + #workspaces button.active:first-child { + padding: 0 5px; + box-shadow: unset; + border-radius: 5px 0 0 5px; + border-left: 2px solid @pink; + border-top: 2px solid @pink; + border-bottom: 2px solid @pink; + } + + #workspaces button { + padding: 0 5px; + border-radius: 0; + border-top: 2px solid @crust; + border-bottom: 2px solid @crust; + } + + #workspaces button:hover { + background: @surface2; + } + + #workspaces button.active { + color: @pink; + background: @surface0; + border-top: 2px solid @pink; + border-bottom: 2px solid @pink; + } + + #workspaces button.urgent { + background-color: @red; + } + + #clock, #network, #pulseaudio, #tray, #idle_inhibitor { + padding: 0 10px; + } + ''; in { config = lib.mkIf (config.isGraphical && pkgs.stdenv.isLinux) { programs.waybar = { @@ -60,68 +141,10 @@ in { }; }; }; - - style = '' - @define-color red #f38ba8; - @define-color pink #f5c2e7; - @define-color crust #11111c; - @define-color base #1e1e2e; - @define-color text #cdd6f4; - @define-color surface0 #313244; - @define-color surface2 #585b70; - - * { - font-family: Symbols Nerd Font, IBM Plex Sans; - font-size: 16px; - color: @text; - } - - window#waybar { - background-color: @base; - border: 2px solid @crust; - border-radius: 5px; - } - - #workspaces button:first-child { - padding: 0 5px; - border-radius: 5px 0 0 5px; - border-left: 2px solid @crust; - } - #workspaces button.active:first-child { - padding: 0 5px; - box-shadow: unset; - border-radius: 5px 0 0 5px; - border-left: 2px solid @pink; - border-top: 2px solid @pink; - border-bottom: 2px solid @pink; - } - - #workspaces button { - padding: 0 5px; - border-radius: 0; - border-top: 2px solid @crust; - border-bottom: 2px solid @crust; - } - - #workspaces button:hover { - background: @surface2; - } - - #workspaces button.active { - color: @pink; - background: @surface0; - border-top: 2px solid @pink; - border-bottom: 2px solid @pink; - } - - #workspaces button.urgent { - background-color: @red; - } - - #clock, #network, #pulseaudio, #tray, #idle_inhibitor { - padding: 0 10px; - } - ''; + }; + xdg.configFile = { + "waybar/style-dark.css".text = darkColors + style; + "waybar/style-light.css".text = lightColors + style; }; }; }