From 1236825f0813f3fcf3928caef130c959427cf2a3 Mon Sep 17 00:00:00 2001 From: Sean Buckley Date: Thu, 15 Jun 2023 10:28:41 -0400 Subject: [PATCH] switch to multi-line powerline --- modules/cli/powerline.nix | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/modules/cli/powerline.nix b/modules/cli/powerline.nix index 23159d1..3900142 100644 --- a/modules/cli/powerline.nix +++ b/modules/cli/powerline.nix @@ -1,5 +1,6 @@ { config, lib, pkgs, ... }: let + pl = lib.importJSON ./powerline-chars.json; theme = { BoldForeground = true; @@ -9,8 +10,19 @@ let SeparatorFg = 16; }; + customEnd = [{ + Content = "$"; + Foreground = 15; + Background = 245; + Separator = pl.left_hard_divider; + }]; + + plconfig = builtins.toFile "powerline-config.json" (builtins.toJSON { + modes.patched.Separator = pl.upper_left_triangle; + }); + args = [ - "-modules=\${remote:+'user,host,'}nix-shell,git,jobs,cwd" + "-modules=\${remote:+'user,host,'}nix-shell,git,jobs,cwd,newline,customend" "-git-assume-unchanged-size 0" "-theme /etc/powerline-theme.json" "-path-aliases '~/git=~/git'" @@ -19,11 +31,18 @@ let in { - environment.systemPackages = [ pkgs.powerline-go ]; + environment.systemPackages = [ + pkgs.powerline-go + + (pkgs.writeShellScriptBin + "powerline-go-customend" + "echo '${builtins.toJSON customEnd}'") + ]; environment.etc."powerline-theme.json".text = builtins.toJSON theme; programs.bash.interactiveShellInit = '' + install -D ${plconfig} ~/.config/powerline-go/config.json function _update_ps1() { local remote=y [ "$XDG_SESSION_TYPE" = "x11" ] && unset remote