Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [FEATURE REQUEST] Adding battery power to bigfade prompt
- X-seq: zsh-workers 40244
- From: Vincent Lefevre <vincent@xxxxxxxxxx>
- To: shirish शिरीष <shirishag75@xxxxxxxxx>
- Subject: Re: [FEATURE REQUEST] Adding battery power to bigfade prompt
- Date: Thu, 29 Dec 2016 11:19:48 +0100
- Cc: zsh-workers <zsh-workers@xxxxxxx>, Adam <adam@xxxxxxxxxx>
- In-reply-to: <CADdDZRnbeA_hGtXE5EVnvybwN842KO=YLaz76Up+CxC=C2rOWw@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mail-followup-to: shirish शिरीष <shirishag75@xxxxxxxxx>, zsh-workers <zsh-workers@xxxxxxx>, Adam <adam@xxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CADdDZRnbeA_hGtXE5EVnvybwN842KO=YLaz76Up+CxC=C2rOWw@mail.gmail.com>
On 2016-12-27 01:51:28 +0530, shirish शिरीष wrote:
> Please CC me if anybody answers to this mail as I'm not subscribed to
> the zsh-workers mailing list.
>
> Hi all,
> I have been playing around and recently came to know about zsh
> prompts. I tried a few and had issues with a prompt which I was able
> to solve -
>
> http://unix.stackexchange.com/questions/332732/removing-strange-characters-from-a-zsh-prompt
>
> Now, first of all i want to thank Adam who converted the theme to be
> used in zsh.
>
> Now while I was looking at that, I saw there was still something
> missing in the bigfade prompt and realized it was not having battery
> power on the right-hand side of the command prompt.
[...]
FYI, I use the following on my Linux laptops for my prompt config:
updprompt()
{
psvar[2]=""
local battery="$(acpi -b)"
[[ $battery == *Discharging* ]] &&
psvar[2]="[${${battery#*Discharging, }%\%,*}%]"
unset _trapchld_called
# ...
[[ -n $_trapchld_called ]] && updprompt
}
This function is called from precmd, but also from
TRAPCHLD()
{
if [[ -o interactive && -n $TTY ]] then
updprompt
typeset -g _trapchld_called=1
fi
}
--
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author