diff --git a/modules/fonts.nix b/modules/fonts.nix index 8abb971..2225251 100644 --- a/modules/fonts.nix +++ b/modules/fonts.nix @@ -3,6 +3,7 @@ { console.font = "Lat2-Terminus16"; fonts.packages = with pkgs; lib.mkIf config.jalr.gui.enable [ + nerd-fonts.fira-code nerd-fonts.iosevka nerd-fonts.iosevka-term nerd-fonts.iosevka-term-slab diff --git a/users/jalr/modules/alacritty.nix b/users/jalr/modules/alacritty.nix deleted file mode 100644 index 4196df8..0000000 --- a/users/jalr/modules/alacritty.nix +++ /dev/null @@ -1,158 +0,0 @@ -{ lib, pkgs, nixosConfig, ... }: -let - solarized = import ./solarized.nix; - tomlFormat = pkgs.formats.toml { }; - - colorschemes = { - # https://github.com/alacritty/alacritty/wiki/Color-schemes#solarized - solarized-dark = { - # Default colors - primary = { - background = solarized.base03.hex; - foreground = solarized.base0.hex; - }; - - # Cursor colors - cursor = { - text = solarized.base03.hex; - cursor = solarized.base0.hex; - }; - - # Normal colors - normal = { - black = solarized.base02.hex; - red = solarized.red.hex; - green = solarized.green.hex; - yellow = solarized.yellow.hex; - blue = solarized.blue.hex; - magenta = solarized.magenta.hex; - cyan = solarized.cyan.hex; - white = solarized.base2.hex; - }; - - # Bright colors - bright = { - black = solarized.base03.hex; - red = solarized.orange.hex; - green = solarized.base01.hex; - yellow = solarized.base00.hex; - blue = solarized.base0.hex; - magenta = solarized.violet.hex; - cyan = solarized.base1.hex; - white = solarized.base3.hex; - }; - }; - - solarized-light = { - # Default colors - primary = { - background = solarized.base3.hex; - foreground = solarized.base00.hex; - }; - - # Cursor colors - cursor = { - text = solarized.base3.hex; - cursor = solarized.base00.hex; - }; - - # Normal colors - normal = { - black = solarized.base02.hex; - red = solarized.red.hex; - green = solarized.green.hex; - yellow = solarized.yellow.hex; - blue = solarized.blue.hex; - magenta = solarized.magenta.hex; - cyan = solarized.cyan.hex; - white = solarized.base2.hex; - }; - - # Bright colors - bright = { - black = solarized.base03.hex; - red = solarized.orange.hex; - green = solarized.base01.hex; - yellow = solarized.base00.hex; - blue = solarized.base0.hex; - magenta = solarized.violet.hex; - cyan = solarized.base1.hex; - white = solarized.base3.hex; - }; - }; - }; - commonSettings = { - font = { - normal = { - family = "Inconsolata for Powerline"; - style = "Regular"; - }; - size = 12; - }; - - mouse.hide_when_typing = true; - - keyboard.bindings = [ - { - key = "F1"; - mods = "Control"; - action = "DecreaseFontSize"; - } - { - key = "F2"; - mods = "Control"; - action = "IncreaseFontSize"; - } - ]; - - bell = { - duration = 100; - color = "#000000"; - }; - - window.dynamic_title = true; - - scrolling.history = 100000; - - window.opacity = 0.9; - }; - settings = { - dark = commonSettings // { - colors = colorschemes.solarized-dark; - }; - light = commonSettings // { - colors = colorschemes.solarized-light; - }; - }; -in -{ - - programs.alacritty = { - inherit (nixosConfig.jalr.gui) enable; - }; - - xdg.configFile = lib.attrsets.mapAttrs' - (colorScheme: cfg: - let name = "alacritty-${colorScheme}.toml"; - in - lib.attrsets.nameValuePair "alacritty/${name}" { - source = tomlFormat.generate name cfg; - target = "alacritty/${name}"; - } - ) - settings; - - programs.fish.functions = { - ssh = { - description = "ssh wrapper function"; - wraps = "ssh"; - body = '' - if [ "$TERM" = alacritty ] - TERM=xterm-256color command ssh $argv - else - command ssh $argv - end - ''; - }; - }; -} diff --git a/users/jalr/modules/default.nix b/users/jalr/modules/default.nix index b308841..76f8f9e 100644 --- a/users/jalr/modules/default.nix +++ b/users/jalr/modules/default.nix @@ -2,7 +2,6 @@ imports = [ ./3d-modeling.nix ./3d-printing.nix - ./alacritty.nix ./ardour.nix ./aws.nix ./cli @@ -43,5 +42,6 @@ ./trilium.nix ./vdirsyncer.nix ./vesc-tool.nix + ./wezterm.nix ]; } diff --git a/users/jalr/modules/dynamic-colors.nix b/users/jalr/modules/dynamic-colors.nix index 0113581..c97e9ed 100644 --- a/users/jalr/modules/dynamic-colors.nix +++ b/users/jalr/modules/dynamic-colors.nix @@ -7,12 +7,6 @@ let done < "$1" ''; applicationConfig = [ - { - dir = "~/.config/alacritty"; - light = "alacritty-light.toml"; - dark = "alacritty-dark.toml"; - target = "alacritty.toml"; - } { dir = "~/.config/wofi"; light = "color-light"; diff --git a/users/jalr/modules/sway/default.nix b/users/jalr/modules/sway/default.nix index 2d1a004..846c1ae 100644 --- a/users/jalr/modules/sway/default.nix +++ b/users/jalr/modules/sway/default.nix @@ -3,18 +3,18 @@ let solarized = import ../solarized.nix; terminalEmulator = - pkgs.writeShellScript "alacritty-sway-cwd" '' - this_alacritty_pid="$(${pkgs.sway}/bin/swaymsg -t get_tree | ${pkgs.jq}/bin/jq -e 'recurse(.nodes[]?) | select((.focused==true) and (.app_id=="Alacritty")).pid')" + pkgs.writeShellScript "wezterm-sway-cwd" '' + this_wezterm_pid="$(${pkgs.sway}/bin/swaymsg -t get_tree --raw | ${pkgs.jq}/bin/jq -e 'recurse(.nodes[]?) | select((.focused==true) and (.app_id=="org.wezfurlong.wezterm")).pid')" - if [ "$this_alacritty_pid" ]; then - child_pid="$(pgrep -P "$this_alacritty_pid")" + if [ "$this_wezterm_pid" ]; then + child_pid="$(pgrep -P "$this_wezterm_pid")" cwd="$(readlink /proc/$child_pid/cwd)" fi if [ -e "$cwd" ]; then - exec ${pkgs.alacritty}/bin/alacritty --working-directory "$cwd" + exec ${pkgs.wezterm}/bin/wezterm start --cwd "$cwd" fi - exec ${pkgs.alacritty}/bin/alacritty + exec ${pkgs.wezterm}/bin/wezterm ''; cfg = config.wayland.windowManager.sway.config; wallpaper = pkgs.fetchurl { diff --git a/users/jalr/modules/sway/waybar.nix b/users/jalr/modules/sway/waybar.nix index bbf1132..628e3e8 100644 --- a/users/jalr/modules/sway/waybar.nix +++ b/users/jalr/modules/sway/waybar.nix @@ -176,7 +176,7 @@ in format-disconnected = "Disconnected ⚠ "; format-alt = "{ifname}: {ipaddr}/{cidr}"; tooltip = false; - on-click-right = "${config.programs.alacritty.package}/bin/alacritty -e ${pkgs.networkmanager}/bin/nmtui"; + on-click-right = "${config.programs.wezterm.package}/bin/wezterm start -e ${pkgs.networkmanager}/bin/nmtui"; }; memory = { interval = 2; diff --git a/users/jalr/modules/wezterm.nix b/users/jalr/modules/wezterm.nix new file mode 100644 index 0000000..be238eb --- /dev/null +++ b/users/jalr/modules/wezterm.nix @@ -0,0 +1,46 @@ +{ config, lib, nixosConfig, ... }: + +let + weztermConfig = { + hide_tab_bar_if_only_one_tab = true; + #color_scheme = "Solarized (dark) (terminal.sexy)"; + #color_scheme = "Solarized (light) (terminal.sexy)"; + font = "FiraCode Nerd Font Mono"; + font_size = 12; + }; +in +{ + programs.wezterm = { + inherit (nixosConfig.jalr.gui) enable; + extraConfig = '' + local wezterm = require 'wezterm' + ${lib.generators.toLua {asBindings=true;} {config=weztermConfig;}} + config.font = wezterm.font(config.font) + + function get_appearance() + if wezterm.gui then + return wezterm.gui.get_appearance() + end + return 'Light' + end + + function scheme_for_appearance(appearance) + if appearance:find 'Dark' then + return 'Builtin Solarized Dark' + else + return 'Builtin Solarized Light' + end + end + + config.color_scheme = scheme_for_appearance(get_appearance()) + + return config + ''; + }; + /* + file = io.open("${config.xdg.configHome}/wezterm/color_scheme.txt", "r") + io.input(file) + config.color_scheme = io.read() + io.close(file) + */ +}