From: Vincent Lefevre <vincent@vinc17.net>
To: "shirish शिरीष" <shirishag75@gmail.com>
Cc: zsh-workers <zsh-workers@zsh.org>, Adam <adam@spiers.net>
Subject: Re: [FEATURE REQUEST] Adding battery power to bigfade prompt
Date: Thu, 29 Dec 2016 11:19:48 +0100 [thread overview]
Message-ID: <20161229101948.GB13526@zira.vinc17.org> (raw)
In-Reply-To: <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@vinc17.net> - 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)
prev parent reply other threads:[~2016-12-29 10:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-26 20:21 shirish शिरीष
2016-12-27 13:09 ` Daniel Shahaf
2016-12-27 20:47 ` shirish शिरीष
2016-12-29 10:19 ` Vincent Lefevre [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161229101948.GB13526@zira.vinc17.org \
--to=vincent@vinc17.net \
--cc=adam@spiers.net \
--cc=shirishag75@gmail.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).