Check for OS type in demula theme prompt string
parent
cced72742f
commit
f98a728866
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# pmset -g batt
|
|
||||||
battery_percentage(){
|
battery_percentage(){
|
||||||
if command_exists acpi;
|
if command_exists acpi;
|
||||||
then
|
then
|
||||||
|
|
@ -21,6 +21,11 @@ battery_percentage(){
|
||||||
echo '-1'
|
echo '-1'
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
elif command_exists ioreg;
|
||||||
|
then
|
||||||
|
# http://hints.macworld.com/article.php?story=20100130123935998
|
||||||
|
local IOREG_OUTPUT_10_6=$(ioreg -l | grep -i capacity | tr '\n' ' | ' | awk '{printf("%.2f%%", $10/$5 * 100)}')
|
||||||
|
local IOREG_OUTPUT_10_5=$(ioreg -l | grep -i capacity | grep -v Legacy| tr '\n' ' | ' | awk '{printf("%.2f%%", $14/$7 * 100)}')
|
||||||
else
|
else
|
||||||
echo "no"
|
echo "no"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,9 @@ prompt() {
|
||||||
local MOVE_CURSOR_RIGHTMOST='\[\033[500C\]'
|
local MOVE_CURSOR_RIGHTMOST='\[\033[500C\]'
|
||||||
local MOVE_CURSOR_5_LEFT='\[\033[5D\]'
|
local MOVE_CURSOR_5_LEFT='\[\033[5D\]'
|
||||||
|
|
||||||
PS1="${TITLEBAR}
|
if [ $(uname) = "Linux" ];
|
||||||
|
then
|
||||||
|
PS1="${TITLEBAR}
|
||||||
${SAVE_CURSOR}${MOVE_CURSOR_RIGHTMOST}${MOVE_CURSOR_5_LEFT}\
|
${SAVE_CURSOR}${MOVE_CURSOR_RIGHTMOST}${MOVE_CURSOR_5_LEFT}\
|
||||||
$(battery_charge)${RESTORE_CURSOR}\
|
$(battery_charge)${RESTORE_CURSOR}\
|
||||||
${D_USER_COLOR}\u ${D_INTERMEDIATE_COLOR}\
|
${D_USER_COLOR}\u ${D_INTERMEDIATE_COLOR}\
|
||||||
|
|
@ -99,7 +101,18 @@ $(mitsuhikos_lastcommandfailed)\
|
||||||
$(demula_vcprompt)\
|
$(demula_vcprompt)\
|
||||||
$(is_vim_shell)
|
$(is_vim_shell)
|
||||||
${D_INTERMEDIATE_COLOR}$ ${D_DEFAULT_COLOR}"
|
${D_INTERMEDIATE_COLOR}$ ${D_DEFAULT_COLOR}"
|
||||||
|
else
|
||||||
|
PS1="${TITLEBAR}
|
||||||
|
${D_USER_COLOR}\u ${D_INTERMEDIATE_COLOR}\
|
||||||
|
at ${D_MACHINE_COLOR}\h ${D_INTERMEDIATE_COLOR}\
|
||||||
|
in ${D_DIR_COLOR}\w ${D_INTERMEDIATE_COLOR}\
|
||||||
|
$(mitsuhikos_lastcommandfailed)\
|
||||||
|
$(demula_vcprompt)\
|
||||||
|
$(is_vim_shell)\
|
||||||
|
$(battery_charge)
|
||||||
|
${D_INTERMEDIATE_COLOR}$ ${D_DEFAULT_COLOR}"
|
||||||
|
fi
|
||||||
|
|
||||||
PS2="${D_INTERMEDIATE_COLOR}$ ${D_DEFAULT_COLOR}"
|
PS2="${D_INTERMEDIATE_COLOR}$ ${D_DEFAULT_COLOR}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue