From 8f8eb20a8bfd2756007a4cf8b53e0cb29db460d4 Mon Sep 17 00:00:00 2001 From: Noa Aarts Date: Sun, 10 Mar 2024 20:26:47 +0100 Subject: [PATCH] woop woop --- common/colors.nix | 29 +- common/waybar.nix | 400 ++++++++++++++++++++++++++- custom/automapaper/default.nix | 2 +- custom/colors/default.nix | 12 + custom/colors/flake.nix | 13 + custom/colors/module/colorscheme.nix | 104 +++++++ custom/colors/module/default.nix | 1 + flake.lock | 30 +- hosts/default/configuration.nix | 11 +- hosts/default/home.nix | 2 + styles/waybar.css | 9 - 11 files changed, 575 insertions(+), 38 deletions(-) create mode 100644 custom/colors/default.nix create mode 100644 custom/colors/flake.nix create mode 100644 custom/colors/module/colorscheme.nix create mode 100644 custom/colors/module/default.nix diff --git a/common/colors.nix b/common/colors.nix index 4f99524..7c43b02 100644 --- a/common/colors.nix +++ b/common/colors.nix @@ -5,6 +5,33 @@ nix-colors.homeManagerModules.default ]; - colorScheme = nix-colors.colorSchemes.catppuccin-macchiato; + # colorScheme = nix-colors.colorSchemes.catppuccin-macchiato; + + colorScheme = { + slug = "test"; + name = "TestScheme"; + author = "Noa"; + palette = { + base00 = "#000000"; + base01 = "#0000FF"; + base02 = "#00FF00"; + base03 = "#00FFFF"; + base04 = "#FF0000"; + base05 = "#FF00FF"; + base06 = "#FFFF00"; + base07 = "#FFFFFF"; + base08 = "#777777"; + base09 = "#7777FF"; + base0A = "#77FF77"; + base0B = "#77FFFF"; + base0C = "#FF7777"; + base0D = "#FF77FF"; + base0E = "#FFFF77"; + base0F = "#AAAAAA"; + text = "#FFFFFF"; + warn = "#FF0000"; + background = "#000000"; + }; + }; } diff --git a/common/waybar.nix b/common/waybar.nix index 951f3d4..e621678 100644 --- a/common/waybar.nix +++ b/common/waybar.nix @@ -12,16 +12,18 @@ layer = "top"; position = "top"; height = 28; + margin-top = 8; + margin-left = 10; + margin-right = 10; output = [ "DP-3" "DP-2" - "HEADLESS-2" ]; - modules-left = [ "hyprland/workspaces" "tray" "custom/pronouns" "custom/spotify" ]; - modules-center = [ "hyprland/window" "clock" ]; + modules-left = [ "hyprland/workspaces" "tray" "custom/pronouns" "hyprland/window" ]; + modules-center = [ "clock" ]; modules-right = [ "custom/vpn" "wireplumber" "network" "cpu" "memory" "temperature" "custom/poweroff" ]; "clock" = { - tooltip-format = "{:%Y %B}\n\n{calendar}"; + tooltip-format = "{:%Y %B}\n\n{calendar}"; interval = 1; format = "{:%H:%M:%S}"; format-alt = ":%Y-%m-%d %H:%M:%S}"; @@ -29,8 +31,8 @@ calendar = { weeks-pos = "left"; format = { - today = "{}"; - weeks = "{}"; + today = "{}"; # TODO: use nix-colors + weeks = "{}"; # TODO: use nix-colors }; }; }; @@ -41,9 +43,29 @@ }; "memory" = { format = "mem: {}%"; + tooltip = false; }; "wireplumber" = { - format = "{volume}%"; + format = "{icon} {volume}% {format_source}"; + format-bluetooth = "󰂯 {icon} {volume}% {format_source}"; + format-bluetooth-muted = "󰂯 󰝟 {format_source}"; + format-muted = "󰝟 {format_source}"; + format-source = "󰍬"; + format-source-muted = "󰍭"; + format-icons = { + headphone = "󰋋"; + hands-free = "󰋎"; + headset = "󰋎"; + phone = ""; + portable = ""; + car = "󰄋"; + default = [ + "󰕾" + "󰕾" + "󰕾" + ]; + }; + on-click = "pavucontrol"; # TODO: find an alternative }; "custom/vpn" = { format = "VPN"; @@ -54,7 +76,7 @@ }; "temperature" = { thermal-zone = 2; - hwmon-path = "/sys/class/hwmon/hwmon2/temp1_input"; + hwmon-path = "/sys/class/hwmon/hwmon3/temp1_input"; critical-threshold = 80; format = "{temperatureC}°C {icon}"; format-icons = ["" "" ""]; @@ -64,6 +86,29 @@ on-click = "wofi-power"; on-click-right = "swaylock"; }; + "battery" = { + states = { + full = 100; + good = 100; + warning = 30; + critical = 30; + }; + format = "mouse: {capacity}% {icon}"; + format-charging = "mouse: {capacity}% {icon}"; + format-plugged = "mouse: {capacity}% {icon}"; + format-alt = "mouse: {time} {icon}"; + interval = 1; + format-icons = [ + "󰂎" + "󰁻" + "󰁾" + "󰂀" + "󰁹" + ]; + }; + "hyprland/window" = { + max-length = 36; + }; "network" = { format-wifi = "{essid} ({signalStrength}%) 󰖩"; format-ethernet = "{ipaddr}/{cidr} 󰛳"; @@ -84,7 +129,342 @@ }; }; }; - style = ../styles/waybar.css; - }; + style = '' + * { + /* `otf-font-awesome` is required to be installed for icons */ + font-family: "Maple Mono NF"; + font-size: 14px; + } + window#waybar { + background-color: transparent; + + border-radius: 999px; + color: #dddddd; + transition-property: background-color; + transition-duration: .5s; + } + window#waybar.hidden { + opacity: 0.2; + } + + window#waybar.termite { + background-color: transparent; + } + + window#waybar.chromium { + background-color: transparent; + } + + button { + /* Use box-shadow instead of border so the text isn't offset */ + box-shadow: inset 0 -1px transparent; + /* Avoid rounded borders under each button name */ + border: none; + border-radius: 0; + } + + /* https://githbackground: #000000ub.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ + button:hover { + background: inherit; + border-radius: 999px; + } + + #workspaces button { + transition: all 0.2s; + padding: 3px 3px 3px 5px; + margin: 3px; + min-width: 15px; + min-height: 15px; + background-color: transparent; + color: #5F5F5F; + border-radius: 999px; + } + + #workspaces button:hover { + background-color: #FBAF44; + } + + #workspaces button.active { + color: #ffffff; + font-weight: bold; + background-color: #FBAF44; + } + + #workspaces button.urgent { + background-color: #eb4d4b; + } + + #clock, + #battery, + #cpu, + #memory, + #disk, + #temperature, + #backlight, + #network, + #pulseaudio, + #wireplumber, + #custom-media, + #mode, + #idle_inhibitor, + #scratchpad, + #tray, + #custom-updates, + #mpd { + color: #5F5F5F; + margin: 0px 2px; + padding: 0 15px; + + border-radius: 999px; + box-shadow: inset 0 0 0 1px #cccccc; + } + + .modules-right > widget:last-child > #battery { + margin-right: 0px; + } + + #tray { + padding: 4px 10px; + border-radius: 999px 999px 999px 999px; + box-shadow: inset 0px 0px 0 1px #cccccc; + } + + #window { + margin-left: 6px; + color: #5F5F5F; + } + + #workspaces { + margin: 0 4px; + padding: 4px 4px; + border-radius: 999px; + box-shadow: inset 0px 0px 0 1px #cccccc; + } + + #cpu { + border-radius: 999px 0px 0px 999px; + margin-right: 0px; + } + + #memory { + border-radius: 0px; + padding: 0 10px; + margin: 0px; + box-shadow: inset 0px 2px 0 -1px #cccccc, + inset 0px -2px 0 -1px #cccccc; + } + + #clock { + box-shadow: none; + } + + + #battery { + min-width: 50px; + border-radius: 999px; + box-shadow: inset 0 0 0 1px #cccccc; + background-color: #cccccc; + transition: all 0.3s; + } + + #battery.charging, #battery.plugged { + color: #5bbd63; + background-color: transparent; + animation: batteryCharging 1.2s linear 0s infinite normal forwards, + } + #battery.full { + animation: batteryFull 7.0s linear 0s infinite normal forwards; + } + #battery.critical:not(.charging) { + background-color: #ffd2d2; + animation: batteryCritical 1.2s linear 0s infinite normal forwards; + } + + #network { + + } + + #network.disconnected, + #pulseaudio.muted { + transition: all 0.2s; + color: #cccccc; + } + + .custom-spotify { + color: #39a04a; + margin-right: 10px; + } + + #custom-media.custom-vlc { + background-color: #ffa000; + } + + #temperature { + margin-left: 0px; + border-radius: 0px 999px 999px 0px; + } + + #temperature.critical { + background-color: transparent; + color: #f53c3c; + } + + #tray { + background-color: transparent; + } + + + #tray > .passive { + -gtk-icon-effect: dim; + } + + #tray > .needs-attention { + background-color: #f53c3c; + border-radius: 999px; + } + + #idle_inhibitor { + background-color: #2d3436; + } + + #idle_inhibitor.activated { + background-color: #ecf0f1; + color: #2d3436; + } + + #language { + background: #00b093; + color: #740864; + padding: 0 5px; + margin: 0 5px; + min-width: 16px; + } + + #keyboard-state { + background: #97e1ad; + color: #000000; + padding: 0 0px; + margin: 0 5px; + min-width: 16px; + } + + #keyboard-state > label { + padding: 0 5px; + } + + #keyboard-state > label.locked { + background: rgba(0, 0, 0, 0.05); + } + + #scratchpad { + background: rgba(0, 0, 0, 0.1); + } + #scratchpad.empty { + background-color: transparent; + } + + #custom-updates { + box-shadow: inset 0 0 0 1px #cccccc; + color: #888888; + transition: all 0.5s; + } + + #custom-updates.pending { + box-shadow: inset 0 0 0 2px #fbaf44; + color: #fbaf44; + font-weight: bold; + transition: all 0.5s; + } + + tooltip { + background-color: #eeeeee; + border: 1px solid; + border-color: #dddddd; + border-radius: 10px; + color: #5F5F5F; + } + tooltip label { + padding: 5px; + } + + /* Keyframes ---------------------------------------------------------------- */ + + @keyframes batteryCritical { + 0% { + box-shadow: inset 0px 20px 8px -16px #f53c3c, + inset 0px -20px 8px -16px #f53c3c; + color: #f53c3c; + } + 50% { + box-shadow: inset 0px 12px 8px -16px #f53c3c, + inset 0px -12px 8px -16px #f53c3c; + color: #555555; + } + 100% { + box-shadow: inset 0px 20px 8px -16px #f53c3c, + inset 0px -20px 8px -16px #f53c3c; + color: #f53c3c; + } + } + + @keyframes batteryCharging { + 0% { + box-shadow: inset 0px 0px 8px 0px #2cb6af, + inset 0px 20px 8px -18px #38b148, + inset 0px -20px 8px -18px #38b148; + } + 25% { + box-shadow: inset 0px 0px 8px 0px #2cb6af, + inset 14px 14px 8px -18px #38b148, + inset -14px -14px 8px -18px #38b148; + } + 50% { + box-shadow: inset 0px 0px 8px 0px #2cb6af, + inset 20px 0px 8px -18px #38b148, + inset -20px 0px 8px -18px #38b148; + } + 75% { + box-shadow: inset 0px 0px 8px 0px #2cb6af, + inset 14px -14px 8px -18px #38b148, + inset -14px 14px 8px -18px #38b148; + } + 100% { + box-shadow: inset 0px 0px 8px 0px #2cb6af, + inset 0px -20px 8px -18px #38b148, + inset 0px 20px 8px -18px #38b148; + } + } + + + + @keyframes batteryFull { + 0% { + box-shadow: inset 0px 20px 8px -16px #87D96C, + inset 0px -20px 8px -16px #87D96C; + color: #87D96C; + } + 25% { + box-shadow: inset 0px 19px 8px -16px #87D96C, + inset 0px -19px 8px -16px #87D96C; + color: #87D96C; + } + 50% { + box-shadow: inset 0px 15px 8px -16px #87D96C, + inset 0px -15px 8px -16px #87D96C; + color: #87D96C; + } + 75% { + box-shadow: inset 0px 19px 8px -16px #87D96C, + inset 0px -19px 8px -16px #87D96C; + color: #87D96C; + } + 100% { + box-shadow: inset 0px 20px 8px -16px #87D96C, + inset 0px -20px 8px -16px #87D96C; + color: #87D96C; + } + } + ''; + }; } diff --git a/custom/automapaper/default.nix b/custom/automapaper/default.nix index b640ad1..e147894 100644 --- a/custom/automapaper/default.nix +++ b/custom/automapaper/default.nix @@ -18,7 +18,7 @@ stdenv.mkDerivation rec { src = fetchgit { url = "https://github.com/itepastra/automapaper"; rev = "f102526244d954a4e4ae30a4b11f070e821f66ec"; - sha256 = "sha256-IS9vqSmDbiLwLwUeIxxPI2t7yksxvACgiECeSV43Wug="; + sha256 = "sha256-WyD8NlA6T0v0ixMpN67Tro1Cy06rmx2FDaf5qriiFQA="; }; meta = with lib; { diff --git a/custom/colors/default.nix b/custom/colors/default.nix new file mode 100644 index 0000000..59476c2 --- /dev/null +++ b/custom/colors/default.nix @@ -0,0 +1,12 @@ +{ nixpkgs-lib, ... }: rec { + lib-core = import ./lib/core { inherit nixpkgs-lib; }; + lib = lib-core // { contrib = lib-contrib; }; + + homeManagerModules = rec { + colorScheme = import ./module; + # Alias + colorscheme = colorScheme; + default = colorScheme; + }; + homeManagerModule = homeManagerModules.colorScheme; +} diff --git a/custom/colors/flake.nix b/custom/colors/flake.nix new file mode 100644 index 0000000..b943545 --- /dev/null +++ b/custom/colors/flake.nix @@ -0,0 +1,13 @@ +{ + description = + "a home-manager module to make theming easier."; + + inputs = { + nixpkgs-lib.url = "github:nix-community/nixpkgs.lib"; + }; + + outputs = { self, nixpkgs-lib, color-schemes }: + import ./. { + nixpkgs-lib = nixpkgs-lib.lib; + }; +} diff --git a/custom/colors/module/colorscheme.nix b/custom/colors/module/colorscheme.nix new file mode 100644 index 0000000..158b4a0 --- /dev/null +++ b/custom/colors/module/colorscheme.nix @@ -0,0 +1,104 @@ +{ lib, config, ... }: + +with lib; +let + cfg = config.colorScheme; + hexColorType = mkOptionType { + name = "hex-color"; + descriptionClass = "noun"; + description = "RGB color in hex format"; + check = x: isString x && !(hasPrefix "#" x); + }; +in +{ + imports = [ + (mkAliasOptionModule [ "colorscheme" ] [ "colorScheme" ]) + (mkRenamedOptionModule [ "colorScheme" "kind" ] [ "colorScheme" "variant" ]) + (mkRenamedOptionModule [ "colorScheme" "colors" ] [ "colorScheme" "palette" ]) + ]; + + options.colorScheme = { + slug = mkOption { + type = types.str; + example = "awesome-scheme"; + description = '' + Color scheme slug (sanitized name) + ''; + }; + name = mkOption { + type = types.str; + default = ""; + example = "Awesome Scheme"; + description = '' + Color scheme (pretty) name + ''; + }; + description = mkOption { + type = types.str; + default = ""; + example = "A very nice theme"; + description = '' + Color scheme description + ''; + }; + author = mkOption { + type = types.str; + default = ""; + example = "Gabriel Fontes (https://m7.rs)"; + description = '' + Color scheme author + ''; + }; + variant = mkOption { + type = types.enum [ "dark" "light" ]; + default = + if builtins.substring 0 1 cfg.palette.base00 < "5" then + "dark" + else + "light"; + description = '' + Whether the scheme is dark or light + ''; + }; + + palette = mkOption { + type = with types; attrsOf ( + coercedTo str (removePrefix "#") hexColorType + ); + default = { }; + example = literalExpression '' + { + base00 = "002635"; + base01 = "00384d"; + base02 = "517F8D"; + base03 = "6C8B91"; + base04 = "869696"; + base05 = "a1a19a"; + base06 = "e6e6dc"; + base07 = "fafaf8"; + base08 = "ff5a67"; + base09 = "f08e48"; + base0A = "ffcc1b"; + base0B = "7fc06e"; + base0C = "14747e"; + base0D = "5dd7b9"; + base0E = "9a70a4"; + base0F = "c43060"; + } + ''; + description = '' + Atribute set of hex colors. + + These are usually base00-base0F, but you may use any name you want. + For example, these can have meaningful names (bg, fg), or be base24. + + The colorschemes provided by nix-colors follow the base16 standard. + Some might leverage base24 and have 24 colors, but these can be safely + used as if they were base16. + + You may include a leading #, but it will be stripped when accessed from + config.colorscheme.palette. + ''; + }; + }; +} diff --git a/custom/colors/module/default.nix b/custom/colors/module/default.nix new file mode 100644 index 0000000..e77d464 --- /dev/null +++ b/custom/colors/module/default.nix @@ -0,0 +1 @@ +{ imports = [ ./colorscheme.nix ]; } diff --git a/flake.lock b/flake.lock index 8d89852..440f935 100644 --- a/flake.lock +++ b/flake.lock @@ -154,11 +154,11 @@ ] }, "locked": { - "lastModified": 1709710941, - "narHash": "sha256-4FjuX5kGQhvrxkwuB3tAcA7cqNgNW10eZ7qzePfl+kM=", + "lastModified": 1710062421, + "narHash": "sha256-FiCNRfyUgJOLYIokLiFsfI7B+Zn9HDnOzFR3uVr5qsQ=", "owner": "nix-community", "repo": "home-manager", - "rev": "3c7bacf1d42e533299c5e3baf74556a0e0ac3d0e", + "rev": "36f873dfc8e2b6b89936ff3e2b74803d50447e0a", "type": "github" }, "original": { @@ -175,11 +175,11 @@ ] }, "locked": { - "lastModified": 1709578243, - "narHash": "sha256-hF96D+c2PBmAFhymMw3z8hou++lqKtZ7IzpFbYeL1/Y=", + "lastModified": 1709988192, + "narHash": "sha256-qxwIkl85P0I1/EyTT+NJwzbXdOv86vgZxcv4UKicjK8=", "owner": "nix-community", "repo": "home-manager", - "rev": "23ff9821bcaec12981e32049e8687f25f11e5ef3", + "rev": "b0b0c3d94345050a7f86d1ebc6c56eea4389d030", "type": "github" }, "original": { @@ -215,11 +215,11 @@ ] }, "locked": { - "lastModified": 1709554374, - "narHash": "sha256-1yYgwxBzia+QrOaQaZ6YKqGFfiQcSBwYLzd9XRsRLQY=", + "lastModified": 1709771483, + "narHash": "sha256-Hjzu9nCknHLQvhdaRFfCEprH0o15KcaNu1QDr3J88DI=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "daa03606dfb5296a22e842acb02b46c1c4e9f5e7", + "rev": "550340062c16d7ef8c2cc20a3d2b97bcd3c6b6f6", "type": "github" }, "original": { @@ -230,11 +230,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1709479366, - "narHash": "sha256-n6F0n8UV6lnTZbYPl1A9q1BS0p4hduAv1mGAP17CVd0=", + "lastModified": 1709961763, + "narHash": "sha256-6H95HGJHhEZtyYA3rIQpvamMKAGoa8Yh2rFV29QnuGw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "b8697e57f10292a6165a20f03d2f42920dfaf973", + "rev": "3030f185ba6a4bf4f18b87f345f104e6a6961f34", "type": "github" }, "original": { @@ -272,11 +272,11 @@ "pre-commit-hooks": "pre-commit-hooks" }, "locked": { - "lastModified": 1709707473, - "narHash": "sha256-Jd/1lBwjTOmkVeNAwIn6JrS26OsPj37qOKTV0HHW5bg=", + "lastModified": 1710016565, + "narHash": "sha256-GoNm8bTT2YjZwdS0jcF0u2mTb8TYDDVyl8vgGICaS8I=", "owner": "nix-community", "repo": "nixvim", - "rev": "1cda3f6df590ffb5719294311748ab686ce66f69", + "rev": "fb897e22e31f4d29766d94cea3df4aaf008c095e", "type": "github" }, "original": { diff --git a/hosts/default/configuration.nix b/hosts/default/configuration.nix index 225785d..b9b907d 100644 --- a/hosts/default/configuration.nix +++ b/hosts/default/configuration.nix @@ -16,6 +16,9 @@ boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; + # LOVE me some blob + hardware.enableRedistributableFirmware = true; + hardware.enableAllFirmware = true; networking.hostName = "lambdaOS"; # Define your hostname. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. @@ -110,6 +113,7 @@ fira-code fira-code-symbols liberation_ttf + maple-mono-NF ]; # Some programs need SUID wrappers, can be configured further or are @@ -144,9 +148,12 @@ jack.enable = true; }; - boot.extraModulePackages = with config.boot.kernelPackages; [ - v4l2loopback + boot.kernelModules = [ + "v4l2loopback" + "nct6775" + "k10temp" ]; + boot.extraModprobeConfig = '' options v4l2loopback devices=1 video_nr=1 card_label="OBS Cam" exclusive_caps=1 ''; diff --git a/hosts/default/home.nix b/hosts/default/home.nix index 9621de6..41c5944 100644 --- a/hosts/default/home.nix +++ b/hosts/default/home.nix @@ -50,6 +50,8 @@ pipewire lsd + lm_sensors + # Programming langs go nodejs diff --git a/styles/waybar.css b/styles/waybar.css index 438e2cb..9f5b63c 100644 --- a/styles/waybar.css +++ b/styles/waybar.css @@ -15,15 +15,6 @@ window#waybar.hidden { opacity: 0.2; } -/* -window#waybar.empty { - background-color: transparent; -} -window#waybar.solo { - background-color: #FFFFFF; -} -*/ - window#waybar.termite { background-color: #3F3F3F; }