From 42a83bea7fbaae212d8d18e677df3d4bf71d4ecf Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Sun, 25 Jul 2021 13:44:50 +0200 Subject: [PATCH] mpd/ncmpcpp: Add dynamic color palette support --- users/simon/modules/mpd.nix | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/users/simon/modules/mpd.nix b/users/simon/modules/mpd.nix index 1bbb819..ddc1a1e 100644 --- a/users/simon/modules/mpd.nix +++ b/users/simon/modules/mpd.nix @@ -29,7 +29,25 @@ lib.mkIf nixosConfig.sbruder.gui.enable { programs.ncmpcpp = { enable = true; - package = pkgs.ncmpcpp.override { visualizerSupport = true; taglibSupport = false; }; + package = (pkgs.ncmpcpp.override { + visualizerSupport = true; + taglibSupport = false; + }).overrideAttrs (o: o // { + nativeBuildInputs = o.nativeBuildInputs ++ (with pkgs; [ makeWrapper ]); + + # !!! HACK: ncurses uses terminfo’s rs1 for alacritty (\033c\033]104\007) + # to reset the terminal when the window is resized. For achieving the + # required effect (clearing the terminal), \033c would be enough. + # \033]104\007 additionally resets colours set by dynamic-colors. This + # makes text written in those colours almost unreadable. Since xterm only + # uses \033c to reset the terminal and does not make ncmpcpp misbehave in + # alacritty, this wrapper tricks ncurses into thinking it is running in + # xterm. + postInstall = '' + wrapProgram $out/bin/ncmpcpp \ + --run '[ "$TERM" = "alacritty" ] && export TERM="xterm"' + ''; + }); mpdMusicDir = null; # does not work (not of type `null or path') settings = { # Connection