aboutsummaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorDominik Ritter <dritter03@googlemail.com>2018-07-18 23:26:08 +0300
committerDominik Ritter <dritter03@googlemail.com>2018-07-18 23:26:08 +0300
commit7a3aa9d3d1955f6a884705a690647cc8aaf96255 (patch)
tree6c9f2be42ff5e53ea9452ef31f8c5f54366a9dc0 /powerlevel9k.zsh-theme
parente51faa0af176638fce3da3bf03f4127d4f190438 (diff)
Change swap segment to take an optional root prefix for testability
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-xpowerlevel9k.zsh-theme5
1 files changed, 3 insertions, 2 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index 2b68b6a4..16051839 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -1422,6 +1422,7 @@ prompt_status() {
################################################################
# Segment to display Swap information
prompt_swap() {
+ local ROOT_PREFIX="${4}"
local swap_used=0
local base=''
@@ -1436,8 +1437,8 @@ prompt_swap() {
base=$(echo "$raw_swap_used" | grep -o "[A-Z]*$")
else
- swap_total=$(grep -o -E "SwapTotal:\s+[0-9]+" /proc/meminfo | grep -o "[0-9]*")
- swap_free=$(grep -o -E "SwapFree:\s+[0-9]+" /proc/meminfo | grep -o "[0-9]*")
+ swap_total=$(grep -o -E "SwapTotal:\s+[0-9]+" ${ROOT_PREFIX}/proc/meminfo | grep -o -E "[0-9]+")
+ swap_free=$(grep -o -E "SwapFree:\s+[0-9]+" ${ROOT_PREFIX}/proc/meminfo | grep -o -E "[0-9]+")
swap_used=$(( swap_total - swap_free ))
base='K'
fi