From 3a1ccea1425fdfe60584b6729014d3f12799c87d Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 26 Oct 2023 19:37:04 +0100 Subject: [PATCH] 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 --- home/tmux/default.nix | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/home/tmux/default.nix b/home/tmux/default.nix index e554fd0..08aeb55 100644 --- a/home/tmux/default.nix +++ b/home/tmux/default.nix @@ -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 + } ''; }; }