diff --git a/hardware/x270.nix b/hardware/x270.nix index 2916804a..6cf89042 100644 --- a/hardware/x270.nix +++ b/hardware/x270.nix @@ -1,45 +1,40 @@ { config, lib, ... }: /* - This hardware profile corresponds to the Lenovo Thinkpad x270. -*/ + This hardware profile corresponds to the Lenovo Thinkpad x270. + */ let - inherit (lib.options) mkOption; +inherit (lib.options) mkOption; +userTouchpadExtend = { config, nixos, ... }: { + wayland.windowManager.sway.config.input."2:7:SynPS/2_Synaptics_TouchPad" = { + dwt = "enabled"; + tap = "enabled"; + natural_scroll = "enabled"; + middle_emulation = "enabled"; + click_method = "clickfinger"; + }; +}; +waybarExtend = { config, ... }: { + options = { + programs.waybar.settings = mkOption { + type = lib.types.either (lib.types.listOf (lib.types.submodule waybarExtend2)) (lib.types.attrsOf (lib.types.submodule waybarExtend2)); + }; + }; +}; +waybarExtend2 = { config, ... }: { + config = { + modules.temperature.hwmon-path = "/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon6/temp1_input"; + }; +}; in { - options.home-manager.users = let - userTouchpadExtend = { config, nixos, ... }: { - wayland.windowManager.sway.config.input."2:7:SynPS/2_Synaptics_TouchPad" = { - dwt = "enabled"; - tap = "enabled"; - natural_scroll = "enabled"; - middle_emulation = "enabled"; - click_method = "clickfinger"; - }; - }; - waybarExtend = { config, ... }: { - options = { - programs.waybar.settings = mkOption { - type = lib.types.either (lib.types.listOf (lib.types.submodule waybarExtend2)) (lib.types.attrsOf (lib.types.submodule waybarExtend2)); - }; - }; - }; - waybarExtend2 = { config, ... }: { - config = { - modules.temperature.hwmon-path = "/sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon2/temp2_input"; - }; - }; - in mkOption { - type = lib.types.attrsOf (lib.types.submoduleWith { - modules = [ userTouchpadExtend waybarExtend ]; - }); - }; - - config = { - boot = { - initrd.availableKernelModules = - [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "sr_mod" "rtsx_usb_sdmmc" ]; - kernelModules = [ "kvm-intel" ]; - }; - }; + home-manager.sharedModules = [ + waybarExtend + userTouchpadExtend + ]; + boot = { + initrd.availableKernelModules = + [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "sr_mod" "rtsx_usb_sdmmc" ]; + kernelModules = [ "kvm-intel" ]; + }; } diff --git a/home/base16.nix b/home/base16.nix index b0e56df3..7661f14d 100644 --- a/home/base16.nix +++ b/home/base16.nix @@ -1,12 +1,17 @@ { config, pkgs, lib, ... }: { - kw.theme.enable = true; + kw.theme.enable = true; - base16 = { - shell.enable = true; - schemes = [ "atelier.atelier-cave" "atelier.atelier-cave-light" ]; - alias.light = "atelier.atelier-cave-light"; - alias.dark = "atelier.atelier-cave"; - }; + base16 = { + shell.enable = true; + schemes = lib.mkMerge [ { + light = "atelier.atelier-cave-light"; + dark = "atelier.atelier-cave"; + } (lib.mkIf (true == false) { + dark.ansi.palette.background.alpha = "ee00"; + light.ansi.palette.background.alpha = "d000"; + }) ]; + defaultSchemeName = "dark"; + }; } diff --git a/home/vim/default.nix b/home/vim/default.nix index 4b5fc815..126ac40e 100644 --- a/home/vim/default.nix +++ b/home/vim/default.nix @@ -2,6 +2,16 @@ let inherit (lib.modules) mkIf; + inherit (lib.strings) concatStringsSep; + inherit (lib.attrsets) mapAttrsToList; + initLua = pkgs.writeText "init.lua" ( + ''-- Kat's Base16 Colors + local base16 = { + ${concatStringsSep "\n" (mapAttrsToList(var: col: "${var} = '${col}',") config.kw.theme.base16)} + } + + ${builtins.readFile ./init.lua} + ''); in { home.sessionVariables = mkIf config.programs.neovim.enable { EDITOR = "nvim"; }; @@ -73,7 +83,7 @@ in { clangStdenv.cc ]; extraConfig = '' - luafile ${./init.lua} + luafile ${initLua} ''; }; } diff --git a/home/vim/init.lua b/home/vim/init.lua index 713a6cbd..17187335 100644 --- a/home/vim/init.lua +++ b/home/vim/init.lua @@ -279,7 +279,7 @@ require('bufferline').setup { color_icons = true, show_buffer_icons = true, -- disable filetype icons for buffers show_buffer_close_icons = true, - show_close_icon = true, + show_close_icon = false, show_tab_indicators = true, persist_buffer_sort = true, -- whether or not custom sorted buffers should persist separator_style = "padded_slant", @@ -287,7 +287,7 @@ require('bufferline').setup { } } -local barColor = "#2F2F30" +local barColor = base16.base00; local highlightItems = { BufferLineFill = "bg", @@ -297,10 +297,15 @@ local highlightItems = { BufferLineSeparatorVisible = "fg", } +local commandString = "" + for item, ground in pairs(highlightItems) do - api.nvim_create_autocmd("ColorScheme", { - command = "highlight " .. item .. " gui" .. ground .. "=" .. barColor -}) end + commandString = "highlight " .. item .. " gui" .. ground .. "=" .. barColor .. " | " .. commandString +end + +api.nvim_create_autocmd("ColorScheme", { + command = commandString; +}) -- hop local hop = require('hop') diff --git a/home/waybar/default.nix b/home/waybar/default.nix index cc1dc631..99749423 100644 --- a/home/waybar/default.nix +++ b/home/waybar/default.nix @@ -1,168 +1,177 @@ { config, lib, pkgs, kw, ... }: { - xdg.configFile."waybar/style.css" = { inherit (kw.sassTemplate { name = "waybar-style"; src = ./waybar.sass; }) source; }; + xdg.configFile."waybar/style.css" = { inherit (kw.sassTemplate { name = "waybar-style"; src = ./waybar.sass; }) source; }; - #systemd.user.services.waybar.Service.Environment = lib.singleton "NOTMUCH_CONFIG=${config.home.sessionVariables.NOTMUCH_CONFIG}"; +#systemd.user.services.waybar.Service.Environment = lib.singleton "NOTMUCH_CONFIG=${config.home.sessionVariables.NOTMUCH_CONFIG}"; - programs.waybar = { - enable = true; - systemd.enable = true; - settings = [{ - modules-left = [ - "sway/workspaces" - "sway/mode" - "sway/window#icon" - "sway/window" - ]; - modules-center = [ - "clock#original" - ]; - modules-right = [ - "pulseaudio#icon" - "pulseaudio" - "custom/headset-icon" - "custom/headset" - "custom/mail-icon" - "custom/mail" - "custom/cpu-icon" - "cpu" - "custom/memory-icon" - "memory" - "temperature#icon" - "temperature" - "battery#icon" - "battery" - "backlight#icon" - "backlight" - "network" - "idle_inhibitor" - "custom/konawall" - "custom/gpg-status" - "tray" - ]; + programs.waybar = { + enable = true; + systemd.enable = true; + settings = [{ + height = 10; + modules-left = [ + "sway/workspaces" + "sway/mode" + "sway/window" + ]; + modules-center = [ + "clock#original" + ]; + modules-right = [ + "pulseaudio#icon" + "pulseaudio" + "custom/headset-icon" + "custom/headset" + "custom/mail-icon" + "custom/mail" + "custom/cpu-icon" + "cpu" + "custom/memory-icon" + "memory" + "temperature#icon" + "temperature" + "battery#icon" + "battery" + "backlight#icon" + "backlight" + "network" + "idle_inhibitor" + "custom/konawall" + "custom/gpg-status" + "tray" + ]; - modules = { - "sway/workspaces".format = "{name}"; - "sway/window#icon".format = ""; - "sway/window".format = "{}"; - tray = { - icon-size = 12; - spacing = 2; - }; - backlight = { - format = "{icon} {percent}%"; - format-icons = ["" ""]; - }; - "custom/gpg-status" = { - format = "{}"; - interval = 300; - return-type = "json"; - exec = "${pkgs.waybar-gpg}/bin/kat-gpg-status"; - }; - "custom/headset-icon" = { - format = ""; - interval = 60; - exec-if = "${pkgs.headsetcontrol}/bin/headsetcontrol -c"; - exec = "echo 'mew'"; - }; - "custom/headset" = { - format = "{}"; - interval = 60; - exec-if = "${pkgs.headsetcontrol}/bin/headsetcontrol -c"; - exec = "${pkgs.headsetcontrol}/bin/headsetcontrol -b | ${pkgs.gnugrep}/bin/grep Battery | ${pkgs.coreutils}/bin/cut -d ' ' -f2"; - }; - "custom/konawall" = { - format = "{}"; - interval = "once"; - return-type = "json"; - exec = "${pkgs.waybar-konawall}/bin/konawall-status"; - on-click = "${pkgs.waybar-konawall}/bin/konawall-toggle"; - on-click-right = "systemctl --user restart konawall"; - signal = 8; - }; - "custom/mail-icon".format = ""; - "custom/mail" = { - format = "{}"; - interval = 30; - exec = "${pkgs.notmuch-arc}/bin/notmuch count tag:flagged OR tag:inbox AND NOT tag:killed"; - }; - "custom/cpu-icon".format = ""; - cpu.format = "{usage}%"; - "custom/memory-icon".format = ""; - memory.format = "{percentage}%"; - "temperature#icon" = { - format = "{icon}"; - format-icons = ["" "" ""]; - critical-threshold = 80; - }; - temperature = { - format = "{temperatureC}°C"; - critical-threshold = 80; - }; - idle_inhibitor = { - format = "{icon}"; - format-icons = { - activated = ""; - deactivated = ""; - }; - }; - "battery#icon" = { - states = { - good = 90; - warning = 30; - critical = 15; - }; - format = "{icon}"; - format-charging = ""; - format-plugged = ""; - format-icons = [ "" "" "" "" "" ]; - }; - battery = { - states = { - good = 90; - warning = 30; - critical = 15; - }; - format = "{capacity}%"; - format-charging = "{capacity}%"; - format-plugged = "{capacity}%"; - format-alt = "{time}"; - }; - "pulseaudio#icon" = { - format = "{icon}"; - format-muted = "婢"; - on-click = "foot pulsemixer"; - format-icons = { - default = [ - "" - "" - "" - ]; - }; - }; - pulseaudio = { - format = "{volume}%"; - on-click = "foot pulsemixer"; - }; - network = { - format-wifi = "直"; - format-ethernet = ""; - format-linked = " {ifname} (NO IP)"; - format-disconnected = " DC"; - format-alt = "{ifname}: {ipaddr}/{cidr}"; - tooltip-format-wifi = "{essid} ({signalStrength}%)"; - }; - "clock#original" = { - format = "{:%a, %F %T}"; - tooltip = true; - tooltip-format = "{:%A, %F %T %z (%Z)}"; - timezones = [ - "America/Vancouver" - ]; - interval = 1; - }; - }; - }]; - }; + modules = { + "sway/workspaces" = { + format = "{icon}"; + format-icons = { + "1" = "1:"; + "2" = "2:"; + "3" = "3:"; + }; + }; + "sway/window" = { + icon = true; + format = "{}"; + }; + tray = { + icon-size = 12; + spacing = 2; + }; + backlight = { + format = "{icon} {percent}%"; + format-icons = ["" ""]; + }; + "custom/gpg-status" = { + format = "{}"; + interval = 300; + return-type = "json"; + exec = "${pkgs.waybar-gpg}/bin/kat-gpg-status"; + }; + "custom/headset-icon" = { + format = ""; + interval = 60; + exec-if = "${pkgs.headsetcontrol}/bin/headsetcontrol -c"; + exec = "echo 'mew'"; + }; + "custom/headset" = { + format = "{}"; + interval = 60; + exec-if = "${pkgs.headsetcontrol}/bin/headsetcontrol -c"; + exec = "${pkgs.headsetcontrol}/bin/headsetcontrol -b | ${pkgs.gnugrep}/bin/grep Battery | ${pkgs.coreutils}/bin/cut -d ' ' -f2"; + }; + "custom/konawall" = { + format = "{}"; + interval = "once"; + return-type = "json"; + exec = "${pkgs.waybar-konawall}/bin/konawall-status"; + on-click = "${pkgs.waybar-konawall}/bin/konawall-toggle"; + on-click-right = "systemctl --user restart konawall"; + signal = 8; + }; + "custom/mail-icon".format = ""; + "custom/mail" = { + format = "{}"; + interval = 30; + exec = "${pkgs.notmuch-arc}/bin/notmuch count tag:flagged OR tag:inbox AND NOT tag:killed"; + }; + "custom/cpu-icon".format = ""; + cpu.format = "{usage}%"; + "custom/memory-icon".format = ""; + memory.format = "{percentage}%"; + "temperature#icon" = { + format = "{icon}"; + format-icons = ["" "" ""]; + critical-threshold = 80; + }; + temperature = { + format = "{temperatureC}°C"; + critical-threshold = 80; + }; + idle_inhibitor = { + format = "{icon}"; + format-icons = { + activated = ""; + deactivated = ""; + }; + }; + "battery#icon" = { + states = { + good = 90; + warning = 30; + critical = 15; + }; + format = "{icon}"; + format-charging = ""; + format-plugged = ""; + format-icons = [ "" "" "" "" "" ]; + }; + battery = { + states = { + good = 90; + warning = 30; + critical = 15; + }; + format = "{capacity}%"; + format-charging = "{capacity}%"; + format-plugged = "{capacity}%"; + format-alt = "{time}"; + }; + "pulseaudio#icon" = { + format = "{icon}"; + format-muted = "婢"; + on-click = "foot pulsemixer"; + format-icons = { + default = [ + "" + "" + "" + ]; + }; + }; + pulseaudio = { + format = "{volume}%"; + on-click = "foot pulsemixer"; + }; + network = { + format-wifi = "直"; + format-ethernet = ""; + format-linked = " {ifname} (NO IP)"; + format-disconnected = " DC"; + format-alt = "{ifname}: {ipaddr}/{cidr}"; + tooltip-format-wifi = "{essid} ({signalStrength}%)"; + }; + "clock#original" = { + format = "{:%a, %F %T}"; + tooltip = true; + tooltip-format = "{:%A, %F %T %z (%Z)}"; + timezones = [ + "America/Vancouver" + ]; + interval = 1; + }; + }; + }]; + }; } diff --git a/home/waybar/waybar.sass b/home/waybar/waybar.sass index da9956ad..f42ddf93 100644 --- a/home/waybar/waybar.sass +++ b/home/waybar/waybar.sass @@ -1,5 +1,5 @@ %extend_1 - padding: 0 6px + padding: 0 8px transition: none color: $base00 @@ -7,9 +7,9 @@ border: none border-radius: 0 background: none - font-family: $font + font-family: "Iosevka SS10", "Font Awesome 6 Free", "Font Awesome 6 Brands" font-size: $font_size - min-height: 12px + min-height: 8px text-shadow: none box-shadow: none @@ -31,18 +31,6 @@ tooltip background: $base01 color: $base07 -#custom-arc-h - @extend %extend_1 - background: $base0B - -#custom-miku-h - @extend %extend_1 - background: $base0C - -#custom-hex-h - @extend %extend_1 - background: $base0E - #cpu, #memory, #temperature, #pulseaudio, #backlight, #battery, #custom-mail, #custom-headset, #clock.arc, #clock.hex, #clock.miku background: $base01 color: $base07 diff --git a/modules/home/theme.nix b/modules/home/theme.nix index 96d35378..f7b464fd 100644 --- a/modules/home/theme.nix +++ b/modules/home/theme.nix @@ -56,10 +56,10 @@ let cfg = config.kw.theme; in }; config = mkIf (cfg.enable) { kw.theme = { - base16 = lib.mapAttrs' (k: v: lib.nameValuePair k "#${v.hex.rgb}") - (lib.filterAttrs (n: _: lib.hasInfix "base" n) config.lib.arc.base16.schemeForAlias.default); - base16t = lib.mapAttrs' (k: v: lib.nameValuePair "${k}t" "rgba(${toString v.rgb.r}, ${toString v.rgb.g}, ${toString v.rgb.b}, ${toString cfg.alpha})") - (lib.filterAttrs (n: _: lib.hasInfix "base" n) config.lib.arc.base16.schemeForAlias.default); + base16 = lib.mapAttrs' (k: v: lib.nameValuePair k "#${v.hex}") + (lib.filterAttrs (n: _: lib.hasInfix "base" n) config.base16.defaultScheme); + base16t = lib.mapAttrs' (k: v: lib.nameValuePair "${k}t" "rgba(${toString v.red.byte}, ${toString v.green.byte}, ${toString v.blue.byte}, ${toString cfg.alpha})") + (lib.filterAttrs (n: _: lib.hasInfix "base" n) config.base16.defaultScheme); alpha = 0.7; }; @@ -144,7 +144,7 @@ let cfg = config.kw.theme; in phases = [ "buildPhase" ]; buildPhase = '' cat $variables $src > src-mut.sass - sass src-mut.sass $out --sourcemap=none --style=${cfg.sass.css_style} + sass src-mut.sass $out --sourcemap=none --trace --style=${cfg.sass.css_style} ''; }) { }; diff --git a/nixos/base/base16.nix b/nixos/base/base16.nix index 0809b337..4c1d942f 100644 --- a/nixos/base/base16.nix +++ b/nixos/base/base16.nix @@ -2,10 +2,9 @@ { base16 = { - inherit (config.home-manager.users.kat.base16) schemes alias; + inherit (config.home-manager.users.kat.base16) defaultSchemeName defaultScheme schemes; console = { enable = true; - scheme = config.home-manager.users.kat.base16.alias.default; }; }; } diff --git a/nixos/light.nix b/nixos/light.nix index a684425e..33b4f162 100644 --- a/nixos/light.nix +++ b/nixos/light.nix @@ -1,15 +1,12 @@ -{ config, lib, ... }: with lib; { - options.home-manager.users = let - lightModeExtend = { config, nixos, ... }: { - gtk.iconTheme.name = mkForce "Papirus-Light"; - base16 = { - alias.default = "atelier.atelier-cave-light"; - defaultSchemeName = "atelier.atelier-cave-light"; - }; - }; - in mkOption { - type = types.attrsOf (types.submoduleWith { - modules = singleton lightModeExtend; - }); - }; +{ config, lib, ... }: with lib; let +lightModeExtend = { config, nixos, ... }: { + gtk.iconTheme.name = mkForce "Papirus-Light"; + base16 = { + defaultSchemeName = mkForce "light"; + }; +}; +in { + home-manager.sharedModules = [ + lightModeExtend + ]; }