Skip to content

Instantly share code, notes, and snippets.

@liar666
Created June 3, 2025 15:23
Show Gist options
  • Save liar666/89e90840f140fcbdd8bf8f9fc3697b97 to your computer and use it in GitHub Desktop.
Save liar666/89e90840f140fcbdd8bf8f9fc3697b97 to your computer and use it in GitHub Desktop.
liar666's i3status config
general {
output_format = "i3bar"
markup = pango
interval = 1
colors = false
# color_good = "#0000FF"
# color_degraded = "#00FF00"
# color_bad = "#FF0000"
}
order += "cpu_usage"
order += "load"
order += "cpu_temperature 0"
order += "memory"
order += "disk /"
order += "disk /home"
order += "ethernet _first_"
order += "wireless _first_"
#order += "volume master"
order += "battery 0"
order += "tztime local"
tztime local {
format = "<span background='#4c566a' color='#d8dee9'><b>🗓 %a %d %b %H:%M:%S</b></span>" #  🗒 📅
}
cpu_usage {
format = "<span background='#4c566a' color='#d8dee9'> 󰻠 %usage <span color='#81a1c1'></span></span>" #  🖥 💻 🖥 🧠 %cpu0 %cpu1 %cpu2 %cpu3
max_threshold = 75
}
load {
format = "<span background='#4c566a' color='#d8dee9'> %1min <span color='#81a1c1'></span></span>" #  🖥 💻 🖥 🧠 %cpu0 %cpu1 %cpu2 %cpu3
max_threshold = 75
}
cpu_temperature 0 {
format = "<span background='#4c566a' color='#d8dee9'>  %degrees °C </span>"
path = "/sys/class/thermal/thermal_zone7/temp"
max_threshold = 75
}
memory {
format = "<span background='#4c566a' color='#d8dee9'>  %percentage_free </span> " #   📒 %available (%used) / %total
}
disk "/" {
format = "<span background='#4c566a' color='#d8dee9'> 󰋊 / %avail (%percentage_avail) </span>" # 󰉉󰧯 󰋊󱁋 🖴 %availaible = for user / %free = for system
format_below_threshold = "<span background='#4c566a' color='#ff0000'> 󰋊 / %avail (%percentage_avail) </span>"
low_threshold = 10
threshold_type = percentage_free
prefix_type = binary # binary / decimal / custom
}
disk "/home" {
format = "<span background='#4c566a' color='#d8dee9'> 󰋊 /h %avail (%percentage_avail) </span>" # 💾 🖴 %availaible = for user / %free = for system
format_below_threshold = "<span background='#4c566a' color='#ff0000'> 󰋊 /h %avail (%percentage_avail) </span>"
low_threshold = 10
threshold_type = percentage_free
prefix_type = binary # binary / decimal / custom
}
ethernet _first_ {
format_up = "<span background='#4c566a'>󰈁 <span color='#d8dee9'>%ip</span></span>" # 󰈀󰈁󰈂 🖧 🕸 🔀
format_down = "<span background='#4c566a'>󰈂 </span>" # <span color='#Fe515c'> 🞪 </span> ❌ 🖧 🕸 🔀
}
# OLD wireless _first_ {
# format_up = "<span background='#4c566a'> <span color='#d8dee9'> %essid (%quality) </span></span>" # %ip
# format_down = "<span background='#4c566a'> <span color='#5e81ac'> ❌ </span></span>"
# }
wireless _first_ {
format_up = "<span background='#4c566a'>󰤨 <span color='#d8dee9'>%ip</span></span> <span background='#4c566a' color='#d8dee9'>REPLACE_ETH_SPEED</span>" #  󰖩󰖪󱛅󱚼󰤨󰤭󰤯󰤮 Will be replaced by external ~/.config/i4status/network_load.sh script
format_down = "<span background='#4c566a'>󰤮 </span> <span color='#d8dee9' background='#4c566a'>REPLACE_ETH_SPEED</span>" # <span color='#5e81ac'> 🞪 </span> ❌ 🕸 🔀
}
# volume master {
# format = "<span background='#4c566a' color='#d8dee9'> 🔊 %volume </span>"
# format_muted = "<span background='#4c566a' color='#5e81ac'> 🔇 Muted </span>"
# device = "default"
# mixer = "Master"
# mixer_idx = 0
# }
# battery 0 {
# last_full_capacity = true
# format = "<span background='#4c566a' color='#d8dee9'>%status %percentage </span>" # %remaining 
# path = "/sys/class/power_supply/BAT%d/uevent"
# format_down = "<span color='#bf616a'> 󱉝</span>" # 🕸  ↯⌁ 🔋 󱉝󱉞
# status_chr = "<span color='#81a1c1'> 󱟦</span>" #  ⬆ 🔺 ⏚ ⚡ 󱟠󱟞 󱟡󱟟 󱟦󱟤  󰁺󰁼󰁾󰁿󰂁
# status_bat = "<span color='#d08770'> 󱟤</span>" #  ⬇ 🔻
# status_unk = "<span color='#bf616a'> 󰂑</span>" #  󰂑
# status_full = "<span color='#a3be8c'> 󰁹</span>" # ☻  󱊣󱟢 󰁹
# low_threshold = 10
# threshold_type = percentage
# integer_battery_capacity = true
# hide_seconds = true
# }
battery 0 {
format = "<span background='#4c566a'>%status %percentage</span>" # %remaining 
path = "/sys/class/power_supply/BAT%d/uevent"
format_down = "󱉝" # 🕸  ↯⌁ 🔋 󱉝󱉞
# color='#bf616a'
status_chr = "󱟦" #  ⬆ 🔺 ⏚ ⚡ 󱟠󱟞 󱟡󱟟 󱟦󱟤  󰁺󰁼󰁾󰁿󰂁
# color='#81a1c1'
status_bat = "󱟤" #  ⬇ 🔻
# color='#d08770'
status_unk = "󰂑" #  󰂑
# color='#bf616a'
status_full = '󰁹' # ☻  󱊣󱟢 󰁹
#color_full = '#a3be8c'
last_full_capacity = true
low_threshold = 10
threshold_type = percentage
hide_seconds = true
integer_battery_capacity = true
}
#!/usr/bin/env bash
# Inspired from:
# https://wiki.archlinux.org/index.php/i3#Network_Download/Upload_speed_in_statusbar
# http://code.stapelberg.de/git/i3status/tree/contrib/net-speed.sh
# i3status.conf should contain:
# general {
# output_format = i3bar
# }
#
# i3 config looks like this:
# bar {
# status_command exec /path/to/thisfile.sh
# }
#
# Single interface:
# ifaces="eth0"
#
# Multiple interfaces:
# ifaces="eth0 wlan0"
# Auto detect interfaces
ifaces=$(\ls /sys/class/net | grep -E '^(enx|enp|eth|wlp)')
#COLOR_UP="#ff8c00"
#COLOR_DW="#228b22"
COLOR_UP="#ffbf00"
COLOR_DW="#11Fb11"
COLOR_ER="#9eb1dc"
last_time=0
last_rx=0
last_tx=0
rate=""
fixed_digits() {
#echo "fixed_digits called with : $1 // $2" >> /tmp/network_load.err
if [[ -z "$1" || -z "$2" ]] ; then
printf "%.$1d" "0"
else
printf "%.$1d" "$2"
fi
}
readable() {
local bytes=$1
local kib=$(( bytes >> 10 ))
#echo "bytes data : $kib" >> /tmp/network_load.err
if [ $kib -lt 0 ]; then
echo "? K"
elif [ $kib -gt 1024 ]; then
local mib_int=$(( kib >> 10 ))
local mib_dec=$(( kib % 1024 * 976 / 10000 ))
if [ "$mib_dec" -lt 10 ]; then
mib_dec="0${mib_dec}"
fi
echo "$(fixed_digits 2 ${mib_int}).$(fixed_digits 2 ${mib_dec}) M"
else
echo "$(fixed_digits 3 ${kib}) K"
fi
}
update_rate() {
local time=$(date +%s)
local rx=0 tx=0 tmp_rx tmp_tx
for iface in $ifaces; do
read -r tmp_rx < "/sys/class/net/${iface}/statistics/rx_bytes"
read -r tmp_tx < "/sys/class/net/${iface}/statistics/tx_bytes"
rx=$(( rx + tmp_rx ))
tx=$(( tx + tmp_tx ))
done
local interval=$(( time - last_time ))
rx_speed=$(( (rx - last_rx) / interval ))
tx_speed=$(( (tx - last_tx) / interval ))
#echo "raw speed : $tx $last_tx $tx_speed $rx $last_rx $rx_speed $interval" >> /tmp/network_load.err
if [ $interval -gt 0 ]; then
rate="<span color='$COLOR_DW'> $(readable $rx_speed)↓</span><span color='$COLOR_UP'> $(readable $tx_speed)↑</span>"
else
rate="<span color='$COLOR_ER'> ❌ </span>"
fi
last_time=$time
last_rx=$rx
last_tx=$tx
}
i3status | (read -r line && echo "$line" && read -r line && echo "$line" && read -r line && echo "$line" && update_rate && while :
do
read -r line
update_rate
echo "$line" | sed 's|REPLACE_ETH_SPEED|'"${rate}"'|g'
# echo "${line/REPLACE_ETH_SPEED/${rate}}" # => bug with utf8 chars
done)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment