Switch from alacritty to foot

Some programs have difficulties with foot as TERM (e. g. aerc’s
terminal). Therefore, it is manually set to xterm-256color and true
colour support is forced in tmux.
This commit is contained in:
Simon Bruder 2022-07-06 01:09:59 +02:00
parent 9048611e06
commit bdd4956599
Signed by: simon
GPG key ID: 8D3C82F9F309F8EC
8 changed files with 64 additions and 100 deletions

View file

@ -1,79 +0,0 @@
{ nixosConfig, ... }:
let
common = import ./common.nix;
solarized = common.colorschemes.solarized;
colorschemes = {
# https://github.com/alacritty/alacritty/wiki/Color-schemes#solarized
solarized-dark = {
# Default colors
primary = {
background = solarized.base03;
foreground = solarized.base0;
};
# Cursor colors
cursor = {
text = solarized.base03;
cursor = solarized.base0;
};
# Normal colors
normal = {
black = solarized.base02;
red = solarized.red;
green = solarized.green;
yellow = solarized.yellow;
blue = solarized.blue;
magenta = solarized.magenta;
cyan = solarized.cyan;
white = solarized.base2;
};
# Bright colors
bright = {
black = solarized.base03;
red = solarized.orange;
green = solarized.base01;
yellow = solarized.base00;
blue = solarized.base0;
magenta = solarized.violet;
cyan = solarized.base1;
white = solarized.base3;
};
};
};
in
{
programs.alacritty = {
enable = nixosConfig.sbruder.gui.enable;
settings = {
font = {
normal = {
family = "Iosevka Nerd Font";
style = "Regular";
};
size = 13.5;
};
mouse.hide_when_typing = true;
key_bindings = [
{
key = "V";
mods = "Control|Alt";
action = "Paste";
}
{
key = "C";
mods = "Control|Alt";
action = "Copy";
}
];
bell.duration = 100;
colors = colorschemes.solarized-dark;
};
};
}

View file

