separate ohmyposh from zsh
This commit is contained in:
@@ -10,5 +10,6 @@
|
|||||||
./zoxide
|
./zoxide
|
||||||
./zsh
|
./zsh
|
||||||
./ssh
|
./ssh
|
||||||
|
./ohmyposh
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
132
home-manager/programs/terminal/ohmyposh/default.nix
Normal file
132
home-manager/programs/terminal/ohmyposh/default.nix
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
{ config, lib, pkgs, ... }: {
|
||||||
|
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
oh-my-posh
|
||||||
|
];
|
||||||
|
|
||||||
|
programs.zsh = {
|
||||||
|
|
||||||
|
initContent = if config.homeconfig.wal.enable then (lib.mkBefore ''
|
||||||
|
cat ${config.home.homeDirectory}/.cache/wal/sequences
|
||||||
|
eval "$(oh-my-posh init zsh --config ${config.home.homeDirectory}/.cache/wal/ohmyposh.toml)"
|
||||||
|
'') else (lib.mkBefore ''
|
||||||
|
eval "$(oh-my-posh init zsh --config ${config.home.homeDirectory}/.config/ohmyposh/ohmyposh.toml)"
|
||||||
|
'');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
home.file.".config/wal/templates/ohmyposh.toml".text = ''
|
||||||
|
#:schema https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json
|
||||||
|
|
||||||
|
version = 2
|
||||||
|
final_space = true
|
||||||
|
console_title_template = '{{{{ .Shell }}}} in {{{{ .Folder }}}}'
|
||||||
|
|
||||||
|
[[blocks]]
|
||||||
|
type = 'prompt'
|
||||||
|
alignment = 'left'
|
||||||
|
newline = true
|
||||||
|
|
||||||
|
[[blocks.segments]]
|
||||||
|
type = 'os'
|
||||||
|
style = 'diamond'
|
||||||
|
trailing_diamond = ''
|
||||||
|
background = 'p:c1'
|
||||||
|
foreground = 'p:c12'
|
||||||
|
template = ' {{{{ .Icon }}}} '
|
||||||
|
|
||||||
|
[[blocks.segments]]
|
||||||
|
type = 'session'
|
||||||
|
style = 'diamond'
|
||||||
|
trailing_diamond = ''
|
||||||
|
background = 'p:c2'
|
||||||
|
foreground = 'p:c14'
|
||||||
|
template = '{{{{ .UserName }}}}@{{{{ .HostName }}}}'
|
||||||
|
|
||||||
|
[[blocks.segments]]
|
||||||
|
type = 'path'
|
||||||
|
style = 'diamond'
|
||||||
|
trailing_diamond = ''
|
||||||
|
background = 'p:c4'
|
||||||
|
foreground = 'p:c13'
|
||||||
|
template = '{{{{ .Path }}}}'
|
||||||
|
|
||||||
|
[blocks.segments.properties]
|
||||||
|
style = 'full'
|
||||||
|
|
||||||
|
[[blocks]]
|
||||||
|
type = 'prompt'
|
||||||
|
overflow = 'hidden'
|
||||||
|
alignment = 'right'
|
||||||
|
|
||||||
|
[[blocks.segments]]
|
||||||
|
type = 'executiontime'
|
||||||
|
style = 'diamond'
|
||||||
|
leading_diamond = ''
|
||||||
|
background = 'p:c4'
|
||||||
|
foreground = 'p:c13'
|
||||||
|
template = '{{{{ .FormattedMs }}}}'
|
||||||
|
|
||||||
|
[[blocks.segments]]
|
||||||
|
type = 'time'
|
||||||
|
style = 'diamond'
|
||||||
|
leading_diamond = ''
|
||||||
|
background = 'p:c2'
|
||||||
|
foreground = 'p:c14'
|
||||||
|
|
||||||
|
[[blocks.segments]]
|
||||||
|
type = 'shell'
|
||||||
|
style = 'diamond'
|
||||||
|
leading_diamond = ''
|
||||||
|
background = 'p:c1'
|
||||||
|
foreground = 'p:c12'
|
||||||
|
|
||||||
|
[[blocks]]
|
||||||
|
type = 'prompt'
|
||||||
|
alignment = 'left'
|
||||||
|
newline = true
|
||||||
|
|
||||||
|
[[blocks.segments]]
|
||||||
|
type = 'text'
|
||||||
|
style = 'plain'
|
||||||
|
background = 'transparent'
|
||||||
|
foreground_templates = [
|
||||||
|
"{{{{ if gt .Code 0 }}}}p:c13{{{{end}}}}",
|
||||||
|
"{{{{ if eq .Code 0 }}}}p:c14{{{{end}}}}",
|
||||||
|
]
|
||||||
|
template = "{{{{ if gt .Code 0 }}}}!❭ {{{{else}}}}❭ {{{{end}}}}"
|
||||||
|
|
||||||
|
[transient_prompt]
|
||||||
|
foreground_templates = [
|
||||||
|
"{{{{ if gt .Code 0 }}}}p:c13{{{{end}}}}",
|
||||||
|
"{{{{ if eq .Code 0 }}}}p:c14{{{{end}}}}",
|
||||||
|
]
|
||||||
|
background = 'transparent'
|
||||||
|
template = "{{{{ if gt .Code 0 }}}}!❭ {{{{else}}}}❭ {{{{end}}}}"
|
||||||
|
|
||||||
|
[secondary_prompt]
|
||||||
|
background = 'transparent'
|
||||||
|
forground = 'p:c14'
|
||||||
|
template = "❭❭ "
|
||||||
|
|
||||||
|
|
||||||
|
[palette]
|
||||||
|
|
||||||
|
c0 = "{color0}"
|
||||||
|
c1 = "{color1}"
|
||||||
|
c2 = "{color2}"
|
||||||
|
c3 = "{color3}"
|
||||||
|
c4 = "{color4}"
|
||||||
|
c5 = "{color5}"
|
||||||
|
c6 = "{color6}"
|
||||||
|
c7 = "{color7}"
|
||||||
|
c8 = "{color8}"
|
||||||
|
c9 = "{color9}"
|
||||||
|
c10 = "{color10}"
|
||||||
|
c11 = "{color11}"
|
||||||
|
c12 = "{color12}"
|
||||||
|
c13 = "{color13}"
|
||||||
|
c14 = "{color14}"
|
||||||
|
c15 = "{color15}"
|
||||||
|
'';
|
||||||
|
}
|
||||||
@@ -1,9 +1,5 @@
|
|||||||
{ config, lib, pkgs, ... }: {
|
{ config, lib, pkgs, ... }: {
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
|
||||||
oh-my-posh
|
|
||||||
];
|
|
||||||
|
|
||||||
programs.zsh = {
|
programs.zsh = {
|
||||||
|
|
||||||
enable = true;
|
enable = true;
|
||||||
@@ -33,128 +29,5 @@
|
|||||||
ignoreSpace = true;
|
ignoreSpace = true;
|
||||||
share = true;
|
share = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
initContent = if config.homeconfig.wal.enable then (lib.mkBefore ''
|
|
||||||
cat ${config.home.homeDirectory}/.cache/wal/sequences
|
|
||||||
eval "$(oh-my-posh init zsh --config ${config.home.homeDirectory}/.cache/wal/ohmyposh.toml)"
|
|
||||||
'') else (lib.mkBefore ''
|
|
||||||
eval "$(oh-my-posh init zsh --config ${config.home.homeDirectory}/.config/ohmyposh/ohmyposh.toml)"
|
|
||||||
'');
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
home.file.".config/wal/templates/ohmyposh.toml".text = ''
|
|
||||||
#:schema https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json
|
|
||||||
|
|
||||||
version = 2
|
|
||||||
final_space = true
|
|
||||||
console_title_template = '{{{{ .Shell }}}} in {{{{ .Folder }}}}'
|
|
||||||
|
|
||||||
[[blocks]]
|
|
||||||
type = 'prompt'
|
|
||||||
alignment = 'left'
|
|
||||||
newline = true
|
|
||||||
|
|
||||||
[[blocks.segments]]
|
|
||||||
type = 'os'
|
|
||||||
style = 'diamond'
|
|
||||||
trailing_diamond = ''
|
|
||||||
background = 'p:c1'
|
|
||||||
foreground = 'p:c12'
|
|
||||||
template = ' {{{{ .Icon }}}} '
|
|
||||||
|
|
||||||
[[blocks.segments]]
|
|
||||||
type = 'session'
|
|
||||||
style = 'diamond'
|
|
||||||
trailing_diamond = ''
|
|
||||||
background = 'p:c2'
|
|
||||||
foreground = 'p:c14'
|
|
||||||
template = '{{{{ .UserName }}}}@{{{{ .HostName }}}}'
|
|
||||||
|
|
||||||
[[blocks.segments]]
|
|
||||||
type = 'path'
|
|
||||||
style = 'diamond'
|
|
||||||
trailing_diamond = ''
|
|
||||||
background = 'p:c4'
|
|
||||||
foreground = 'p:c13'
|
|
||||||
template = '{{{{ .Path }}}}'
|
|
||||||
|
|
||||||
[blocks.segments.properties]
|
|
||||||
style = 'full'
|
|
||||||
|
|
||||||
[[blocks]]
|
|
||||||
type = 'prompt'
|
|
||||||
overflow = 'hidden'
|
|
||||||
alignment = 'right'
|
|
||||||
|
|
||||||
[[blocks.segments]]
|
|
||||||
type = 'executiontime'
|
|
||||||
style = 'diamond'
|
|
||||||
leading_diamond = ''
|
|
||||||
background = 'p:c4'
|
|
||||||
foreground = 'p:c13'
|
|
||||||
template = '{{{{ .FormattedMs }}}}'
|
|
||||||
|
|
||||||
[[blocks.segments]]
|
|
||||||
type = 'time'
|
|
||||||
style = 'diamond'
|
|
||||||
leading_diamond = ''
|
|
||||||
background = 'p:c2'
|
|
||||||
foreground = 'p:c14'
|
|
||||||
|
|
||||||
[[blocks.segments]]
|
|
||||||
type = 'shell'
|
|
||||||
style = 'diamond'
|
|
||||||
leading_diamond = ''
|
|
||||||
background = 'p:c1'
|
|
||||||
foreground = 'p:c12'
|
|
||||||
|
|
||||||
[[blocks]]
|
|
||||||
type = 'prompt'
|
|
||||||
alignment = 'left'
|
|
||||||
newline = true
|
|
||||||
|
|
||||||
[[blocks.segments]]
|
|
||||||
type = 'text'
|
|
||||||
style = 'plain'
|
|
||||||
background = 'transparent'
|
|
||||||
foreground_templates = [
|
|
||||||
"{{{{ if gt .Code 0 }}}}p:c13{{{{end}}}}",
|
|
||||||
"{{{{ if eq .Code 0 }}}}p:c14{{{{end}}}}",
|
|
||||||
]
|
|
||||||
template = "{{{{ if gt .Code 0 }}}}!❭ {{{{else}}}}❭ {{{{end}}}}"
|
|
||||||
|
|
||||||
[transient_prompt]
|
|
||||||
foreground_templates = [
|
|
||||||
"{{{{ if gt .Code 0 }}}}p:c13{{{{end}}}}",
|
|
||||||
"{{{{ if eq .Code 0 }}}}p:c14{{{{end}}}}",
|
|
||||||
]
|
|
||||||
background = 'transparent'
|
|
||||||
template = "{{{{ if gt .Code 0 }}}}!❭ {{{{else}}}}❭ {{{{end}}}}"
|
|
||||||
|
|
||||||
[secondary_prompt]
|
|
||||||
background = 'transparent'
|
|
||||||
forground = 'p:c14'
|
|
||||||
template = "❭❭ "
|
|
||||||
|
|
||||||
|
|
||||||
[palette]
|
|
||||||
|
|
||||||
c0 = "{color0}"
|
|
||||||
c1 = "{color1}"
|
|
||||||
c2 = "{color2}"
|
|
||||||
c3 = "{color3}"
|
|
||||||
c4 = "{color4}"
|
|
||||||
c5 = "{color5}"
|
|
||||||
c6 = "{color6}"
|
|
||||||
c7 = "{color7}"
|
|
||||||
c8 = "{color8}"
|
|
||||||
c9 = "{color9}"
|
|
||||||
c10 = "{color10}"
|
|
||||||
c11 = "{color11}"
|
|
||||||
c12 = "{color12}"
|
|
||||||
c13 = "{color13}"
|
|
||||||
c14 = "{color14}"
|
|
||||||
c15 = "{color15}"
|
|
||||||
'';
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
{ config, lib, ... }: {
|
{ config, lib, ... }: {
|
||||||
|
|
||||||
home.file = {
|
home.file = {
|
||||||
".config/hypr" = { source = ./hypr; recursive = true; };
|
".config/hypr" = lib.mkIf config.homeconfig.hyprland.enable { source = ./hypr; recursive = true; };
|
||||||
".config/hyprpanel" = { source = ./hyprpanel; recursive = true; };
|
".config/hyprpanel" = lib.mkIf config.homeconfig.hyprpanel.enable { source = ./hyprpanel; recursive = true; };
|
||||||
".config/swaylock" = { source = ./swaylock; recursive = true; };
|
".config/wal/templates" = lib.mkIf config.homeconfig.wal.enable { source = ./wal/templates; recursive = true; };
|
||||||
".config/wal/templates" = { source = ./wal/templates; recursive = true; };
|
|
||||||
".config/ohmyposh" = { source = ./ohmyposh; recursive = true; };
|
".config/ohmyposh" = { source = ./ohmyposh; recursive = true; };
|
||||||
"Pictures/Wallpaper" = { source = ./Wallpaper; recursive = true; };
|
"Pictures/Wallpaper" = lib.mkIf config.homeconfig.graphical { source = ./Wallpaper; recursive = true; };
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user