Replace alacritty with wezterm

as alacritty doesn't support ligatures.

See https://github.com/alacritty/alacritty/issues/50
This commit is contained in:
Jakob Lechner 2025-06-12 15:01:31 +02:00
parent 83e5e56a6b
commit 711c0eb0f0
7 changed files with 55 additions and 172 deletions

View file

@ -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

View file

@ -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
'';
};
};
}

View file

@ -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
];
}

View file

@ -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";

View file

@ -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 {

View file

@ -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;

View file

@ -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)
*/
}