implement custom i3status bar
This commit is contained in:
parent
6cd4c4f90d
commit
07aef9f223
5 changed files with 160 additions and 1 deletions
2
_sync.sh
2
_sync.sh
|
|
@ -12,6 +12,7 @@ dirs=(
|
||||||
"/var/unbound:."
|
"/var/unbound:."
|
||||||
"$HOME/bhyve:."
|
"$HOME/bhyve:."
|
||||||
"$HOME/.config/i3:i3wm"
|
"$HOME/.config/i3:i3wm"
|
||||||
|
"$HOME/.config/i3status:i3wm"
|
||||||
)
|
)
|
||||||
|
|
||||||
files=(
|
files=(
|
||||||
|
|
@ -25,6 +26,7 @@ files=(
|
||||||
"/etc/rc.conf:rc.conf"
|
"/etc/rc.conf:rc.conf"
|
||||||
"/usr/local/etc/smb4.conf:smb4.conf"
|
"/usr/local/etc/smb4.conf:smb4.conf"
|
||||||
"/etc/sysctl.conf:sysctl.conf"
|
"/etc/sysctl.conf:sysctl.conf"
|
||||||
|
"/usr/local/bin/w_status:w_status"
|
||||||
)
|
)
|
||||||
|
|
||||||
# create directories
|
# create directories
|
||||||
|
|
|
||||||
|
|
@ -192,5 +192,5 @@ bindsym $mod+r mode "resize"
|
||||||
# Start i3bar to display a workspace bar (plus the system information i3status
|
# Start i3bar to display a workspace bar (plus the system information i3status
|
||||||
# finds out, if available)
|
# finds out, if available)
|
||||||
bar {
|
bar {
|
||||||
status_command i3status
|
status_command w_status
|
||||||
}
|
}
|
||||||
|
|
|
||||||
7
i3wm/i3status/config
Normal file
7
i3wm/i3status/config
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
general {
|
||||||
|
output_format = "i3bar"
|
||||||
|
colors = true
|
||||||
|
interval = 5
|
||||||
|
}
|
||||||
|
|
||||||
|
order = ""
|
||||||
53
i3wm/i3status/config.orig
Normal file
53
i3wm/i3status/config.orig
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
# i3status configuration file.
|
||||||
|
# see "man i3status" for documentation.
|
||||||
|
|
||||||
|
# It is important that this file is edited as UTF-8.
|
||||||
|
# The following line should contain a sharp s:
|
||||||
|
# ß
|
||||||
|
# If the above line is not correctly displayed, fix your editor first!
|
||||||
|
|
||||||
|
general {
|
||||||
|
colors = true
|
||||||
|
interval = 5
|
||||||
|
}
|
||||||
|
|
||||||
|
order += "ipv6"
|
||||||
|
order += "wireless _first_"
|
||||||
|
order += "ethernet _first_"
|
||||||
|
order += "battery all"
|
||||||
|
order += "disk /"
|
||||||
|
order += "load"
|
||||||
|
order += "memory"
|
||||||
|
order += "tztime local"
|
||||||
|
|
||||||
|
wireless _first_ {
|
||||||
|
format_up = "W: (%quality at %essid) %ip"
|
||||||
|
format_down = "W: down"
|
||||||
|
}
|
||||||
|
|
||||||
|
ethernet _first_ {
|
||||||
|
format_up = "E: %ip (%speed)"
|
||||||
|
format_down = "E: down"
|
||||||
|
}
|
||||||
|
|
||||||
|
battery all {
|
||||||
|
format = "%status %percentage %remaining"
|
||||||
|
}
|
||||||
|
|
||||||
|
disk "/" {
|
||||||
|
format = "%avail"
|
||||||
|
}
|
||||||
|
|
||||||
|
load {
|
||||||
|
format = "%1min"
|
||||||
|
}
|
||||||
|
|
||||||
|
memory {
|
||||||
|
format = "%used | %available"
|
||||||
|
threshold_degraded = "1G"
|
||||||
|
format_degraded = "MEMORY < %available"
|
||||||
|
}
|
||||||
|
|
||||||
|
tztime local {
|
||||||
|
format = "%Y-%m-%d %H:%M:%S"
|
||||||
|
}
|
||||||
97
w_status
Executable file
97
w_status
Executable file
|
|
@ -0,0 +1,97 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# replacement for i3status for my FreeBSD setup
|
||||||
|
# I want to output
|
||||||
|
# ue0 | wlan0 | re0 | ZFS | RAM | SWAP | temp | time
|
||||||
|
|
||||||
|
interval=1
|
||||||
|
|
||||||
|
output_time() {
|
||||||
|
date "+%d/%m/%Y %H:%M:%S"
|
||||||
|
}
|
||||||
|
|
||||||
|
output_battery() {
|
||||||
|
read -r bat_state<<<$(echo "$hwstat_output" | awk '$1=="State:" { print $2 }' | tail -n 1)
|
||||||
|
read -r bat_capacity<<<$(echo "$hwstat_output" | awk '$1=="Remaining" { print $3 }' | head -n 1)
|
||||||
|
|
||||||
|
echo "BAT: $bat_capacity% $bat_state"
|
||||||
|
}
|
||||||
|
|
||||||
|
swap_to_mb() {
|
||||||
|
echo $1 | awk '{ printf "%.2f\n", $1/1024; }'
|
||||||
|
}
|
||||||
|
|
||||||
|
bytes_to_mb() {
|
||||||
|
echo $1 | awk '{ printf "%.2f\n", $1/1024/1024; }'
|
||||||
|
}
|
||||||
|
|
||||||
|
bytes_to_gb() {
|
||||||
|
echo $1 | awk '{ printf "%.2f\n", $1/1024/1024/1024; }'
|
||||||
|
}
|
||||||
|
|
||||||
|
output_temp() {
|
||||||
|
temp=$(echo "$hwstat_output" | awk '$1=="CPU0:" { print $2 }')
|
||||||
|
|
||||||
|
echo "t: $temp"
|
||||||
|
}
|
||||||
|
|
||||||
|
output_swap() {
|
||||||
|
read -r swap_used <<<$(swapinfo | awk 'NR==2 { print $3 }')
|
||||||
|
echo "SWAP: $(swap_to_mb $swap_used) MiB"
|
||||||
|
}
|
||||||
|
|
||||||
|
output_ram() {
|
||||||
|
physmem=$(sysctl -n hw.physmem)
|
||||||
|
usermem=$(sysctl -n hw.usermem)
|
||||||
|
|
||||||
|
echo "RAM: $(bytes_to_gb $usermem)/$(bytes_to_gb $physmem) GiB"
|
||||||
|
}
|
||||||
|
|
||||||
|
output_zfs() {
|
||||||
|
read -r zfs_name zfs_size zfs_free<<<$(zpool list | awk 'NR==2 { print $1,$2,$4 }')
|
||||||
|
echo "$zfs_name: $zfs_free free"
|
||||||
|
}
|
||||||
|
|
||||||
|
output_eth() {
|
||||||
|
if_output=$(ifconfig $1)
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
read -r eth_ip<<<$(echo "$if_output" | awk '$1=="inet" { print $2 }')
|
||||||
|
#read -r eth_type<<<$(echo "$if_output" | awk '$1=="media:" { print $2 }')
|
||||||
|
read -r eth_media<<<$(echo "$if_output" | awk '$1=="media:" { print $4 }' | sed s/\(//)
|
||||||
|
|
||||||
|
echo "$1: $eth_ip $eth_media"
|
||||||
|
else
|
||||||
|
echo "$1: offline"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
output_wlan() {
|
||||||
|
if_output=$(ifconfig $1)
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
read -r eth_ip<<<$(echo "$if_output" | awk '$1=="inet" { print $2 }')
|
||||||
|
#read -r eth_type<<<$(echo "$if_output" | awk '$1=="media:" { print $3 }')
|
||||||
|
#read -r eth_media<<<$(echo "$if_output" | awk '$1=="media:" { print $4 }' | sed s/\(//)
|
||||||
|
|
||||||
|
echo "$1: $eth_ip"
|
||||||
|
else
|
||||||
|
echo "$1: offline"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
output_usb_eth() {
|
||||||
|
if_output=$(ifconfig $1)
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
read -r eth_ip<<<$(echo "$if_output" | awk '$1=="inet" { print $2 }')
|
||||||
|
|
||||||
|
echo "$1: $eth_ip"
|
||||||
|
else
|
||||||
|
echo "$1: offline"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
hwstat_output=$(hwstat)
|
||||||
|
echo "$(output_usb_eth ue0) | $(output_wlan wlan0) | $(output_eth re0) | $(output_zfs) | $(output_ram) | $(output_swap) | $(output_temp) | $(output_battery) | $(output_time)";
|
||||||
|
|
||||||
|
sleep $interval;
|
||||||
|
done
|
||||||
Loading…
Add table
Reference in a new issue