zsh-workers
 help / color / mirror / code / Atom feed
* [FEATURE REQUEST] Adding battery power to bigfade prompt
@ 2016-12-26 20:21 shirish शिरीष
  2016-12-27 13:09 ` Daniel Shahaf
  2016-12-29 10:19 ` Vincent Lefevre
  0 siblings, 2 replies; 4+ messages in thread
From: shirish शिरीष @ 2016-12-26 20:21 UTC (permalink / raw)
  To: zsh-workers; +Cc: Adam

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.

I looked at both zsh-users, zsh-workers and debian-bugs to see if
somebody has talked about it but found nobody.

http://www.zsh.org/mla/users//2016/author.html - In fact found it
strange that zsh didn't dice the user's mailing for the year in other
ways such as date (which is important as well)

http://www.zsh.org/mla/workers/2016/index.html - all the patches come here.

https://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg=zsh#_1_6_5 - The
debian wishlist bug list.

While I did see a few interesting bugs about prompts in the Debian
Bts, none of them shared  the feature request I have.

It would be nice if either bigfade or some other prompt adds battery
power to its prompt, please. Although it would be nice if bigfade has
it, even if some other prompt within the
/usr/share/zsh/functions/Prompts/ has it, would be nice.

This has already been done with
http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/#this-entry-is-about-zsh-prompts
and some other prompts I saw.

Could battery power be an optional feature which could be had on any
zsh prompt as a generic thing, maybe have it as a function and just
need to init it in .zsh/ where just like colors and prompts need to
initialize it and it would work.

Look forward to know more.

-- 
          Regards,
          Shirish Agarwal  शिरीष अग्रवाल
  My quotes in this email licensed under CC 3.0
http://creativecommons.org/licenses/by-nc/3.0/
http://flossexperiences.wordpress.com
EB80 462B 08E1 A0DE A73A  2C2F 9F3D C7A4 E1C4 D2D8


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FEATURE REQUEST] Adding battery power to bigfade prompt
  2016-12-26 20:21 [FEATURE REQUEST] Adding battery power to bigfade prompt shirish शिरीष
@ 2016-12-27 13:09 ` Daniel Shahaf
  2016-12-27 20:47   ` shirish शिरीष
  2016-12-29 10:19 ` Vincent Lefevre
  1 sibling, 1 reply; 4+ messages in thread
From: Daniel Shahaf @ 2016-12-27 13:09 UTC (permalink / raw)
  To: shirish शिरीष; +Cc: zsh-workers, Adam

shirish शिरीष wrote on Tue, Dec 27, 2016 at 01:51:28 +0530:
> It would be nice if either bigfade or some other prompt adds battery
> power to its prompt, please.

How would that be done portably?  The tool to use is ioreg(8) on OS X,
apm(8) on FreeBSD, and acpi(8) on Linux; and I'm not sure whether
acpi(8) exists in all Linuxes.

Cheers,

Daniel
(I have battery info in my tmux status line)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FEATURE REQUEST] Adding battery power to bigfade prompt
  2016-12-27 13:09 ` Daniel Shahaf
@ 2016-12-27 20:47   ` shirish शिरीष
  0 siblings, 0 replies; 4+ messages in thread
From: shirish शिरीष @ 2016-12-27 20:47 UTC (permalink / raw)
  To: Daniel Shahaf; +Cc: zsh-workers, Adam

at bottom :-

On 27/12/2016, Daniel Shahaf <danielsh@apache.org> wrote:
> shirish शिरीष wrote on Tue, Dec 27, 2016 at 01:51:28 +0530:
>> It would be nice if either bigfade or some other prompt adds battery
>> power to its prompt, please.
>
> How would that be done portably?  The tool to use is ioreg(8) on OS X,
> apm(8) on FreeBSD, and acpi(8) on Linux; and I'm not sure whether
> acpi(8) exists in all Linuxes.
>
> Cheers,
>
> Daniel
> (I have battery info in my tmux status line)
>

Agreed. In that case could we have some sort of generic battery
modules that we could enable on our platform.

What could be done is have four optional scripts added to zsh
documenting which script works with which platform/technology etc. and
then the user would just enable it . The only thing that the user
would have to then think on how to have it on the extreme right or
left (hinking about users who write from right to left rather than the
conventional left to right.)

@ Daniel - if there is a specific module/script which could be used to
easily do this, please share it either on-list or off-list OR if you
want, can also re-ask the same thing in zsh-users@zsh.org if you think
it's a better domain for this type of thing.

Look forward to hearing from  you.

-- 
          Regards,
          Shirish Agarwal  शिरीष अग्रवाल
  My quotes in this email licensed under CC 3.0
http://creativecommons.org/licenses/by-nc/3.0/
http://flossexperiences.wordpress.com
EB80 462B 08E1 A0DE A73A  2C2F 9F3D C7A4 E1C4 D2D8


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FEATURE REQUEST] Adding battery power to bigfade prompt
  2016-12-26 20:21 [FEATURE REQUEST] Adding battery power to bigfade prompt shirish शिरीष
  2016-12-27 13:09 ` Daniel Shahaf
@ 2016-12-29 10:19 ` Vincent Lefevre
  1 sibling, 0 replies; 4+ messages in thread
From: Vincent Lefevre @ 2016-12-29 10:19 UTC (permalink / raw)
  To: shirish शिरीष; +Cc: zsh-workers, Adam

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)


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-12-29 10:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-26 20:21 [FEATURE REQUEST] Adding battery power to bigfade prompt shirish शिरीष
2016-12-27 13:09 ` Daniel Shahaf
2016-12-27 20:47   ` shirish शिरीष
2016-12-29 10:19 ` Vincent Lefevre

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).