initial commit

This commit is contained in:
Emily Daemon 2022-04-07 15:03:37 +03:00
commit 5da9ed8346
3 changed files with 63 additions and 0 deletions

6
candybar.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
# candybar - a stupidly simple statusbar written in shell
export bar=" "
. "$HOME/.config/candybar/config.sh"
printf "$bar\n"

18
config.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/sh
# candybar configuration
# modules location
. "$HOME/.config/candybar/modules.sh"
# module list. uncomment to enable.
# re-arrange to change order.
# module name icon/prefix suffix
#module_mpc "MPD: " " | "
#module_uptime "Up: " " | "
#module_ram "RAM: " " | "
#module_user "User: " " | "
#module_alsa "Vol: " " | "
#module_kernel "Kernel: " " | "
#module_loadavg "Load Avg.: " " | "
#module_weather "Weather: " " | "
module_date "Date: " ""

39
modules.sh Executable file
View File

@ -0,0 +1,39 @@
#!/bin/sh
# candybar modules
module_date() {
export bar="${bar}${1}$(date +'%a %Y-%m-%d %R')${2}"
}
module_mpc() {
mpcoutput="$(mpc | grep -v '\[.*\]' | grep -v 'volume:')"
[ "$mpcoutput" = "" ] || export bar="${bar}${1}${mpcoutput}${2}"
}
module_uptime() {
export bar="${bar}${1}$(uptime -p | sed 's/up // ; s/ year.*/y/ ; s/ week.*,/w/ ; s/ day.*,/d/ ; s/ hour.*,/h/ ; s/ minute.*/m/')${2}"
}
module_ram() {
export bar="${bar}${1}$(free -h | awk '/^Mem/ { print $3"/"$2 }' | sed s/i//g)${2}"
}
module_user() {
export bar="${bar}${1}$(whoami)@$(cat /proc/sys/kernel/hostname)${2}"
}
module_alsa() {
export bar="${bar}${1}$(amixer sget Master | awk -F'[][]' '/Mono:/ { print $2 }')${2}"
}
module_kernel() {
export bar="${bar}${1}$(sed "s/version // ; s/ (.*//" /proc/version)${2}"
}
module_loadavg() {
export bar="${bar}${1}$(uptime | sed 's/.*load average: //')${2}"
}
module_weather() {
export bar="${bar}${1}$(curl -s 'wttr.in/?format=1' | sed 's/.* //')${2}"
}