From 97695a124cc487c08a38a2a7cd7ee0e57d041be7 Mon Sep 17 00:00:00 2001 From: pagedmov Date: Mon, 21 Oct 2024 08:27:38 -0400 Subject: [PATCH] Added style config to waybar, removed chscheme.sh because I figured out you can escape vars in bash that use --- modules/home/environment/default.nix | 1 + modules/home/environment/stylix.nix | 19 +++ modules/home/environment/waybar/settings.nix | 43 ++++-- modules/home/environment/waybar/style.nix | 143 +++++++++++++++++++ modules/home/scripts/nix/chscheme.nix | 25 +++- modules/home/scripts/nix/chscheme.sh | 23 --- modules/sys/environment/stylix.nix | 3 +- modules/sys/software/nixvim/options.nix | 36 ++--- 8 files changed, 239 insertions(+), 54 deletions(-) create mode 100644 modules/home/environment/stylix.nix delete mode 100755 modules/home/scripts/nix/chscheme.sh diff --git a/modules/home/environment/default.nix b/modules/home/environment/default.nix index ce264f9..c410556 100644 --- a/modules/home/environment/default.nix +++ b/modules/home/environment/default.nix @@ -12,6 +12,7 @@ imports = [(import ./gtk.nix)] ++ [(import ./spicetify.nix)] + ++ [(import ./stylix.nix)] ++ [(import ./starship.nix)] ++ [(import ./userpkgs.nix)] ++ [(import ./zshell.nix)] diff --git a/modules/home/environment/stylix.nix b/modules/home/environment/stylix.nix new file mode 100644 index 0000000..dab74f5 --- /dev/null +++ b/modules/home/environment/stylix.nix @@ -0,0 +1,19 @@ +{ + pkgs, + scheme, + wallpaper, + ... +}: + +{ + stylix = { + enable = true; + autoEnable = true; + targets = { + # fzf.enable = true; + # kitty.enable = true; + # vesktop.enable = true; + waybar.enable = false; + }; + }; +} diff --git a/modules/home/environment/waybar/settings.nix b/modules/home/environment/waybar/settings.nix index e3faa4c..350aed4 100644 --- a/modules/home/environment/waybar/settings.nix +++ b/modules/home/environment/waybar/settings.nix @@ -1,5 +1,4 @@ { -pkgs, ... }: # Grocery list: @@ -34,6 +33,9 @@ in output = "DP-1"; position = "top"; name = "mainBar"; + margin-left = 8; + margin-top = 5; + margin-right = 8; mode = "dock"; modules-left = [ @@ -41,12 +43,11 @@ in "cava" ]; modules-center = [ - "clock" + "hyprland/window" ]; modules-right = [ - "custom/disk-icon" - "memory" - "cpu" + "group/hardware" + "clock" "group/powerbtns" ]; @@ -71,11 +72,20 @@ in format-icons = ["▁" "▂" "▃" "▄" "▅" "▆" "▇" "█" ]; }; + "group/hardware" = { + orientation = "inherit"; + modules = [ + "custom/disk-icon" + "memory" + "cpu" + ]; + }; + "custom/disk-icon" = { exec = '' df /dev/disk/by-partlabel/disk-main-home | awk '$6 == "/home" {printf "{\"class\": \"disk-icon\", \"tooltip\": \"/home: %.1fGB / %.1fTB\", \"percentage\": \"%.0f\"}\n", $3 / 1024 / 1024, $2 / 1024 / 1024 / 1024, $5}' | jq --unbuffered --compact-output ''; - interval = 300; + interval = 60; return-type = "json"; rotate = 270; format = "{icon}"; @@ -92,6 +102,7 @@ in "󰝦" "󰪞" "󰪟" "󰪠" "󰪡" "󰪢" "󰪣" "󰪤" "󰪥" ]; max-length = 10; + tooltip-format = "RAM: {used:0.1f} GB / {total:0.1f} GB"; }; cpu = { @@ -101,6 +112,7 @@ in format-icons = [ "󰝦" "󰪞" "󰪟" "󰪠" "󰪡" "󰪢" "󰪣" "󰪤" "󰪥" ]; + tooltip-format = "CPU: {usage:0.1f}%"; }; "custom/power" = { @@ -135,6 +147,10 @@ in ]; }; + clock = { + format = "{:%I:%M %p}"; + }; + }; @@ -144,6 +160,9 @@ in layer = "bottom"; output = "HDMI-A-1"; position = "right"; + margin-top = 8; + margin-right = 5; + margin-bottom = 8; name = "sideBar"; mode = "dock"; @@ -151,12 +170,10 @@ in "hyprland/workspaces" ]; modules-center = [ - "tray" ]; modules-right = [ - "pulseaudio/slider" - "pulseaudio" "network" + "group/audio" ]; "hyprland/workspaces" = workspaces; @@ -165,6 +182,14 @@ in orientation = "vertical"; }; + "group/audio" = { + orientation = "vertical"; + modules = [ + "pulseaudio/slider" + "pulseaudio" + ]; + }; + pulseaudio = { format = "{icon}"; format-muted = " "; diff --git a/modules/home/environment/waybar/style.nix b/modules/home/environment/waybar/style.nix index 54cf0f0..ddfedad 100644 --- a/modules/home/environment/waybar/style.nix +++ b/modules/home/environment/waybar/style.nix @@ -29,5 +29,148 @@ let in { programs.waybar.style = '' + * { + border: none; + border-radius: 0; + font-size: 16px; + font-family: "JetBrains Mono Nerd Font"; + } + + window#waybar { + border-radius: 20px; + border: 3px solid #${colors.color7}; + background: rgba(46,52,64,0.9); + margin: 20px; + } + window#waybar.empty #window { + background: none; + } + + #workspaces { + margin: 3px; + background: #${bg.dark}; + border-radius: 20px; + } + + #workspaces button:hover { + border-radius: 20px; + } + + #workspaces button.active { + background: #${fg.lightester}; + border-radius: 20px; + color: #${bg.darkest}; + } + + #cava { + background: #${bg.dark}; + border-radius: 20px; + margin: 3px 3px 3px 6px; + padding: 0px 15px 0px 15px; + color: #${colors.color6}; + } + + #window { + margin: 3px; + background: #${bg.dark}; + border-radius: 20px; + padding: 0 15px 0 15px; + font-weight: bold; + } + + #hardware { + margin: 3px; + padding: 0 10px 0 10px; + background: #${bg.dark}; + border-radius: 20px; + } + + #custom-disk-icon, #cpu, #memory { + margin-bottom: 4px; + font-size: 20px; + font-weight: bold; + } + + #custom-disk-icon { + color: #${colors.color4}; + } + + #memory { + color: #${colors.color1}; + } + + #cpu { + color: #${colors.color3}; + } + + #clock { + font-weight: bold; + background: #${bg.dark}; + border-radius: 20px; + margin: 3px; + padding: 0 10px 0 10px; + font-size: 18px; + } + + #powerbtns { + background: #${bg.dark}; + border-radius: 20px; + margin: 3px; + padding: 0 5px 0 10px; + } + + #custom-power { + color: #${colors.color0}; + font-size: 18px; + } + + #custom-logout { + color: #${colors.color4}; + font-size: 18px; + } + + #custom-reboot { + color: #${colors.color2}; + font-size: 18px; + } + + #audio { + background: #${bg.dark}; + border-radius: 20px; + margin: 3px; + padding: 5px 0 10px 0; + } + + #pulseaudio { + color: #${colors.color4}; + font-size: 18px; + } + + #pulseaudio-slider slider { + background: #${colors.color4}; + background-color: transparent; + box-shadow: none; + } + + #pulseaudio-slider trough { + min-width: 9px; + min-height: 90px; + border-radius: 8px; + background: #343434; + } + + #pulseaudio-slider highlight { + border-radius: 8px; + background-color: #2096C0; + } + + #network { + color: #${colors.color3}; + font-size: 20px; + background: #${bg.dark}; + border-radius: 20px; + margin: 3px; + padding: 5px 0 5px 6px; + } ''; } diff --git a/modules/home/scripts/nix/chscheme.nix b/modules/home/scripts/nix/chscheme.nix index bfe24d0..6036e31 100644 --- a/modules/home/scripts/nix/chscheme.nix +++ b/modules/home/scripts/nix/chscheme.nix @@ -1,5 +1,26 @@ { pkgs, }: -pkgs.writeShellScriptBin "chscheme" (builtins.readFile ./chscheme.sh) - +pkgs.writeShellScriptBin "chscheme" '' +/usr/bin/env ls "$(nix-build '' -A base16-schemes)"/share/themes | \ + sed 's/\.yaml//g' | \ + fzf --preview 'cat $(nix-build "" -A base16-schemes)/share/themes/{}.yaml | \ + while IFS=": " read -r key value; do \ + if [[ $key =~ base0[0-9A-F] ]]; then \ + clean_value=$(echo $value | tr -d "\""); \ + r=$((16#''${clean_value:0:2})); \ + g=$((16#''${clean_value:2:2})); \ + b=$((16#''${clean_value:4:2})); \ + printf "\033[48;2;%d;%d;%dm %-20s %s \033[0m\n" $r $g $b $key $clean_value; \ + fi; \ + done' | xargs -I {} sed -i '/base16scheme \=/s/\".*\"/\"{}\"/' "$HOME"/.sysflake/flake.nix && \ + echo "Successfully changed system color scheme. Rebuild now?" && \ + select choice in "Yes" "No"; do + case $choice in + "Yes") + rebuild;exit 0;; + "No") + echo "Exiting...";exit 0;; + esac + done +'' diff --git a/modules/home/scripts/nix/chscheme.sh b/modules/home/scripts/nix/chscheme.sh deleted file mode 100755 index 75def15..0000000 --- a/modules/home/scripts/nix/chscheme.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash - -/usr/bin/env ls "$(nix-build '' -A base16-schemes)"/share/themes | \ - sed 's/\.yaml//g' | \ - fzf --preview 'cat $(nix-build "" -A base16-schemes)/share/themes/{}.yaml | \ - while IFS=": " read -r key value; do \ - if [[ $key =~ base0[0-9A-F] ]]; then \ - clean_value=$(echo $value | tr -d "\""); \ - r=$((16#${clean_value:0:2})); \ - g=$((16#${clean_value:2:2})); \ - b=$((16#${clean_value:4:2})); \ - printf "\033[48;2;%d;%d;%dm %-20s %s \033[0m\n" $r $g $b $key $clean_value; \ - fi; \ - done' | xargs -I {} sed -i '/base16scheme \=/s/\".*\"/\"{}\"/' "$HOME"/.sysflake/flake.nix && \ - echo "Successfully changed system color scheme. Rebuild now?" && \ - select choice in "Yes" "No"; do - case $choice in - "Yes") - rebuild;exit 0;; - "No") - echo "Exiting...";exit 0;; - esac - done diff --git a/modules/sys/environment/stylix.nix b/modules/sys/environment/stylix.nix index 33985f3..fce2339 100644 --- a/modules/sys/environment/stylix.nix +++ b/modules/sys/environment/stylix.nix @@ -3,7 +3,7 @@ scheme, wallpaper, ... -}: +}: { stylix = { @@ -19,7 +19,6 @@ grub.enable = true; gtk.enable = true; nixos-icons.enable = true; - nixvim.enable = false; }; cursor = { package = pkgs.bibata-cursors; diff --git a/modules/sys/software/nixvim/options.nix b/modules/sys/software/nixvim/options.nix index 7da45ce..44095de 100644 --- a/modules/sys/software/nixvim/options.nix +++ b/modules/sys/software/nixvim/options.nix @@ -4,24 +4,24 @@ programs.nixvim = { colorschemes.base16 = { enable = true; - colorscheme = { - base00 = "#${scheme.base00}"; - base01 = "#${scheme.base01}"; - base02 = "#${scheme.base02}"; - base03 = "#${scheme.base03}"; - base04 = "#${scheme.base04}"; - base05 = "#${scheme.base05}"; - base06 = "#${scheme.base06}"; - base07 = "#${scheme.base07}"; - base08 = "#${scheme.base08}"; - base09 = "#${scheme.base09}"; - base0A = "#${scheme.base0A}"; - base0B = "#${scheme.base0B}"; - base0C = "#${scheme.base0C}"; - base0D = "#${scheme.base0D}"; - base0E = "#${scheme.base0E}"; - base0F = "#${scheme.base0F}"; - }; + #colorscheme = { + # base00 = "#${scheme.base00}"; + # base01 = "#${scheme.base01}"; + # base02 = "#${scheme.base02}"; + # base03 = "#${scheme.base03}"; + # base04 = "#${scheme.base04}"; + # base05 = "#${scheme.base05}"; + # base06 = "#${scheme.base06}"; + # base07 = "#${scheme.base07}"; + # base08 = "#${scheme.base08}"; + # base09 = "#${scheme.base09}"; + # base0A = "#${scheme.base0A}"; + # base0B = "#${scheme.base0B}"; + # base0C = "#${scheme.base0C}"; + # base0D = "#${scheme.base0D}"; + # base0E = "#${scheme.base0E}"; + # base0F = "#${scheme.base0F}"; + #}; }; enable = true; diagnostics.signs = false;