For what it's worth: I am experiencing this on my Synology Diskstation DS212+ (armv5tel), but not on my notebook, which is more powerful.
A few observations:
- "read < file" returns with exit code 1 on zsh, if there is no newline in the file (and therefore not a whole "line" has been read). This has to be changed, either by adding a newline to the printf or by comparing the read value instead of setting it to 0 always in that case.
- there should be locking, either around the "tmux set" calls, or even better around the calls to byobu-status.
- the adjustment of width should probably only happen with $1=tmux_left, and not for tmux_right at nearly the same time. This might be true for most of the byobu-status script: with tmux, it gets called twice nearly at the same time, with different argument.
I am pasting the diff from me fiddling around with this code, for inspiration:
diff --git i/lib/byobu/usr/bin/byobu-status w/lib/byobu/usr/bin/byobu-status
index b3bec70..0e76660 100755
--- i/lib/byobu/usr/bin/byobu-status
+++ w/lib/byobu/usr/bin/byobu-status
@@ -36,17 +36,26 @@ for i in "${BYOBU_PREFIX}/share/$PKG/status/status" "${BYOBU_PREFIX}/share/$PKG/
done
# Fix status printing for small terminal sizes
+if [ "$1" = "tmux_left" ]; then
width=$(tmux list-windows -F "#{session_width}")
+if [ ! -e "$BYOBU_RUN_DIR/lock.set-width" ]; then
+ touch "$BYOBU_RUN_DIR/lock.set-width"
+ date >> /tmp/byobu.log
w_last=0
[ -r "$BYOBU_RUN_DIR/width" ] && read w_last < $BYOBU_RUN_DIR/width 2>/dev/null 1>&2 || w_last=0
for w in $width; do
+ echo $w / $w_last >> /tmp/byobu.log
if [ "$w" != "$w_last" ]; then tmux set -g status-left-length $(($w*1/4)) >/dev/null 2>&1
+ sleep 5 tmux set -g status-right-length $(($w*3/4)) >/dev/null 2>&1
- printf "$w" > $BYOBU_RUN_DIR/width
+ printf "$w\n" > $BYOBU_RUN_DIR/width # newline is important for read in zsh break
fi
done
+ rm "$BYOBU_RUN_DIR/lock.set-width"
+fi
+fi
case "$BYOBU_BACKEND" in
screen)
There is still a hangup of the "tmux set" call, but at least it does not pile up anymore and the status gets updated after all.
For what it's worth: I am experiencing this on my Synology Diskstation DS212+ (armv5tel), but not on my notebook, which is more powerful.
A few observations:
- "read < file" returns with exit code 1 on zsh, if there is no newline in the file (and therefore not a whole "line" has been read). This has to be changed, either by adding a newline to the printf or by comparing the read value instead of setting it to 0 always in that case.
- there should be locking, either around the "tmux set" calls, or even better around the calls to byobu-status.
- the adjustment of width should probably only happen with $1=tmux_left, and not for tmux_right at nearly the same time. This might be true for most of the byobu-status script: with tmux, it gets called twice nearly at the same time, with different argument.
I am pasting the diff from me fiddling around with this code, for inspiration:
diff --git i/lib/byobu/ usr/bin/ byobu-status w/lib/byobu/ usr/bin/ byobu-status usr/bin/ byobu-status usr/bin/ byobu-status PREFIX} /share/ $PKG/status/ status" "${BYOBU_ PREFIX} /share/ $PKG/
index b3bec70..0e76660 100755
--- i/lib/byobu/
+++ w/lib/byobu/
@@ -36,17 +36,26 @@ for i in "${BYOBU_
done
# Fix status printing for small terminal sizes RUN_DIR/ lock.set- width" ]; then RUN_DIR/ lock.set- width" RUN_DIR/ width" ] && read w_last < $BYOBU_ RUN_DIR/ width 2>/dev/null 1>&2 || w_last=0
tmux set -g status-left-length $(($w*1/4)) >/dev/null 2>&1
tmux set -g status-right-length $(($w*3/4)) >/dev/null 2>&1 RUN_DIR/ width RUN_DIR/ width # newline is important for read in zsh
break RUN_DIR/ lock.set- width"
+if [ "$1" = "tmux_left" ]; then
width=$(tmux list-windows -F "#{session_width}")
+if [ ! -e "$BYOBU_
+ touch "$BYOBU_
+ date >> /tmp/byobu.log
w_last=0
[ -r "$BYOBU_
for w in $width; do
+ echo $w / $w_last >> /tmp/byobu.log
if [ "$w" != "$w_last" ]; then
+ sleep 5
- printf "$w" > $BYOBU_
+ printf "$w\n" > $BYOBU_
fi
done
+ rm "$BYOBU_
+fi
+fi
case "$BYOBU_BACKEND" in
screen)
There is still a hangup of the "tmux set" call, but at least it does not pile up anymore and the status gets updated after all.