From: Dmitry Fedotov Date: Tue, 14 Jul 2020 18:03:01 +0000 (+0300) Subject: i3blocks focused window block rework. X-Git-Url: https://www.git.dmfe.net/?a=commitdiff_plain;h=983e230b91e7035801cdb5f99cbc5c25e48d4fd0;p=dotfiles i3blocks focused window block rework. --- diff --git a/scripts/i3b-formatter.sh b/scripts/i3b-formatter.sh index bf2300f..05058c2 100755 --- a/scripts/i3b-formatter.sh +++ b/scripts/i3b-formatter.sh @@ -10,9 +10,12 @@ while IFS= read -r input; do value="${input}" fi if (( $i == 1 )); then - foreground="${input}" + short_value="${input}" fi if (( $i == 2 )); then + foreground="${input}" + fi + if (( $i == 3 )); then background="${input}" fi @@ -53,7 +56,7 @@ else fi echo "${value}" -echo "" +echo "${short_value}" echo "${foreground}" echo "${background}" diff --git a/scripts/iface.sh b/scripts/iface.sh index 053b768..437d9b1 100755 --- a/scripts/iface.sh +++ b/scripts/iface.sh @@ -22,4 +22,6 @@ esac ipaddr=$(ip addr show enp3s0 | awk '/inet/ { print $2 ; exit }' | sed 's/\/.*//g') echo "${icon} ${ipaddr}" +echo echo "#66ff33" +echo diff --git a/scripts/window-title.sh b/scripts/window-title.sh new file mode 100755 index 0000000..4d839fd --- /dev/null +++ b/scripts/window-title.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +max_width=50 +text="$(sleep .3; xdotool getactivewindow getwindowname)" +short_text="${text:0:$((max_width-3))}..." + +tilte_len=$((${#text})) +if ((${#text} > $max_width)); then + text="${short_text}" +fi + +echo "${text}" +