如何在Zsh提示中显示电池状态 [英] How to show battery status in Zsh prompt

查看:83
本文介绍了如何在Zsh提示中显示电池状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为答案是很容易解释的。

I think the answer is quite self explanatory.

我一直在寻找一款已经能够做到这一点但没有运气的软件。它不是在Zsh中完成的,还是在另一个应用程序(例如tmux)中完成的。关键是我找不到它。

I've been looking around for a software that already does this but I haven't had any luck. It's either not done in Zsh, or it's for another app, for example tmux. Point is I haven't been able to find it.

所以我的问题是,已经有人预制了一个预制脚本吗?如果有的话,请您分享它的链接。

So my question is, is there already a pre-made script that somebody did that does this? If there is, could you please share a link to it.

如果没有,我应该怎么做才能编写此脚本?我是Zsh脚本的新手,请牢记这一点。

If there isn't, what should I look into to making this script? I'm a newbie at Zsh scripting so bear that in mind.

这个想法是,它输出的内容类似于 67%。你明白了。 ;)

The idea is that it outputs something along the lines of 67%. You get the point. ;)

推荐答案

一个非常简单的解决方案:

A very-very simple solution:

setopt promptsubst
PROMPT='$(acpi | grep -o "[0-9]*%)% '

这篇关于如何在Zsh提示中显示电池状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