home: tmux: add 'trueColorTerminals'

This uses the recommended way of enabling true-color [1].

[1]: https://github.com/tmux/tmux/wiki/FAQ#how-do-i-use-rgb-colour
This commit is contained in:
Bruno BELANYI 2023-10-26 19:37:04 +01:00
parent c01f657e8d
commit 3a1ccea142

View file

@ -11,6 +11,19 @@ in
enable = my.mkDisableOption "tmux terminal multiplexer";
enablePassthrough = mkEnableOption "tmux DCS passthrough sequence";
trueColorTerminals = mkOption {
type = with types; listOf str;
default = lib.my.nullableToList config.my.home.terminal.program;
defaultText = ''
`[ config.my.home.terminal.program ]` if it is non-null, otherwise an
empty list.
'';
example = [ "xterm-256color" ];
description = ''
$TERM values which should be considered to always support 24-bit color.
'';
};
};
config.programs.tmux = lib.mkIf cfg.enable {
@ -75,6 +88,14 @@ in
set -g allow-passthrough on
''
}
# Force 24-bit color for each relevant $TERM
${
let
mkTcFlag = term: ''set -as terminal-features ",${term}:RGB"'';
in
lib.concatMapStringsSep "\n" mkTcFlag cfg.trueColorTerminals
}
'';
};
}