]> www.git.dmfe.net Git - dotfiles/commitdiff
i3blocks focused window block rework.
authorDmitry Fedotov <dm.fe@yandex.ru>
Tue, 14 Jul 2020 18:03:01 +0000 (21:03 +0300)
committerDmitry Fedotov <dm.fe@yandex.ru>
Tue, 14 Jul 2020 18:03:01 +0000 (21:03 +0300)
scripts/i3b-formatter.sh
scripts/iface.sh
scripts/window-title.sh [new file with mode: 0755]

index bf2300f7163222ca0e10f2c2a26221735669a582..05058c2d1a36360256f33ae38d3e0a71284c53a0 100755 (executable)
@@ -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}"
 
index 053b768f3fef7c9e0e7dcdd54eda1cbf2f07daf1..437d9b182d8fcab57aa91b96f37bd0af4f897c5f 100755 (executable)
@@ -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 (executable)
index 0000000..4d839fd
--- /dev/null
@@ -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}"
+