@ -1,8 +1,8 @@
{ {
imports = [ imports = [
./alacritty.nix
./anki ./anki
./corectrl.nix ./corectrl.nix
./foot.nix
./games.nix ./games.nix
./ghci.nix ./ghci.nix
./git.nix ./git.nix

View file

@ -0,0 +1,59 @@
{ lib, nixosConfig, ... }:
let
common = import ./common.nix;
solarized = lib.mapAttrs (k: v: builtins.substring 1 6 v) common.colorschemes.solarized;
in
{
programs.foot = {
enable = nixosConfig.sbruder.gui.enable;
settings = {
main = {
font = "monospace:size=13.5, emoji:size=11";
dpi-aware = "no";
pad = "0x0";
term = "xterm-256color";
};
bell = {
urgent = "yes";
};
mouse = {
hide-when-typing = "yes";
};
cursor = {
color = "${solarized.base03} ${solarized.base0}";
};
colors = {
background = solarized.base03;
foreground = solarized.base0;
regular0 = solarized.base02;
regular1 = solarized.red;
regular2 = solarized.green;
regular3 = solarized.yellow;
regular4 = solarized.blue;
regular5 = solarized.magenta;
regular6 = solarized.cyan;
regular7 = solarized.base2;
bright0 = solarized.base03;
bright1 = solarized.orange;
bright2 = solarized.base01;
bright3 = solarized.base00;
bright4 = solarized.base0;
bright5 = solarized.violet;
bright6 = solarized.base1;
bright7 = solarized.base3;
};
key-bindings = {
clipboard-copy = "Control+Mod1+c XF86Copy";
clipboard-paste = "Control+Mod1+v XF86Paste";
spawn-terminal = "none"; # I dont need it
};
};
};
}

View file

@ -32,21 +32,6 @@ lib.mkIf nixosConfig.sbruder.gui.enable {
package = (pkgs.ncmpcpp.override { package = (pkgs.ncmpcpp.override {
visualizerSupport = true; visualizerSupport = true;
taglibSupport = false; taglibSupport = false;
}).overrideAttrs (o: o // {
nativeBuildInputs = o.nativeBuildInputs ++ (with pkgs; [ makeWrapper ]);
# !!! HACK: ncurses uses terminfos rs1 for alacritty (\033c\033]104\007)
# to reset the terminal when the window is resized. For achieving the
# required effect (clearing the terminal), \033c would be enough.
# \033]104\007 additionally resets colours set by dynamic-colors. This
# makes text written in those colours almost unreadable. Since xterm only
# uses \033c to reset the terminal and does not make ncmpcpp misbehave in
# alacritty, this wrapper tricks ncurses into thinking it is running in
# xterm.
postInstall = ''
wrapProgram $out/bin/ncmpcpp \
--run '[ "$TERM" = "alacritty" ] && export TERM="xterm"'
'';
}); });
mpdMusicDir = null; # does not work (not of type `null or path') mpdMusicDir = null; # does not work (not of type `null or path')
settings = { settings = {

View file

@ -185,7 +185,7 @@ in
location.directory = "/tmp"; location.directory = "/tmp";
open_dispatcher = "${pkgs.xdg-utils}/bin/xdg-open"; # QDesktopServices.openUrl always opens Firefox open_dispatcher = "${pkgs.xdg-utils}/bin/xdg-open"; # QDesktopServices.openUrl always opens Firefox
}; };
editor.command = [ "alacritty" "-e" "nvim" "-f" "{file}" "-c" "normal {line}G{column0}l" ]; editor.command = [ "foot" "-e" "nvim" "-f" "{file}" "-c" "normal {line}G{column0}l" ];
spellcheck.languages = [ "de-DE" "en-GB" ]; spellcheck.languages = [ "de-DE" "en-GB" ];
url.default_page = "about:blank"; url.default_page = "about:blank";
url.start_pages = [ "about:blank" ]; url.start_pages = [ "about:blank" ];

View file

@ -43,7 +43,7 @@ in
config = { config = {
modifier = "Mod4"; modifier = "Mod4";
terminal = "alacritty"; terminal = "foot";
menu = "${pkgs.dmenu-wayland}/bin/dmenu-wl_path | ${pkgs.dmenu-wayland}/bin/dmenu-wl -nb '#002b36' -nf '#839496' -sb '#859900' -sf '#073642' | ${pkgs.findutils}/bin/xargs swaymsg exec --"; menu = "${pkgs.dmenu-wayland}/bin/dmenu-wl_path | ${pkgs.dmenu-wayland}/bin/dmenu-wl -nb '#002b36' -nf '#839496' -sb '#859900' -sf '#073642' | ${pkgs.findutils}/bin/xargs swaymsg exec --";
@ -324,7 +324,6 @@ in
}; };
home.packages = with pkgs; [ home.packages = with pkgs; [
alacritty # terminal
brightnessctl # control screen brightness brightnessctl # control screen brightness
sway-contrib.grimshot # screenshots sway-contrib.grimshot # screenshots
waypipe # forward application over ssh waypipe # forward application over ssh

View file

@ -176,7 +176,7 @@ in
format-disconnected = "Disconnected "; format-disconnected = "Disconnected ";
format-alt = "{ifname}: {ipaddr}/{cidr}"; format-alt = "{ifname}: {ipaddr}/{cidr}";
tooltip = false; tooltip = false;
on-click-right = "${config.programs.alacritty.package}/bin/alacritty -e ${pkgs.networkmanager}/bin/nmtui"; on-click-right = "foot -e ${pkgs.networkmanager}/bin/nmtui";
}; };
"custom/vpn" = { "custom/vpn" = {
interval = 10; interval = 10;

View file

@ -25,7 +25,7 @@
set -g mouse off set -g mouse off
# true color support # true color support
set -ga terminal-overrides ",alacritty:Tc" set -ga terminal-overrides ",xterm-256color:Tc"
''; '';
}; };
} }