liquidprompt / liquidprompt

A full-featured & carefully designed adaptive prompt for Bash & Zsh
https://liquidprompt.readthedocs.io/
GNU Affero General Public License v3.0
4.51k stars 425 forks source link

Default prompts for execution time and plugged in status not correct on macOS Sierra #481

Closed mraible closed 4 years ago

mraible commented 8 years ago

Shell: bash/zsh Operating system: macOS Sierra Liquid Prompt version (tag, commit): 9c1c8a378846c23e0a39be2aadd11531c2ecf196

I have two MacBook Pros, one with OS X El Capitan (version 10.11.6) and one with macOS Sierra (10.12.1).

I have the same Liquid Prompt version on both machines and both are configured the same in my ~/.bash_profile. I haven't changed anything in the liquidprompt source tree. Everything works great on El Capitan. However, on macOS Sierra, the prompts are wrong.

macOS Sierra seems to add the time between commands rather than just showing how long it took to execute the last one. Also, it doesn't show that I'm plugged in. For example:

⌂69% [mraible:~/dev/liquidprompt] master 16s ± cd ~/dev/stormpath-sdk-java/
⌂66% [mraible:~/dev/stormpath-sdk-java] master 1m25s ± cd api/
⌂63% [mraible:~/dev/stormpath-sdk-java/api] master 1m27s ± mvn test
dolmen commented 8 years ago

Could you tell me the bash versions on each machines?

asnr commented 7 years ago

I'm having a similar problem with liquidprompt showing the time since the shell started rather than the time spent executing the last command, but I'm running El Capitan. I installed liquidprompt with homebrew:

$ brew info liquidprompt
liquidprompt: stable 1.11, HEAD
Adaptive prompt for bash and zsh shells
https://github.com/nojhan/liquidprompt
/usr/local/Cellar/liquidprompt/1.11 (6 files, 124.3K) *
  Built from source on 2016-08-08 at 20:05:37
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/liquidprompt.rb

I'm running bash version

$ echo $BASH_VERSION
3.2.57(1)-release

on iTerm2 build 3.0.12 on El Capitan version 10.11.6 (15G1108).

jasmas commented 7 years ago

This is also not working for me on Sierra 10.12.5 (16F73) using either the built-in 3.2.57(1)-release version of bash or 4.4.12(1)-release version installed through homebrew.

jasmas commented 7 years ago

I just tested #476 and it appears to fix the plugged-in status for me.

augmentedfourth commented 6 years ago

@asnr Try brew install --HEAD liquidprompt. You'll get the more recent version of liquidprompt direct from the github repository, and not the latest (and far out of date) "release package."

asnr commented 6 years ago

Thanks for the tip @augmentedfourth. I've done what you said:

$ ls -l /usr/local/share/liquidprompt
lrwxr-xr-x  1 someonemac  admin  54  9 Jan 08:01 /usr/local/share/liquidprompt -> ../Cellar/liquidprompt/HEAD-9c80396/share/liquidprompt

I'm still not getting any battery status, and the problem with the time between commands persists. These are some of my current environment:

$ echo $BASH_VERSION
3.2.57(1)-release
$ echo $LP_ENABLE_BATT
1
$ echo $LP_BATTERY_THRESHOLD
75

I'm running this on iTerm2 build 3.1.5 on macOS Sierra 10.12.6 (16G1036).

At 49% charge running off battery, this is what my prompt looks like:

[asnr:~] 13m57s $
[asnr:~] 13m58s $
[asnr:~] 13m58s $
[asnr:~] 13m59s $
[asnr:~] 13m59s $

(Note I pressed enter several times in quick succession but the timer keeps incrementing rather than resetting.)

augmentedfourth commented 6 years ago

@asnr The battery issue is well-known. There is an issue (#489) and two un-merged pull requests (#476, #536) attempting to fix it. I have no idea why neither of them are merged.

I've never experienced that timing issue, unfortunately, so I don't know what to say about that.

Rycieos commented 6 years ago

Timing issues with the same symptoms described here are a common issue. Make sure you follow this comment if you are setting $PROMPT_COMMAND anywhere.

If this turns out to be the cause, that's at least four tickets with the same user error. Maybe we should add it as an FAQ.

asnr commented 6 years ago

Thank you @Rycieos, that was it! It took a little while to figure out, because $PROMPT_COMMAND was being manipulated inside another utility (autojump, in my case).

Adding it to the FAQ isn't a bad idea. It might be worth mentioning explicitly in the README, under the heading 'Test drive and installation', say in the paragraph starting with 'To use it every time you start a shell, add the following lines to your .bashrc'.