spruce up powerline formatting and theme

This commit is contained in:
Sean Buckley 2021-10-12 13:07:33 -04:00
parent b48e827673
commit fa5fd32125
2 changed files with 33 additions and 5 deletions

13
modules/cli/bold.patch Normal file
View file

@ -0,0 +1,13 @@
diff --git a/powerline.go b/powerline.go
index 0b640ac..7778ebf 100644
--- a/powerline.go
+++ b/powerline.go
@@ -177,7 +177,7 @@ func (p *powerline) color(prefix string, code uint8) string {
}
func (p *powerline) fgColor(code uint8) string {
- return p.color("38", code)
+ return p.color("1;38", code)
}
func (p *powerline) bgColor(code uint8) string {

View file

@ -1,6 +1,16 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let let
cfg = config.sconfig.powerline; cfg = config.sconfig.powerline;
theme = pkgs.writeText "powerline.json" (builtins.toJSON
{
CwdFg = 15;
PathFg = 15;
PathBg = 24;
SeparatorFg = 16;
});
in in
{ {
options.sconfig.powerline = options.sconfig.powerline =
@ -12,10 +22,10 @@ in
args = lib.mkOption { args = lib.mkOption {
type = lib.types.listOf lib.types.str; type = lib.types.listOf lib.types.str;
default = [ default = [
"-colorize-hostname" "-modules=\${remote:+'user,host,'}nix-shell,git,jobs,cwd"
"-cwd-mode=plain"
"-modules=user,host,cwd,nix-shell,git,jobs"
"-git-assume-unchanged-size 0" "-git-assume-unchanged-size 0"
"-theme ${theme}"
"-path-aliases '~/git=~/git'"
"-jobs $(jobs -p | wc -l)" "-jobs $(jobs -p | wc -l)"
]; ];
}; };
@ -23,11 +33,16 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
environment.systemPackages = [ pkgs.powerline-go ]; environment.systemPackages = [
(pkgs.powerline-go.overrideAttrs (old: { patches = [ ./bold.patch ]; }))
];
programs.bash.interactiveShellInit = '' programs.bash.interactiveShellInit = ''
function _update_ps1() { function _update_ps1() {
PS1="\n$(powerline-go ${lib.concatStringsSep " " cfg.args})$ " local remote=y
[ "$XDG_SESSION_TYPE" = "x11" ] && unset remote
[ "$XDG_SESSION_TYPE" = "wayland" ] && unset remote
PS1="\n$(powerline-go ${lib.concatStringsSep " " cfg.args})"
} }
[ "$TERM" = "linux" ] || PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND" [ "$TERM" = "linux" ] || PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
''; '';