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.
nazuna
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 = [
./alacritty.nix
./anki
./corectrl.nix
./foot.nix
./games.nix
./ghci.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 {
visualizerSupport = true;
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')
settings = {

View File

@ -185,7 +185,7 @@ in
location.directory = "/tmp";
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" ];
url.default_page = "about:blank";
url.start_pages = [ "about:blank" ];

View File

@ -43,7 +43,7 @@ in
config = {
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 --";
@ -324,7 +324,6 @@ in
};
home.packages = with pkgs; [
alacritty # terminal
brightnessctl # control screen brightness
sway-contrib.grimshot # screenshots
waypipe # forward application over ssh

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 = "foot -e ${pkgs.networkmanager}/bin/nmtui";
};
"custom/vpn" = {
interval = 10;

View File

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