"$schema" = 'https://starship.rs/config-schema.json'

add_newline = true

command_timeout = 2000

format = """
$os\
$username\
$directory\
$git_branch\
$git_commit\
$git_status\
$git_metrics\
$git_state\
$c\
$rust\
$golang\
$nodejs\
$php\
$java\
$kotlin\
$haskell\
$python\
$package\
$docker_context\
$kubernetes\
$shell\
$container\
$jobs\
${custom.memory_usage}\
${custom.battery}\
${custom.keyboard_layout}\
$time\
$cmd_duration\
$status\
$line_break\
$character\
"""

palette = 'bearded-arc'

[palettes.bearded-arc]

color_ok = '#3CEC85'
color_danger = '#FF738A'
color_caution = '#EACD61'

color_os = '#FF738A'
color_username = '#FF738A'
color_directory = '#EACD61'
color_git = '#22ECDB'
color_git_added = '#3CEC85'
color_git_deleted = '#FF738A'
color_env = '#69C3FF'
color_kubernetes = '#bd93ff'
color_docker = '#69C3FF'
color_shell = '#ABB7C1'
color_container = '#FF955C'
color_other = '#ABB7C1'
color_time = '#c3cfd9'
color_duration = '#c3cfd9'

color_vimcmd_ok = '#9bdead'
color_vimcmd_replace = '#bd93ff'
color_vimcmd_visual = '#EACD61'

[os]
disabled = false
style = "fg:color_os"
format = '[$symbol]($style)'

[os.symbols]
Windows = "󰍲"
Ubuntu = "󰕈"
SUSE = ""
Raspbian = "󰐿"
Mint = "󰣭"
Macos = "󰀵"
Manjaro = ""
Linux = "󰌽"
Gentoo = "󰣨"
Fedora = "󰣛"
Alpine = ""
Amazon = ""
Android = ""
Arch = "󰣇"
Artix = "󰣇"
EndeavourOS = ""
CentOS = ""
Debian = "󰣚"
Redhat = "󱄛"
RedHatEnterprise = "󱄛"
Pop = ""

[username]
show_always = true
style_user = "fg:color_username"
style_root = "bold fg:color_danger"
format = '[ $user ]($style)'

[directory]
style = "fg:color_directory"
read_only_style = "fg:color_directory"
repo_root_style = "bold fg:color_directory"
format = "[ $path ]($style)"
read_only = " "
home_symbol = "~"
truncation_symbol = "…/"
truncation_length = 0
truncate_to_repo = true
fish_style_pwd_dir_length = 0
use_logical_path = true

[git_branch]
symbol = ""
style = "fg:color_git"
format = '( [$symbol $branch]($style) )'
only_attached = true
ignore_branches = []
truncation_length = 25
truncation_symbol = "..."
always_show_remote = false
disabled = false

[git_commit]
style = "fg:color_git"
format = "( [($tag)(@$hash)]($style) )"
commit_hash_length = 7
only_detached = true
tag_symbol = "󰓼 "
tag_disabled = false
disabled = false

[git_status]
style = "fg:color_git"
format = '([$ahead_behind]($style) )([$all_status]($style) )'
stashed = "*${count}"
ahead = "⇡${count}"
behind = "⇣${count}"
up_to_date = ""
diverged = "⇡${ahead_count}⇣${behind_count}"
conflicted = "=${count}"
deleted = "×${count}"
renamed = "»${count}"
modified = "!${count}"
staged = "+${count}"
untracked = "?${count}"
ignore_submodules = false
disabled = false

[git_metrics]
format = '([([+$added]($added_style))([-$deleted]($deleted_style))](fg:color_git) )'
added_style = "fg:color_git_added"
deleted_style = "fg:color_git_deleted"
only_nonzero_diffs = true
disabled = false

[git_state]
style = "fg:color_danger"
format = '([$state( $progress_current/$progress_total)]($style bold) )'
rebase = "REBASING"
merge = "MERGING"
revert = "REVERTING"
cherry_pick = "CHERRY-PICKING"
bisect = "BISECTING"
am = "AM"
am_or_rebase = "AM/REBASE"
disabled = false

[nodejs]
symbol = ""
style = "fg:color_env"
format = '( [$symbol( $version)]($style) )'

[c]
symbol = ""
style = "fg:color_env"
format = '( [$symbol( $version)]($style) )'

[rust]
symbol = "󱘗"
style = "fg:color_env"
format = '( [$symbol( $version)]($style) )'

[golang]
symbol = "󰟓"
style = "fg:color_env"
format = '( [$symbol( $version)]($style) )'

[php]
symbol = ""
style = "fg:color_env"
format = '( [$symbol( $version)]($style) )'

[java]
symbol = ""
style = "fg:color_env"
format = '( [$symbol( $version)]($style) )'

[kotlin]
symbol = ""
style = "fg:color_env"
format = '( [$symbol( $version)]($style) )'

