diff --git a/.local/bin/batmon b/.local/bin/batmon
new file mode 100755
index 0000000..980be5f
--- /dev/null
+++ b/.local/bin/batmon
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+FULL_THRESHOLD=80
+FULL_COLOR="#31f53e"
+
+read -r capacity %s%% (%s)\n' "$FULL_COLOR" "$capacity" "$status"
+else
+ printf '%s%% (%s)\n' "$capacity" "$status"
+fi
diff --git a/.local/bin/cpumon b/.local/bin/cpumon
index 83348d8..a06097e 100755
--- a/.local/bin/cpumon
+++ b/.local/bin/cpumon
@@ -1,14 +1,29 @@
#!/bin/sh
-initial_values=$(awk '/cpu /{print $2+$4,$2+$4+$5}' /proc/stat)
-sleep 2
-current_values=$(awk '/cpu /{print $2+$4,$2+$4+$5}' /proc/stat)
+while read -r _ user _ system idle _; do
+ initial_user_sys=$((user + system))
+ initial_total=$((user + system + idle))
+ break
+done /dev/null && usage=$($1)
low_used=$((width * 30 / 100))
medium_used=$((width * 60 / 100))
-num_used_chars=$(echo "scale=0; ($usage * $width) / 100" | bc -l)
+num_used_chars=$(printf 'scale=0; (%s * %s) / 100\n' "$usage" "$width" | bc -l)
if [ -n "$usage_color" ]; then
case "$num_used_chars" in
- [0-$low_used]) used_color="$LOW_USED_COLOR" ;;
- [$low_used-$medium_used]) used_color="$MEDIUM_USED_COLOR" ;;
- *) used_color="$HIGH_USED_COLOR" ;;
+ [0-$low_used]) used_color="$LOW_USED_COLOR" ;;
+ [$low_used-$medium_used]) used_color="$MEDIUM_USED_COLOR" ;;
+ *) used_color="$HIGH_USED_COLOR" ;;
esac
else
used_color="$DEFAULT_USED_COLOR"
fi
+prev_opened=0
+any_used_width=0
i=1
while [ "$i" -le "$width" ]; do
if [ "$i" -le "$num_used_chars" ]; then
- bar="$bar#"
+ if [ "$prev_opened" -eq 0 ]; then
+ bar="$bar"
+ prev_opened=1
+ any_used_width=1
+ fi
+ bar="$bar#"
else
- bar="$bar:"
+ if [ "$any_used_width" -eq 1 ]; then
+ bar="$bar"
+ prev_opened=0
+ any_used_width=0
+ fi
+ if [ "$prev_opened" -eq 0 ]; then
+ bar="$bar"
+ prev_opened=1
+ fi
+ bar="$bar:"
fi
i=$((i + 1))
done
+bar="$bar"
-echo "$bar"
+printf '%s\n' "$bar"
diff --git a/.local/bin/initialize_pipes b/.local/bin/initialize_pipes
index 0500cfe..2b75f7b 100755
--- a/.local/bin/initialize_pipes
+++ b/.local/bin/initialize_pipes
@@ -1,6 +1,6 @@
#!/bin/sh
-PIPES="nowplaying volume"
+PIPES="volume"
for pipe in $PIPES; do
echo "" >"/tmp/pipe-$pipe"
diff --git a/.local/bin/ipmon b/.local/bin/ipmon
new file mode 100755
index 0000000..faf498a
--- /dev/null
+++ b/.local/bin/ipmon
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+address=$(ip route get 1)
+address=${address#* via * dev * src }
+address=${address% uid *}
+
+printf '%s\n' "$address"
diff --git a/.local/bin/loadmon b/.local/bin/loadmon
new file mode 100755
index 0000000..45b0086
--- /dev/null
+++ b/.local/bin/loadmon
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+while read -r one five fifteen _; do
+ load_one=$one
+ load_five=$five
+ load_fifteen=$fifteen
+done {{artist}} - {{title}}" >"$PIPE_FILE"
+echo "$(mpc | head -n1)" >"$PIPE_FILE"
diff --git a/.local/bin/pipe_volume b/.local/bin/pipe_volume
index 27953c8..8bf7c64 100755
--- a/.local/bin/pipe_volume
+++ b/.local/bin/pipe_volume
@@ -3,5 +3,4 @@
PIPE_FILE="/tmp/pipe-volume"
[ -p "$PIPE_FILE" ] || mkfifo "$PIPE_FILE"
-volume=$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '/Volume/ { print int($NF * 100) }')
-genbar "$volume" 10 1 >"$PIPE_FILE"
+volmon >"$PIPE_FILE"
diff --git a/.local/bin/screenlayouts/sl-external b/.local/bin/screenlayouts/sl-external
index f09d372..8ad45b0 100755
--- a/.local/bin/screenlayouts/sl-external
+++ b/.local/bin/screenlayouts/sl-external
@@ -1,5 +1,5 @@
#!/bin/sh
xrandr \
- --output eDP-1 --off \
- --output HDMI-2 --primary --mode 1920x1080 --pos 0x0 --rotate normal
+ --output eDP1 --off \
+ --output HDMI2 --primary --mode 1920x1080 --pos 0x0 --rotate normal
diff --git a/.local/bin/ssidmon b/.local/bin/ssidmon
new file mode 100755
index 0000000..ef52a1d
--- /dev/null
+++ b/.local/bin/ssidmon
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+ADAPTER="wlan0"
+
+ssid=
+while read -r line; do
+ case $line in
+ *Connected\ network*)
+ ssid=${line##*Connected network}
+ ssid="${ssid#"${ssid%%[![:space:]]*}"}"
+ ;;
+ esac
+done <