From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21773 invoked by alias); 29 Dec 2016 10:19:55 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 40244 Received: (qmail 17306 invoked from network); 29 Dec 2016 10:19:55 -0000 X-Qmail-Scanner-Diagnostics: from ioooi.vinc17.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(92.243.22.117):SA:0(-3.1/5.0):. Processed in 3.256997 secs); 29 Dec 2016 10:19:55 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=RP_MATCHES_RCVD autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: vincent@vinc17.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at vinc17.net does not designate permitted sender hosts) Date: Thu, 29 Dec 2016 11:19:48 +0100 From: Vincent Lefevre To: shirish =?utf-8?B?4KS24KS/4KSw4KWA4KS3?= Cc: zsh-workers , Adam Subject: Re: [FEATURE REQUEST] Adding battery power to bigfade prompt Message-ID: <20161229101948.GB13526@zira.vinc17.org> Mail-Followup-To: shirish =?utf-8?B?4KS24KS/4KSw4KWA4KS3?= , zsh-workers , Adam References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Mailer-Info: https://www.vinc17.net/mutt/ User-Agent: Mutt/1.7.2-6895-vl-r94147 (2016-12-27) 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 - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)