stupidly simple modular statusbar
Go to file
2022-08-28 18:32:36 +03:00
candybar.sh replace printf with echo 2022-04-08 12:39:55 +03:00
config.sh remove duplicate comment from config.sh 2022-08-28 18:32:36 +03:00
LICENSE Create LICENSE 2022-04-07 16:44:25 +03:00
Makefile split Makefile install into 2 recipes 2022-08-26 15:54:29 +03:00
modules.sh for vol module it shows when is muted 2022-04-20 00:11:51 +03:00
README.md add module tutorial and more preview images to README.md 2022-08-27 10:24:38 +03:00

candybar

a stupidly simple modular statusbar

preview 0 preview 1 preview 2

usage

candybar only outputs the text that should be shown on the bar, which makes it useable on different applications.

usage with dwm

add the following to your ~/.xinitrc:

while true; do
	xsetroot -name "$(candybar)"
	sleep 2
done &

usage with tmux

add the following to your ~/.tmux.conf:

set -g status-interval 2
set -g status-right-length 100
set -g status-right "#(candybar)"

usage with zsh

add the following to your ~/.zshrc:

precmd() {
	psvar[1]="$(candybar)"
}
export CSI=$'\e'"["
export PROMPT="${CSI}s${CSI}1;$((LINES-1))r${CSI}$LINES;1f%S%1v%s${CSI}K${CSI}u${PROMPT}"

writing modules

writing candybar modules is very easy. modules can be written in any programming language.

first, open up the modules.sh file. create a new function with, for example, the name module_foo().

module_foo() {
	# uh, so what now?
}

next, if you are using POSIX SH to write your module, just write your script in the function.

for this example, we'll be writing a module that outputs the current date.

module_foo() {
	# remember to keep the ${bar}, ${1}, and ${2} here!
	export bar="${bar}${1}$(date)${2}"
}

if you are using a different language, write your module and then run it with sh.

module_foo() {
	export output="$(/path/to/program)"
	export bar="${bar}${1}${output}${2}"
}

now add a line for your module in the config.sh, for example:

module_foo	"Date:"		" | "

you're done! run candybar to see the results.

remember that if you have configured candybar to be used in zsh, tmux or dwm like in this README, you won't have to restart candybar!