Use i3status
This commit is contained in:
53
i3/i3/i3status.conf
Normal file
53
i3/i3/i3status.conf
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 {
|
||||||
|
interval = 5
|
||||||
|
# color = '#FFFFFF'
|
||||||
|
# color_good = '#00FF00'
|
||||||
|
# color_bad = '#FF0000'
|
||||||
|
# color_degraded = '#FFFF00'
|
||||||
|
color = '#FFFFFF'
|
||||||
|
color_good = '#FFFFFF'
|
||||||
|
color_bad = '#FFFFFF'
|
||||||
|
color_degraded = '#FFFFFF'
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
order += "wifi"
|
||||||
|
order += "sysdata"
|
||||||
|
# order += "exchange_rate nzdollar"
|
||||||
|
order += "battery_level 0"
|
||||||
|
order += "clock"
|
||||||
|
|
||||||
|
battery_level 0 {
|
||||||
|
format = "{percent}%"
|
||||||
|
notification = true
|
||||||
|
}
|
||||||
|
|
||||||
|
clock {
|
||||||
|
format = ["{Local}", "{NZ}"]
|
||||||
|
format_time = "[{name}] %a %Y-%m-%d %H:%M:%S"
|
||||||
|
}
|
||||||
|
|
||||||
|
# exchange_rate nzdollar {
|
||||||
|
# base = "EUR"
|
||||||
|
# cache_timeout = 3600
|
||||||
|
# format = "{NZD} NZ$"
|
||||||
|
# }
|
||||||
|
|
||||||
|
sysdata {
|
||||||
|
format = "C {cpu_usage}% {cpu_temp} M {mem_used}G ({mem_used_percent}%)"
|
||||||
|
precision = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
wifi {
|
||||||
|
format_down = "W: down"
|
||||||
|
format_up = "W: {signal_percent} {ssid}"
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,98 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
rundir="$RUNDIR/batwarn"
|
|
||||||
logfile="$LOGDIR/batwarn.log"
|
|
||||||
|
|
||||||
_PATH_WARN_1="$rundir/batwarn1"
|
|
||||||
_PATH_WARN_2="$rundir/batwarn2"
|
|
||||||
|
|
||||||
_THRESHOLD1=25
|
|
||||||
_THRESHOLD2=5
|
|
||||||
|
|
||||||
acpi_output=$(acpi -b)
|
|
||||||
|
|
||||||
log() {
|
|
||||||
printf '%s\n' "[$(date +%FT%T)] $*" >> $logfile
|
|
||||||
}
|
|
||||||
|
|
||||||
charging() {
|
|
||||||
[[ "$status" == "C" ]]
|
|
||||||
}
|
|
||||||
|
|
||||||
discharging() {
|
|
||||||
[[ "$status" == "D" ]]
|
|
||||||
}
|
|
||||||
|
|
||||||
threshold1() {
|
|
||||||
(( $percent <= $_THRESHOLD1 ))
|
|
||||||
}
|
|
||||||
|
|
||||||
threshold2() {
|
|
||||||
(( $percent <= $_THRESHOLD2 ))
|
|
||||||
}
|
|
||||||
|
|
||||||
notify_threshold1() {
|
|
||||||
notify-send --icon dialog-warning "Battery below ${_THRESHOLD2}%" --expire-time 0
|
|
||||||
}
|
|
||||||
|
|
||||||
notify_threshold2() {
|
|
||||||
notify-send --icon dialog-warning "Battery below ${_THRESHOLD1}%" --expire-time 30000
|
|
||||||
}
|
|
||||||
|
|
||||||
if [[ -n "$acpi_output" ]] ; then
|
|
||||||
has_battery=1
|
|
||||||
percent="$(printf '%s' "$acpi_output" | grep -oP '\d+(?=%)')"
|
|
||||||
if [[ $percent == 100 ]] ; then
|
|
||||||
status="F"
|
|
||||||
else
|
|
||||||
status="$(printf '%s' "$acpi_output" | grep -oP '(?<=: )\w+(?=,)' | cut -c 1 )"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
has_battery=0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if (( has_battery )) ; then
|
|
||||||
if discharging ; then
|
|
||||||
if threshold2 ; then
|
|
||||||
if [[ ! -f "$_PATH_WARN_2" ]] ; then
|
|
||||||
log "battery fell below $_THRESHOLD2 percent. issuing warning."
|
|
||||||
touch "$_PATH_WARN_2"
|
|
||||||
notify_threshold1
|
|
||||||
fi
|
|
||||||
elif threshold1 ; then
|
|
||||||
if [[ ! -f "$_PATH_WARN_1" ]] ; then
|
|
||||||
log "battery fell below $_THRESHOLD1 percent. issuing warning."
|
|
||||||
touch "$_PATH_WARN_1"
|
|
||||||
notify_threshold2
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
elif charging ; then
|
|
||||||
if [[ -f "$_PATH_WARN_1" ]] ; then
|
|
||||||
log "charging now. resetting warnings."
|
|
||||||
rm "$_PATH_WARN_1"
|
|
||||||
fi
|
|
||||||
[[ -f "$_PATH_WARN_2" ]] && rm "$_PATH_WARN_2"
|
|
||||||
fi
|
|
||||||
|
|
||||||
urgent=0
|
|
||||||
if threshold2 ; then
|
|
||||||
color="#FF0000" # red
|
|
||||||
if discharging ; then
|
|
||||||
urgent=1
|
|
||||||
fi
|
|
||||||
elif threshold1 ; then
|
|
||||||
color="#FFFF00" # yellow
|
|
||||||
else
|
|
||||||
color="#FFFFFF" # white
|
|
||||||
fi
|
|
||||||
|
|
||||||
printf '%s\n' "${status} ${percent}%"
|
|
||||||
printf '%s\n'
|
|
||||||
printf '%s\n' $color
|
|
||||||
(( $urgent )) && exit 33
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
printf '%s\n' "no battery"
|
|
||||||
printf '%s\n'
|
|
||||||
printf '%s\n' "#FFFFFF"
|
|
||||||
fi
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
load="$(cut -d ' ' -f 1 /proc/loadavg)"
|
|
||||||
cpus="$(nproc --all)"
|
|
||||||
|
|
||||||
echo $load
|
|
||||||
echo $load
|
|
||||||
|
|
||||||
awk -v cpus=$cpus -v _load=$load '
|
|
||||||
BEGIN {
|
|
||||||
if (_load >= cpus) {
|
|
||||||
print "#FF0000";
|
|
||||||
}
|
|
||||||
else if (_load >= cpus / 2) {
|
|
||||||
print "#FFFF00";
|
|
||||||
}
|
|
||||||
}'
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
[[ "$1" ]] || exit 1
|
|
||||||
name="$1"
|
|
||||||
|
|
||||||
pidfile="/run/openvpn@client-${name}.pid"
|
|
||||||
|
|
||||||
if pgrep --pidfile "${pidfile}" >/dev/null 2>&1 ; then
|
|
||||||
status="UP"
|
|
||||||
color="#ffffff"
|
|
||||||
else
|
|
||||||
status="DOWN"
|
|
||||||
color="#ff0000"
|
|
||||||
fi
|
|
||||||
|
|
||||||
output="${name} ${status}"
|
|
||||||
|
|
||||||
echo $output
|
|
||||||
echo $output
|
|
||||||
echo $color
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
pkill --signal SIGRTMIN+1 i3blocks
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
aps="$(nmcli --terse --fields IN-USE,SSID,SIGNAL device wifi list | grep '^\*:')"
|
|
||||||
|
|
||||||
ssid="$(echo $aps | cut -d ':' -f 2)"
|
|
||||||
perc="$(echo $aps | cut -d ':' -f 3)"
|
|
||||||
|
|
||||||
output="$ssid $perc%"
|
|
||||||
|
|
||||||
echo "$output"
|
|
||||||
echo "$output"
|
|
||||||
Reference in New Issue
Block a user