174 lines
4.2 KiB
Nix
174 lines
4.2 KiB
Nix
{ lib, pkgs, nixosConfig, ... }:
|
|
let
|
|
solarized = import ./solarized.nix;
|
|
|
|
#nixosConfig.jalr.terminalEmulator.command = pkgs.writeShellScriptBin "alacritty-sway-cwd" ''
|
|
# this_alacritty_pid="$(swaymsg -t get_tree | ${pkgs.jq} -e 'recurse(.nodes[]?) | select((.focused==true) and (.app_id=="Alacritty")).pid')"
|
|
|
|
# if [ "$this_alacritty_pid" ]; then
|
|
# child_pid="$(pgrep -P "$this_alacritty_pid")"
|
|
# cwd="$(readlink /proc/$child_pid/cwd)"
|
|
# fi
|
|
# if [ -e "$cwd" ]; then
|
|
# exec ${pkgs.alacritty} --working-directory "$cwd"
|
|
# fi
|
|
|
|
# exec alacritty
|
|
#'';
|
|
|
|
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;
|
|
|
|
key_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.95;
|
|
};
|
|
settings = {
|
|
dark = commonSettings // {
|
|
colors = colorschemes.solarized-dark;
|
|
};
|
|
light = commonSettings // {
|
|
colors = colorschemes.solarized-light;
|
|
};
|
|
};
|
|
in
|
|
{
|
|
|
|
programs.alacritty = {
|
|
enable = nixosConfig.jalr.gui.enable;
|
|
};
|
|
|
|
# The option `home-manager.users.jalr.xdg.configFile.dark.alacritty/alacritty-dark.yml' does not exist
|
|
|
|
/*
|
|
xdg.configFile = builtins.mapAttrs (colorScheme: cfg: {
|
|
"alacritty/alacritty-${colorScheme}.yml" = lib.replaceStrings [ "\\\\" ] [ "\\" ] (builtins.toJSON cfg);
|
|
}) settings;
|
|
*/
|
|
|
|
xdg.configFile = lib.attrsets.mapAttrs'
|
|
(colorScheme: cfg: lib.attrsets.nameValuePair "alacritty/alacritty-${colorScheme}.yml" {
|
|
text = lib.replaceStrings [ "\\\\" ] [ "\\" ] (builtins.toJSON cfg);
|
|
})
|
|
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
|
|
'';
|
|
};
|
|
};
|
|
}
|