Shox: A customisable status bar for your terminal

栏目: IT技术 · 发布时间: 5年前

内容简介:A customisable terminal status bar with universal shell/terminal compatibility. Currently works on Mac/Linux.

Shox: Terminal Status Bar

A customisable terminal status bar with universal shell/terminal compatibility. Currently works on Mac/Linux.

Shox: A customisable status bar for your terminal

Installation

NOTEThis is still very experimental. I'm using it locally without any problems right now, but there's still a lot of testing and tweaking to do. Feel free to try it out, but get ready for some potential bugginess!

curl -s "https://raw.githubusercontent.com/liamg/shox/master/scripts/install.sh" | sudo bash

If you don't like to pipe to sudo - as well you shouldn't - you can remove the sudo above, but you'll have to add the shox dir to your PATH env var manually, as instructed by the installer.

Configuration

The shox config file should be created at $XDG_CONFIG_HOME/shox/config.yaml , which is usually ~/.config/shox/config.yaml . You can alternatively create it at ~/.shox.yaml

The config file looks like the following:

shell: /bin/bash
bar:
    format: "{time}||CPU: {cpu} MEM: {memory}"
    colours: 
      bg: red
      fg: white
    padding: 0

Shox will use your SHELL environment variable to determine the shell to run if a shell is not specified in the config file, but if your SHELL is set to shox, it'll default to /bin/bash to prevent a horrible recursive mess.

Bar Configuration

Bar configuration is done using a simple string format. Helpers are encased in braces e.g. {time} , alignment is done using pipes (see below), and any other text will be written to the bar.

Alignment

You can use pipes to align content within the status bar. All content before the first pipe will be aligned to the left, all content between the first and second will be centre aligned, and all content after the second pipe will be right aligned.

For example, to display a bar that centre aligns the time, you could use |{time}|

Colours

The following colours are available: black , white , red , green , yellow , blue , magenta , cyan , darkgrey , lightgrey , lightred , lightgreen , lightyellow , lightblue , lightmagenta , lightcyan .

Helpers

Helpers create dynamic output in your status bar. You can use one by adding it to your bar format config. The following is a list of available helpers.

Helper Description Example Config Example Output
time Show current time {time} 11:58:17
cpu Show current CPU usage {cpu} 20%
memory Show current memory usage % {memory} 20%
battery Show current battery charge % {battery} 20%
bash Run a custom bash command {bash:echo hi} hi

Ideally this list would be much longer - please feel free to PR more helpers! You can see simple examples here .

Why?

I frequently needed a way to have a quick overview of several things without cramming them into my PS1, and to update those things dynamicly.

How does it work?

Shox sits between the terminal and your shell and proxies all data sent between them. It identifies ANSI commands which contain coordinates and dimensions and adjusts them accordingly, so that the status bar can be drawn efficiently without interfering with the shell and it's child programs.


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

数据结构与算法

数据结构与算法

许卓群、杨冬青、唐世渭、张铭 / 高等教育出版社 / 2004-1 / 29.50元

《数据结构与算法》把数据结构的原理和算法分析技术有机地结合在一起,系统地介绍了各种类型的数据结构和排序、检索的各种算法,还引入了一些比较高级的数据结构及相关的算法分析技术。.《数据结构与算法》分为基本数据结构、排序和检索、高级数据结构三部分。借助抽象数据类型,从逻辑结构的角度系统地介绍了线性表、字符串、二叉树、树和图等各种基本数据结构;从算法的角度讨论排序、检索和索引算法;从应用的角度介绍了一些复......一起来看看 《数据结构与算法》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具