[haskell]
symbol = ""
style = "fg:color_env"
format = '( [$symbol( $version)]($style) )'

[python]
symbol = ""
style = "fg:color_env"
format = '( [$symbol( $version)( $virtualenv)]($style) )'
version_format = '${raw}'

[package]
disabled = false
symbol = "󰏗"
style = "fg:color_env"
format = '( [$symbol( $version)]($style) )'

[docker_context]
symbol = ""
style = "fg:color_docker"
format = '( [$symbol( $context)]($style) )'

[kubernetes]
symbol = "󱃾"
style = "fg:color_kubernetes"
format = '( [($symbol( $cluster))]($style) )'
disabled = false

[shell]
disabled = true

[container]
style = "fg:color_container"
format = '( [$symbol $name]($style) )'

[jobs]
symbol = "󰒋"
style = "fg:color_other"
format = '( [$symbol( $number)]($style) )'
symbol_threshold = 1
number_threshold = 1

[custom.memory_usage]
command = "starship module memory_usage"
when = '[ "${STARSHIP_COCKPIT_MEMORY_USAGE_ENABLED:-false}" = "true" ]'
shell = "sh"
format = "( $output )"
disabled = false

[memory_usage]
threshold = 0
symbol = "󰓅"
style = "fg:color_other"
format = '( [$symbol( ${ram})]($style) )'
disabled = false

[custom.battery]
command = """
battery_info=$(starship module battery)
if [ -n "$battery_info" ]; then
    percent=$(echo "$battery_info" | grep -o '[0-9]*%' | sed 's/%//')
    if [ "$percent" -le "${STARSHIP_COCKPIT_BATTERY_THRESHOLD:-0}" ]; then
        echo "$battery_info" | sed 's/%%/%/'
    fi
fi
"""
when = '[ "${STARSHIP_COCKPIT_BATTERY_ENABLED:-false}" = "true" ]'
shell = "sh"
format = "( $output )"
disabled = false

[battery]
full_symbol = "󰁹"
charging_symbol = "󰂄"
discharging_symbol = "󰂃"
unknown_symbol = "󰂑"
empty_symbol = "󰂎"
format = '( [$symbol( $percentage)]($style) )'
disabled = false

[[battery.display]]
threshold = 10
style = "bold fg:color_danger"

[[battery.display]]
threshold = 20
style = "fg:color_caution"

[[battery.display]]
threshold = 100
style = "fg:color_other"

[time]
disabled = false
time_format = "%R"
style = "fg:color_time"
format = '( [󰔛 $time]($style) )'

[cmd_duration]
min_time = 2000
format = '( [󱫑 $duration]($style) )'
style = 'fg:color_duration'
show_milliseconds = false
disabled = false

[status]
disabled = false
format = '( [$symbol( $common_meaning)( $signal_name)]($style) )'
map_symbol = true
pipestatus = true
symbol = '󰅙'
success_symbol = ''
not_executable_symbol = '󰂭'
not_found_symbol = '󰍉'
sigint_symbol = '󰐊'
signal_symbol = '󱐋'
style = 'bold fg:color_danger'
recognize_signal_code = true

[line_break]
disabled = false

[character]
disabled = false
success_symbol = '[❯](bold fg:color_ok)'
error_symbol = '[❯](bold fg:color_danger)'
vimcmd_symbol = '[❮](bold fg:color_vimcmd_ok)'
vimcmd_replace_one_symbol = '[❮](bold fg:color_vimcmd_replace)'
vimcmd_replace_symbol = '[❮](bold fg:color_vimcmd_replace)'
vimcmd_visual_symbol = '[❮](bold fg:color_vimcmd_visual)'

[custom.keyboard_layout]
command = """

# Set env variables if you want to use layout aliases (in uppercase)
#     export STARSHIP_COCKPIT_KEYBOARD_LAYOUT_ABC=ENG
#     export STARSHIP_COCKPIT_KEYBOARD_LAYOUT_UKRAINIAN=UKR
# 
# Implementations:
#     macOS

if [ "$(uname -s)" = "Darwin" ]; then
        input_source=$(defaults read ~/Library/Preferences/com.apple.HIToolbox.plist AppleCurrentKeyboardLayoutInputSourceID)
        layout_id=$(echo "$input_source" | cut -d '.' -f4)
        layout=$(printenv "STARSHIP_COCKPIT_KEYBOARD_LAYOUT_$(echo "$layout_id" | tr '[:lower:]' '[:upper:]')")
        echo "$layout" || echo "$layout_id"
fi

"""
symbol = "󰌌"
style = "fg:color_other"
format = '( [$symbol $output]($style) )'
when = '[ "${STARSHIP_COCKPIT_KEYBOARD_LAYOUT_ENABLED:-false}" = "true" ]'
shell = "sh"
disabled = false
