diff options
author | Roman Perepelitsa <roman.perepelitsa@gmail.com> | 2020-12-24 07:26:15 +0300 |
---|---|---|
committer | Roman Perepelitsa <roman.perepelitsa@gmail.com> | 2020-12-24 07:26:15 +0300 |
commit | dd62469cc7fb88d31cc85bf246b881ac1a760dc3 (patch) | |
tree | dc04acd0faea2170c3f9bc7972afcfc06b9b7f2a /internal | |
parent | 61c63eea6b8bc12c56dcb6cc40529cc5c643a94f (diff) |
fix ram segment on darwin-arm64 (#1181)
Darwin arm64 uses 16kB pages rather than 4kB.
Thanks, @johnalanwoods!
Diffstat (limited to 'internal')
-rw-r--r-- | internal/p10k.zsh | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 02524a2f..e2b450c6 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -2594,7 +2594,13 @@ _p9k_prompt_ram_async() { (( free_bytes += match[1] )) [[ $stat =~ 'Pages inactive:[[:space:]]+([0-9]+)' ]] || return (( free_bytes += match[1] )) - (( free_bytes *= 4096 )) + if (( ! $+_p9k__ram_pagesize )); then + local p + (( $+commands[pagesize] )) && p=$(pagesize 2>/dev/null) && [[ $p == <1-> ]] || p=4096 + typeset -gi _p9k__ram_pagesize=p + _p9k_print_params _p9k__ram_pagesize + fi + (( free_bytes *= _p9k__ram_pagesize )) ;; BSD) local stat && stat="$(grep -F 'avail memory' /var/run/dmesg.boot 2>/dev/null)" || return |