diff --git a/playbooks/roles/shell/tasks/zsh.yml b/playbooks/roles/shell/tasks/zsh.yml index 75974cb..a11c6b9 100644 --- a/playbooks/roles/shell/tasks/zsh.yml +++ b/playbooks/roles/shell/tasks/zsh.yml @@ -30,3 +30,16 @@ template: src: templates/starship.toml.j2 dest: ~/.config/starship.toml + +- name: Create directories in `~/.local` + file: + path: "{{ item }}" + state: directory + loop: + - ~/.local/bin + - ~/.local/share + +- name: Install script for toolbox name retrieval + template: + src: templates/scripts/toolbox_name.sh + dest: ~/.local/bin/toolbox_name.sh diff --git a/playbooks/roles/shell/templates/scripts/toolbox_name.sh b/playbooks/roles/shell/templates/scripts/toolbox_name.sh new file mode 100644 index 0000000..67607bc --- /dev/null +++ b/playbooks/roles/shell/templates/scripts/toolbox_name.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +cat /run/.containerenv | grep -E '^name=' | sed -e 's/name=\"\(.*\)\"/\1/' diff --git a/playbooks/roles/shell/templates/starship.toml.j2 b/playbooks/roles/shell/templates/starship.toml.j2 index 14b3bae..78bd759 100644 --- a/playbooks/roles/shell/templates/starship.toml.j2 +++ b/playbooks/roles/shell/templates/starship.toml.j2 @@ -35,6 +35,8 @@ format = "[$path]($style)[$read_only]($read_only_style) " [custom.toolbox] when = "ls /run/.containerenv" symbol = " " +command = "~/.local/bin/toolbox_name.sh" +format = "[$symbol($output )]($style)" style = "bold purple" [character]