diff --git a/hosts/homes/ambroisie@bazin/default.nix b/hosts/homes/ambroisie@bazin/default.nix index 365b70d..cfeba83 100644 --- a/hosts/homes/ambroisie@bazin/default.nix +++ b/hosts/homes/ambroisie@bazin/default.nix @@ -29,6 +29,8 @@ terminalFeatures = { # HTerm uses `xterm-256color` as its `$TERM`, so use that here xterm-256color = { }; + # Terminal app uses `xterm.js`, not HTerm + "xterm.js" = { }; }; }; diff --git a/hosts/homes/ambroisie@mousqueton/default.nix b/hosts/homes/ambroisie@mousqueton/default.nix index 1383618..b6193c9 100644 --- a/hosts/homes/ambroisie@mousqueton/default.nix +++ b/hosts/homes/ambroisie@mousqueton/default.nix @@ -35,6 +35,8 @@ terminalFeatures = { # HTerm uses `xterm-256color` as its `$TERM`, so use that here xterm-256color = { }; + # Terminal app uses `xterm.js`, not HTerm + "xterm.js" = { }; }; }; }; diff --git a/hosts/nixos/aramis/home.nix b/hosts/nixos/aramis/home.nix index e8c99e4..7bf6fe2 100644 --- a/hosts/nixos/aramis/home.nix +++ b/hosts/nixos/aramis/home.nix @@ -25,7 +25,7 @@ # Network-Manager applet nm-applet.enable = true; # Terminal - terminal.program = "alacritty"; + terminal.default = "alacritty"; # Transmission remote trgui.enable = true; # Zathura document viewer diff --git a/modules/home/firefox/tridactyl/default.nix b/modules/home/firefox/tridactyl/default.nix index 26ddfad..cd377e5 100644 --- a/modules/home/firefox/tridactyl/default.nix +++ b/modules/home/firefox/tridactyl/default.nix @@ -2,7 +2,7 @@ let cfg = config.my.home.firefox.tridactyl; - term = config.my.home.terminal.program; + term = config.my.home.terminal.default; vimCommandLine = { alacritty = ''-e "vim" "%f" "+normal!%lGzv%c|"''; diff --git a/modules/home/terminal/alacritty/default.nix b/modules/home/terminal/alacritty/default.nix index daf3e80..7d3e1d8 100644 --- a/modules/home/terminal/alacritty/default.nix +++ b/modules/home/terminal/alacritty/default.nix @@ -1,9 +1,16 @@ { config, lib, ... }: let - cfg = config.my.home.terminal; + cfg = config.my.home.terminal.alacritty; + inherit (config.my.home.terminal) colors; in { - config = lib.mkIf (cfg.program == "alacritty") { + options.my.home.terminal.alacritty = with lib; { + enable = lib.mkEnableOption "alacritty" // { + default = config.my.home.terminal.default == "alacritty"; + }; + }; + + config = lib.mkIf cfg.enable { programs.alacritty = { enable = true; @@ -14,36 +21,36 @@ in colors = { primary = { - background = cfg.colors.background; - foreground = cfg.colors.foreground; + background = colors.background; + foreground = colors.foreground; - bright_foreground = cfg.colors.foregroundBold; + bright_foreground = colors.foregroundBold; }; cursor = { - cursor = cfg.colors.cursor; + cursor = colors.cursor; }; normal = { - black = cfg.colors.black; - red = cfg.colors.red; - green = cfg.colors.green; - yellow = cfg.colors.yellow; - blue = cfg.colors.blue; - magenta = cfg.colors.magenta; - cyan = cfg.colors.cyan; - white = cfg.colors.white; + black = colors.black; + red = colors.red; + green = colors.green; + yellow = colors.yellow; + blue = colors.blue; + magenta = colors.magenta; + cyan = colors.cyan; + white = colors.white; }; bright = { - black = cfg.colors.blackBold; - red = cfg.colors.redBold; - green = cfg.colors.greenBold; - yellow = cfg.colors.yellowBold; - blue = cfg.colors.blueBold; - magenta = cfg.colors.magentaBold; - cyan = cfg.colors.cyanBold; - white = cfg.colors.whiteBold; + black = colors.blackBold; + red = colors.redBold; + green = colors.greenBold; + yellow = colors.yellowBold; + blue = colors.blueBold; + magenta = colors.magentaBold; + cyan = colors.cyanBold; + white = colors.whiteBold; }; }; }; diff --git a/modules/home/terminal/default.nix b/modules/home/terminal/default.nix index 20f36b5..72694d2 100644 --- a/modules/home/terminal/default.nix +++ b/modules/home/terminal/default.nix @@ -16,11 +16,11 @@ in options.my.home = with lib; { terminal = { - program = mkOption { + default = mkOption { type = with types; nullOr (enum [ "alacritty" "termite" ]); default = null; example = "termite"; - description = "Which terminal to use for home session"; + description = "Which default terminal to use for home session"; }; colors = { @@ -56,7 +56,7 @@ in }; }; - config.home.sessionVariables = lib.mkIf (cfg.program != null) { - TERMINAL = cfg.program; + config.home.sessionVariables = lib.mkIf (cfg.default != null) { + TERMINAL = cfg.default; }; } diff --git a/modules/home/terminal/termite/default.nix b/modules/home/terminal/termite/default.nix index e8f67a7..f130029 100644 --- a/modules/home/terminal/termite/default.nix +++ b/modules/home/terminal/termite/default.nix @@ -1,9 +1,16 @@ { config, lib, pkgs, ... }: let - cfg = config.my.home.terminal; + cfg = config.my.home.terminal.termite; + inherit (config.my.home.terminal) colors; in { - config = lib.mkIf (cfg.program == "termite") { + options.my.home.terminal.termite = with lib; { + enable = lib.mkEnableOption "termite" // { + default = config.my.home.terminal.default == "termite"; + }; + }; + + config = lib.mkIf cfg.enable { programs.termite = { enable = true; @@ -24,11 +31,11 @@ in # Colors - backgroundColor = cfg.colors.background; - cursorColor = cfg.colors.cursor; - foregroundColor = cfg.colors.foreground; - foregroundBoldColor = cfg.colors.foregroundBold; - colorsExtra = with cfg.colors; '' + backgroundColor = colors.background; + cursorColor = colors.cursor; + foregroundColor = colors.foreground; + foregroundBoldColor = colors.foregroundBold; + colorsExtra = with colors; '' # Normal colors color0 = ${black} color1 = ${red} diff --git a/modules/home/tmux/default.nix b/modules/home/tmux/default.nix index e3e3daf..6a4d371 100644 --- a/modules/home/tmux/default.nix +++ b/modules/home/tmux/default.nix @@ -6,13 +6,16 @@ let (config.my.home.wm.windowManager != null) ]; - mkTerminalFeature = opt: flag: + mkTerminalFlag = tmuxVar: opt: flag: let - mkFlag = term: ''set -as terminal-features ",${term}:${flag}"''; + mkFlag = term: ''set -as ${tmuxVar} ",${term}:${flag}"''; enabledTerminals = lib.filterAttrs (_: v: v.${opt}) cfg.terminalFeatures; terminals = lib.attrNames enabledTerminals; in lib.concatMapStringsSep "\n" mkFlag terminals; + + mkTerminalFeature = mkTerminalFlag "terminal-features"; + mkTerminalOverride = mkTerminalFlag "terminal-overrides"; in { options.my.home.tmux = with lib; { @@ -28,12 +31,14 @@ in hyperlinks = my.mkDisableOption "hyperlinks through OSC8"; trueColor = my.mkDisableOption "24-bit (RGB) color support"; + + underscoreStyle = my.mkDisableOption "underscore style/color support"; }; }); - default = { ${config.my.home.terminal.program} = { }; }; + default = { ${config.my.home.terminal.default} = { }; }; defaultText = literalExpression '' - { ''${config.my.home.terminal.program} = { }; }; + { ''${config.my.home.terminal.default} = { }; }; ''; example = { xterm-256color = { }; }; description = '' @@ -54,6 +59,20 @@ in terminal = "tmux-256color"; # I want accurate termcap info aggressiveResize = true; # Automatic resize when switching client size + # FIXME + # * Sixel support + # * OSC 133 prompt integration + # FIXME: when sensible-on-top is disabled: check if any of those are unset + # * tmux bind-key $prefix_without_ctrl last-window + # * + # * tmux bind-key C-b send-prefix: included + # * aggressive resize? done + # * tmux bind-key C-p previous-window: done + # * tmux bind-key C-n next-window: done + # * C-r to refresh my config: done + # * tmux set-option -g focus-events on: done + + # FIXME: make PRs for `bind-key` description plugins = with pkgs.tmuxPlugins; builtins.filter (attr: attr != { }) [ # Open high-lighted files in copy mode open @@ -126,6 +145,11 @@ in ${mkTerminalFeature "hyperlinks" "hyperlinks"} # Force 24-bit color for each relevant $TERM ${mkTerminalFeature "trueColor" "RGB"} + # Force underscore style/color for each relevant $TERM + ${mkTerminalFeature "underscoreStyle" "usstyle"} + # FIXME: see https://github.com/folke/tokyonight.nvim#fix-undercurls-in-tmux for additional overrides + # ${mkTerminalOverride "underscoreStyle" "Smulx=\\E[4::%p1%dm"} + # ${mkTerminalOverride "underscoreStyle" "Setulc=\\E[58::2::::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m"} ''; }; } diff --git a/modules/home/wm/i3/default.nix b/modules/home/wm/i3/default.nix index 5f22bbe..564aead 100644 --- a/modules/home/wm/i3/default.nix +++ b/modules/home/wm/i3/default.nix @@ -3,8 +3,8 @@ let isEnabled = config.my.home.wm.windowManager == "i3"; terminal = - if config.my.home.terminal.program != null - then config.my.home.terminal.program + if config.my.home.terminal.default != null + then config.my.home.terminal.default else "i3-sensible-terminal"; alt = "Mod1"; # `Alt` key diff --git a/modules/home/wm/rofi/default.nix b/modules/home/wm/rofi/default.nix index 9707ed7..d0e0215 100644 --- a/modules/home/wm/rofi/default.nix +++ b/modules/home/wm/rofi/default.nix @@ -7,7 +7,7 @@ in programs.rofi = { enable = true; - terminal = config.my.home.terminal.program; # null by default + terminal = config.my.home.terminal.default; # null by default package = pkgs.rofi.override { plugins = with pkgs; [