summaryrefslogtreecommitdiff
path: root/mybar
diff options
context:
space:
mode:
authorKevin Chabowski <kevin@kch42.de>2014-01-14 17:09:07 +0100
committerKevin Chabowski <kevin@kch42.de>2014-01-14 17:09:07 +0100
commit193c81f5b0e19e24f5ef9faa3b0e27155d371f2a (patch)
tree0684cd7febb564f9240b42990998596505f31b50 /mybar
parent482aaedcdd30bd71d0707807553c9eb83edb922a (diff)
parent9b672254e9b46977b8cb8f2342916ece1eeb696c (diff)
downloaddotfiles-master.tar.gz
dotfiles-master.tar.bz2
dotfiles-master.zip
Merge branch 'master' of git@github.com:kch42/dotfilesHEADmaster
Diffstat (limited to 'mybar')
-rwxr-xr-xmybar/mybar.awk17
-rwxr-xr-xmybar/mybar.sh1
2 files changed, 17 insertions, 1 deletions
diff --git a/mybar/mybar.awk b/mybar/mybar.awk
index d16dbf1..3d5db1d 100755
--- a/mybar/mybar.awk
+++ b/mybar/mybar.awk
@@ -10,12 +10,17 @@ BEGIN {
redshift=""
wifi=""
+ isnotebook=0
+
cpu_pused=0
cpu_ptotal=0
}
$1 == "date" {
date = $2 " " $3 " " $4
}
+$1 == "isnotebook" {
+ isnotebook = 1
+}
$1 == "cpu" {
used=$2+$3+$4+$7+$8;
total=used+$5+$6;
@@ -125,11 +130,21 @@ $1 == "wifi" {
if(length(tmp) > 10) {
tmp=substr(tmp, 1, 8) ".."
}
+
+ while(length(tmp) < 10) {
+ tmp=tmp " "
+ }
+
f = int(($3+5) / 10)
wifi = "\\u3" substr(tmp, 1, f) "\\u4" substr(tmp, 1+f, 10-f) "\\ur"
}
}
{
- print "\\l" wminfo "\\c" window "\\r" wifi " " battery " " mem " " cpu " " redshift "R\\ur " date " "
+ if(isnotebook && (length(window) > 70)) {
+ window2 = " " window
+ } else {
+ window2 = "\\c" window
+ }
+ print "\\l" wminfo window2 "\\r" wifi " " battery " " mem " " cpu " " redshift "R\\ur " date " "
fflush()
}
diff --git a/mybar/mybar.sh b/mybar/mybar.sh
index 5adc11e..c0380b5 100755
--- a/mybar/mybar.sh
+++ b/mybar/mybar.sh
@@ -56,6 +56,7 @@ update_cpu > "$BAR_FIFO" &
if test $(hostname) = "kch42-notebook"; then
update_bat > "$BAR_FIFO" &
update_wifi > "$BAR_FIFO" &
+ echo "isnotebook" > "$BAR_FIFO" &
fi
xtitle -sf 'window %s' > "$BAR_FIFO" &