Configure terminal emulator colors centrally

This commit is contained in:
Artemis Tosini 2023-11-04 01:34:32 +00:00
parent 95e28a3cba
commit 411cd1d2e3
Signed by: artemist
GPG key ID: EE5227935FE3FF18
7 changed files with 107 additions and 86 deletions

View file

@ -201,11 +201,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1698795315, "lastModified": 1699025595,
"narHash": "sha256-fF5ScAWLMHXOuqsbLSG137kS1D+gr9JPtm4H2c4yBbU=", "narHash": "sha256-e+o4PoSu2Z6Ww8y/AVUmMU200rNZoRK+p2opQ7Db8Rg=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "9bc7d84b8213255ecd5eb6299afdb77c36ece71d", "rev": "8765d4e38aa0be53cdeee26f7386173e6c65618d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -265,11 +265,11 @@
}, },
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1698053470, "lastModified": 1699044561,
"narHash": "sha256-sP8D/41UiwC2qn0X40oi+DfuVzNHMROqIWdSdCI/AYA=", "narHash": "sha256-3uHmbq74CicpBPP40a6NHp830S7Rvh33uFgfIIC+7nw=",
"owner": "nixos", "owner": "nixos",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "80d98a7d55c6e27954a166cb583a41325e9512d7", "rev": "87f8403371fa74d9ad21ed677403cc235f37b96c",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -280,11 +280,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1698611440, "lastModified": 1698924604,
"narHash": "sha256-jPjHjrerhYDy3q9+s5EAsuhyhuknNfowY6yt6pjn9pc=", "narHash": "sha256-GCFbkl2tj8fEZBZCw3Tc0AkGo0v+YrQlohhEGJ/X4s0=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "0cbe9f69c234a7700596e943bfae7ef27a31b735", "rev": "fa804edfb7869c9fb230e174182a8a1a7e512c40",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -338,11 +338,11 @@
"pre-commit-hooks": "pre-commit-hooks" "pre-commit-hooks": "pre-commit-hooks"
}, },
"locked": { "locked": {
"lastModified": 1698761408, "lastModified": 1699022904,
"narHash": "sha256-9uw2BSrhFaWZwOstP6hY8jgrs/w45kz7TSP5+KdZZKg=", "narHash": "sha256-Qc0zMAsRU7gyqHmkc9QUP/FHCNKNkoYGoojnMAUcUQg=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixvim", "repo": "nixvim",
"rev": "77a3f3c29817e8ec14448022c934ae708968fd22", "rev": "76291156fa182a7d3fdfa9233a7bcbe116c50b68",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -11,7 +11,7 @@
./gtk.nix ./gtk.nix
./git.nix ./git.nix
./mpv.nix ./mpv.nix
./kitty.nix ./terminals.nix
./ssh ./ssh
./gpg.nix ./gpg.nix
./dirs.nix ./dirs.nix
@ -27,7 +27,6 @@
xdg.enable = true; xdg.enable = true;
xdg.configFile = { xdg.configFile = {
"alacritty/alacritty.yml".source = ./files/alacritty.yml;
"swaylock/config".text = '' "swaylock/config".text = ''
ignore-empty-password ignore-empty-password
indicator-caps-lock indicator-caps-lock

View file

@ -1,42 +0,0 @@
scrolling:
history: 16384
font:
normal:
family: Fira Code
size: 8
shell:
program: /run/current-system/sw/bin/fish
# Colors (Hyper)
colors:
# Default colors
primary:
background: '0x000000'
foreground: '0xffffff'
cursor:
text: '0xF81CE5'
cursor: '0xffffff'
# Normal colors
normal:
black: '0x000000'
red: '0xfe0100'
green: '0x33ff00'
yellow: '0xfeff00'
blue: '0x0066ff'
magenta: '0xcc00ff'
cyan: '0x00ffff'
white: '0xd0d0d0'
# Bright colors
bright:
black: '0x808080'
red: '0xfe0100'
green: '0x33ff00'
yellow: '0xfeff00'
blue: '0x0066ff'
magenta: '0xcc00ff'
cyan: '0x00ffff'
white: '0xFFFFFF'

View file

@ -1,21 +0,0 @@
{ ... }:
{
programs.kitty = {
enable = true;
font = {
name = "Fira Code";
size = 9;
};
settings = {
update_check_interval = 0;
close_on_child_death = true;
confirm_os_window_close = 2;
enable_audio_bell = 0;
term = "kitty";
clipboard_control = false;
scrollback_lines = 32768;
touch_scroll_multiplier = 4;
};
};
}

93
home/terminals.nix Normal file
View file

@ -0,0 +1,93 @@
{ lib, ... }:
with lib;
let
colors = {
primary = {
background = "000000";
foreground = "ffffff";
};
cursor = {
# Text under cursor
text = "f81ce5";
# Foreground of cursor
cursor = "ffffff";
};
# Numbered colors in standard order (see colorNames)
normal = [
"000000"
"fe0100"
"33ff00"
"feff00"
"0066ff"
"cc00ff"
"00ffff"
"d0d0d0"
];
bright = [
"808080"
"fe0100"
"33ff00"
"feff00"
"0066ff"
"cc00ff"
"00ffff"
"ffffff"
];
};
colorNames =
[ "black" "red" "green" "yellow" "blue" "magenta" "cyan" "white" ];
namedColors = prefix: colors:
listToAttrs
(zipListsWith nameValuePair colorNames (map (c: prefix + c) colors));
numberedColors = attrPrefix: valuePrefix: attrOffset: colors:
listToAttrs (zipListsWith nameValuePair
(map (i: attrPrefix + toString (i + attrOffset)) (range 0 7))
(map (c: valuePrefix + c) colors));
font = {
name = "Fira Code";
size = 9;
};
in {
# Not used on most systems
programs.foot = {
settings = {
main.font = "${font.name}:size=${toString font.size}";
colors = colors.primary // (numberedColors "regular" "" 0 colors.normal)
// (numberedColors "bright" "" 0 colors.bright);
};
};
programs.alacritty = {
enable = true;
settings = {
scrolling.history = 16384;
font = {
normal.family = font.name;
inherit (font) size;
};
colors = with colors; {
primary = mapAttrs (_: value: "0x" + value) primary;
cursor = mapAttrs (_: value: "0x" + value) cursor;
normal = namedColors "0x" normal;
bright = namedColors "0x" bright;
};
};
};
programs.kitty = {
enable = true;
inherit font;
settings = {
update_check_interval = 0;
close_on_child_death = true;
confirm_os_window_close = 2;
enable_audio_bell = 0;
term = "kitty";
clipboard_control = false;
scrollback_lines = 32768;
touch_scroll_multiplier = 4;
} // (numberedColors "color" "#" 0 colors.normal)
// (numberedColors "color" "#" 8 colors.bright);
};
}

View file

@ -97,7 +97,6 @@
yubikey-manager yubikey-manager
# GUI tools # GUI tools
alacritty
evince evince
gnome3.eog gnome3.eog
gnome3.gnome-system-monitor gnome3.gnome-system-monitor

View file

@ -13,14 +13,7 @@
networking.hostName = "mistmane"; networking.hostName = "mistmane";
home-manager.users.artemis = { home-manager.users.artemis = {
programs.foot = { programs.foot.enable = true;
enable = true;
settings.main = {
shell = "/run/current-system/sw/bin/fish";
font = "Fira Code:size=6";
dpi-aware = "yes";
};
};
wayland.windowManager.sway.config = { wayland.windowManager.sway.config = {
terminal = lib.mkForce "foot"; terminal = lib.mkForce "foot";
input."9610:30:HAILUCK_CO.,LTD_USB_KEYBOARD_Touchpad" = { input."9610:30:HAILUCK_CO.,LTD_USB_KEYBOARD_Touchpad" = {