switch to foot

This commit is contained in:
Quentin Boyer 2022-02-13 14:36:37 +01:00
parent 2d6006fd8c
commit da02b59ebf
3 changed files with 150 additions and 1 deletions

View file

@ -1,6 +1,7 @@
{ config, lib, pkgs, ... }:
{
imports = [ ./terminal ];
home.packages = with pkgs; [
sway
@ -23,6 +24,37 @@
LIBSEAT_BACKEND = "logind";
};
terminal = {
enable = true;
kind = "foot";
colors = {
background = "000000";
foreground = "ffffff";
black = {
normal = "000000";
bright = "545454";
};
red = { normal = "ff5555"; };
green = { normal = "55ff55"; };
yellow = { normal = "ffff55"; };
blue = { normal = "5555ff"; };
magenta = { normal = "ff55ff"; };
cyan = { normal = "55ffff"; };
white = {
normal = "bbbbbb";
bright = "ffffff";
};
selectionForeground = "000000";
};
font = {
family = "Hack Nerd Font Mono";
size = 7;
};
};
programs = {
mako = {
enable = true;
@ -140,7 +172,6 @@
{ command = "wdumpkeys >> ~/.keydump"; }
];
menu = "${pkgs.wofi}/bin/wofi --show drun,run --allow-images";
terminal = "${pkgs.kitty}/bin/kitty";
keybindings =
let
mod = config.wayland.windowManager.sway.config.modifier;

59
wm/terminal/default.nix Normal file
View file

@ -0,0 +1,59 @@
{ config, lib, pkgs, ... }:
with lib;
with builtins;
let
mkColor = mkOption { type = types.nullOr types.str; default = null; };
mkColorPair = {
normal = mkColor;
bright = mkColor;
};
cfg = config.terminal;
cCfg = cfg.colors;
in
{
imports = [ ./foot.nix ];
options = {
terminal = {
enable = mkOption {
type = types.bool;
default = false;
description = "Manage terminal";
};
kind = mkOption {
type = types.enum [ "foot" ];
default = "foot";
description = "The terminal to be used";
};
colors = {
background = mkColor;
foreground = mkColor;
black = mkColorPair;
red = mkColorPair;
green = mkColorPair;
yellow = mkColorPair;
blue = mkColorPair;
magenta = mkColorPair;
cyan = mkColorPair;
white = mkColorPair;
selectionForeground = mkColor;
};
font = {
size = mkOption {
type = types.int;
default = 12;
description = "terminal font size";
};
family = mkOption {
type = types.str;
default = "monospace";
description = "font family";
};
};
};
};
}

59
wm/terminal/foot.nix Normal file
View file

@ -0,0 +1,59 @@
{ config, lib, pkgs, ... }:
with lib;
with builtins;
let
cfg = config.terminal;
cCfg = cfg.colors;
in
{
config = mkIf (cfg.enable && cfg.kind == "foot") {
programs.foot = {
enable = true;
settings = {
colors =
let
colorCfg = value: mkIf (value != null) value;
colorCfgNormal = color: colorCfg color.normal;
colorCfgBright = color: if color.bright != null then color.bright else colorCfgNormal color;
in
{
background = colorCfg cCfg.background;
foreground = colorCfg cCfg.foreground;
regular0 = colorCfgNormal cCfg.black;
bright0 = colorCfgBright cCfg.black;
regular1 = colorCfgNormal cCfg.red;
bright1 = colorCfgBright cCfg.red;
regular2 = colorCfgNormal cCfg.green;
bright2 = colorCfgBright cCfg.green;
regular3 = colorCfgNormal cCfg.yellow;
bright3 = colorCfgBright cCfg.yellow;
regular4 = colorCfgNormal cCfg.blue;
bright4 = colorCfgBright cCfg.blue;
regular5 = colorCfgNormal cCfg.magenta;
bright5 = colorCfgBright cCfg.magenta;
regular6 = colorCfgNormal cCfg.cyan;
bright6 = colorCfgBright cCfg.cyan;
regular7 = colorCfgNormal cCfg.white;
bright7 = colorCfgBright cCfg.white;
selection-foreground = colorCfg cCfg.selectionForeground;
};
main = {
font = "${cfg.font.family}:size=${toString cfg.font.size}";
};
};
};
wayland.windowManager.sway.config.terminal = "${pkgs.foot}/bin/foot";
};
}