Merge lp:~jefferyto/byobu/openwrt into lp:byobu

Proposed by Jeffery To
Status: Merged
Merged at revision: 2612
Proposed branch: lp:~jefferyto/byobu/openwrt
Merge into: lp:byobu
Diff against target: 508 lines (+189/-42)
19 files modified
debian/changelog (+50/-0)
usr/bin/byobu-disable-prompt.in (+2/-0)
usr/bin/byobu-export.in (+7/-1)
usr/bin/byobu-janitor.in (+10/-2)
usr/bin/byobu-launch.in (+1/-1)
usr/bin/byobu.in (+5/-1)
usr/lib/byobu/disk_io (+1/-0)
usr/lib/byobu/hostname (+6/-2)
usr/lib/byobu/logo (+4/-0)
usr/lib/byobu/processes (+3/-3)
usr/lib/byobu/raid (+1/-0)
usr/lib/byobu/release (+1/-1)
usr/lib/byobu/services (+1/-1)
usr/lib/byobu/session (+1/-1)
usr/lib/byobu/updates_available (+20/-1)
usr/lib/byobu/users (+2/-2)
usr/lib/byobu/whoami (+18/-2)
usr/lib/byobu/wifi_quality (+50/-18)
usr/share/byobu/keybindings/f-keys.tmux (+6/-6)
To merge this branch: bzr merge lp:~jefferyto/byobu/openwrt
Reviewer Review Type Date Requested Status
Dustin Kirkland  Pending
Review via email: mp+367940@code.launchpad.net

Commit message

These changes are based on the patches I added to get byobu working on OpenWrt (https://github.com/openwrt/packages/commit/43c1b1b53cae8800f36d5411e6f0341f7849a200).

Only 2 changes (logo, updates_available) are OpenWrt-specific; the rest are more general fixes, e.g. fallbacks when a command-line utility is not available, more error handling, etc.

To post a comment you must log in.
Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Hi Jeffrey,

Thanks for contributing this. I'm okay with all of it, except for removing
the -k option from new-window. Why are you doing that?

@DustinKirkland

On Sun, May 26, 2019 at 2:29 PM Jeffery To <email address hidden> wrote:

> Jeffery To has proposed merging lp:~jefferyto/byobu/openwrt into lp:byobu.
>
> Commit message:
> These changes are based on the patches I added to get byobu working on
> OpenWrt (
> https://github.com/openwrt/packages/commit/43c1b1b53cae8800f36d5411e6f0341f7849a200
> ).
>
> Only 2 changes (logo, updates_available) are OpenWrt-specific; the rest
> are more general fixes, e.g. fallbacks when a command-line utility is not
> available, more error handling, etc.
>
> Requested reviews:
> Dustin Kirkland  (kirkland)
>
> For more details, see:
> https://code.launchpad.net/~jefferyto/byobu/openwrt/+merge/367940
> --
> You are requested to review the proposed merge of
> lp:~jefferyto/byobu/openwrt into lp:byobu.
>

Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Ah, nevermind, I see in your changelog. Okay, I'll give this a try.

Thanks,
@DustinKirkland

On Sat, Jun 1, 2019 at 3:48 PM Dustin Kirkland  <email address hidden>
wrote:

> Hi Jeffrey,
>
> Thanks for contributing this. I'm okay with all of it, except for removing
> the -k option from new-window. Why are you doing that?
>
> @DustinKirkland
>
>
> On Sun, May 26, 2019 at 2:29 PM Jeffery To <email address hidden> wrote:
>
> > Jeffery To has proposed merging lp:~jefferyto/byobu/openwrt into
> lp:byobu.
> >
> > Commit message:
> > These changes are based on the patches I added to get byobu working on
> > OpenWrt (
> >
> https://github.com/openwrt/packages/commit/43c1b1b53cae8800f36d5411e6f0341f7849a200
> > ).
> >
> > Only 2 changes (logo, updates_available) are OpenWrt-specific; the rest
> > are more general fixes, e.g. fallbacks when a command-line utility is not
> > available, more error handling, etc.
> >
> > Requested reviews:
> > Dustin Kirkland  (kirkland)
> >
> > For more details, see:
> > https://code.launchpad.net/~jefferyto/byobu/openwrt/+merge/367940
> > --
> > You are requested to review the proposed merge of
> > lp:~jefferyto/byobu/openwrt into lp:byobu.
> >
>
> --
> https://code.launchpad.net/~jefferyto/byobu/openwrt/+merge/367940
> You are requested to review the proposed merge of
> lp:~jefferyto/byobu/openwrt into lp:byobu.
>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2019-03-19 02:31:40 +0000
3+++ debian/changelog 2019-05-26 19:28:57 +0000
4@@ -1,5 +1,6 @@
5 byobu (5.128) unreleased; urgency=medium
6
7+ [ Dustin Kirkland ]
8 * usr/bin/ctail:
9 - Quotes are needed around "$@" to keep parameters from splitting
10 on spaces.
11@@ -18,6 +19,55 @@
12 All colors in command prompt should be escaped with [ ]
13 - https://github.com/dustinkirkland/byobu/pull/30
14
15+ [ Jeffery To ]
16+ * usr/bin/byobu-disable-prompt.in,
17+ usr/bin/byobu-janitor.in:
18+ - Test if $HOME/.bashrc exists before modifying it (and potentially
19+ creating it)
20+ * usr/bin/byobu-export.in:
21+ - Use echo if the gettext command is not available
22+ * usr/bin/byobu.in:
23+ - Use readlink if the tty command is not available
24+ * usr/bin/byobu-janitor.in:
25+ - Add fallback if the install command is not available
26+ * usr/bin/byobu-launch.in:
27+ - Don't autolaunch for ARM serial consoles
28+ * usr/lib/byobu/disk_io:
29+ - Ensure the detected mount point device exists
30+ * usr/lib/byobu/hostname:
31+ - Read from /proc/sys/kernel/hostname if the hostname command is not
32+ available
33+ * usr/lib/byobu/logo:
34+ - Add logo for OpenWrt
35+ * usr/lib/byobu/processes:
36+ - Handle stderr for ps, e.g. unsupported options
37+ - Remove unnecessary awk call; wc -l only outputs one value
38+ * usr/lib/byobu/raid:
39+ - Ensure /proc/mdstat is readable
40+ * usr/lib/byobu/release:
41+ - Fix typo
42+ * usr/lib/byobu/services:
43+ - Fix reading services from $BYOBU_CONFIG_DIR/statusrc
44+ * usr/lib/byobu/session:
45+ - Fix screen session regex
46+ * usr/lib/byobu/updates_available:
47+ - Add support for opkg (OpenWrt)
48+ * usr/lib/byobu/users:
49+ - Handle stderr for ps, e.g. unsupported options
50+ - Fix trailing '#' sign
51+ * usr/lib/byobu/whoami:
52+ - Use id if the whoami command is not available
53+ - Read from /etc/passwd if the getent command is not available
54+ * usr/lib/byobu/wifi_quality:
55+ - Add support for iw (preferred over iwconfig)
56+ - Make logic more similar to other status notifications
57+ * usr/share/byobu/keybindings/f-keys.tmux:
58+ - Remove -k for new-window. In older versions of tmux, -k without
59+ -t <target-window> had no effect. In tmux 2.8, -k without -t will
60+ not trigger a new window; the given command is executed in the
61+ current window instead.
62+ - Rename the new window created after adding a new session
63+
64 -- Dustin Kirkland <kirkland@ubuntu.com> Sun, 12 Aug 2018 11:37:11 -0500
65
66 byobu (5.127-0ubuntu1) cosmic; urgency=medium
67
68=== modified file 'usr/bin/byobu-disable-prompt.in'
69--- usr/bin/byobu-disable-prompt.in 2016-04-07 22:07:52 +0000
70+++ usr/bin/byobu-disable-prompt.in 2019-05-26 19:28:57 +0000
71@@ -22,6 +22,8 @@
72 [ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="@prefix@" || export BYOBU_PREFIX
73 . "${BYOBU_PREFIX}/lib/${PKG}/include/common"
74
75+[ -w "$HOME/.bashrc" ] || exit 1
76+
77 $BYOBU_SED_INLINE -e "/#byobu-prompt#$/d" "$HOME/.bashrc"
78
79 if [ "$1" != "--no-reload" ]; then
80
81=== modified file 'usr/bin/byobu-export.in'
82--- usr/bin/byobu-export.in 2016-04-07 22:07:52 +0000
83+++ usr/bin/byobu-export.in 2019-05-26 19:28:57 +0000
84@@ -22,7 +22,13 @@
85 [ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="@prefix@" || export BYOBU_PREFIX
86 . "${BYOBU_PREFIX}/lib/${PKG}/include/common"
87
88-gettext "
89+if eval $BYOBU_TEST gettext >/dev/null 2>&1; then
90+ command=gettext
91+else
92+ command=echo
93+fi
94+
95+$command "
96 The byobu-export utility is now deprecated.
97
98 To install byobu on a system for which byobu is not packaged, or
99
100=== modified file 'usr/bin/byobu-janitor.in'
101--- usr/bin/byobu-janitor.in 2018-08-12 14:02:17 +0000
102+++ usr/bin/byobu-janitor.in 2019-05-26 19:28:57 +0000
103@@ -41,7 +41,14 @@
104 PROFILE="$BYOBU_CONFIG_DIR/profile"
105
106 # Create byobu-exchange buffer file, with secure permissions, if it doesn't exist
107-[ -e "$BYOBU_RUN_DIR/printscreen" ] || install -m 600 /dev/null "$BYOBU_RUN_DIR/printscreen"
108+if ! [ -e "$BYOBU_RUN_DIR/printscreen" ]; then
109+ if eval $BYOBU_TEST install >/dev/null 2>&1; then
110+ install -m 600 /dev/null "$BYOBU_RUN_DIR/printscreen"
111+ else
112+ cp /dev/null "$BYOBU_RUN_DIR/printscreen"
113+ chmod 600 "$BYOBU_RUN_DIR/printscreen"
114+ fi
115+fi
116
117 # Affects: users who launched using sudo, such that their config dir
118 # is not writable by them
119@@ -112,7 +119,8 @@
120 rm -f "$FLAG" "/var/run/screen/S-$USER/$PKG.reload-required"
121
122 # Affects: Upgrades from <= byobu 5.50, install byobu prompt if using stock bashrc
123-if ! (grep -qs "#byobu-prompt#$" "$HOME/.bashrc") && ! [ -e "$BYOBU_CONFIG_DIR/prompt" ]; then
124+if [ -r /etc/skel/.bashrc ] && [ -r "$HOME/.bashrc" ] && [ -w "$HOME/.bashrc" ] && \
125+ ! (grep -qs "#byobu-prompt#$" "$HOME/.bashrc") && ! [ -e "$BYOBU_CONFIG_DIR/prompt" ]; then
126 if eval $BYOBU_TEST diff >/dev/null 2>&1; then
127 if diff /etc/skel/.bashrc "$HOME/.bashrc" >/dev/null 2>&1; then
128 printf "[ -r $BYOBU_CONFIG_DIR/prompt ] && . $BYOBU_CONFIG_DIR/prompt #byobu-prompt#\n" >> "$HOME/.bashrc"
129
130=== modified file 'usr/bin/byobu-launch.in'
131--- usr/bin/byobu-launch.in 2016-09-15 19:25:51 +0000
132+++ usr/bin/byobu-launch.in 2019-05-26 19:28:57 +0000
133@@ -31,7 +31,7 @@
134 # $HOME/.bashrc: export BYOBU_DISABLE=1
135
136 _tty=$(tty)
137-if [ "${_tty#/dev/ttyS}" != "$_tty" ]; then
138+if [ "${_tty#/dev/ttyS}" != "$_tty" ] && [ "${_tty#/dev/ttyAMA}" != "$_tty" ]; then
139 # Don't autolaunch byobu on serial consoles
140 # You can certainly run 'byobu' manually, though
141 echo
142
143=== modified file 'usr/bin/byobu.in'
144--- usr/bin/byobu.in 2018-08-12 16:37:11 +0000
145+++ usr/bin/byobu.in 2019-05-26 19:28:57 +0000
146@@ -62,7 +62,11 @@
147 export BYOBU_BACKEND
148
149 # Store the parent tty
150-export BYOBU_TTY=$(tty)
151+if eval $BYOBU_TEST tty >/dev/null 2>&1; then
152+ export BYOBU_TTY=$(tty)
153+else
154+ export BYOBU_TTY=$(readlink /proc/$$/fd/0)
155+fi
156
157 # Get the default window name
158 [ -n "$BYOBU_WINDOW_NAME" ] || BYOBU_WINDOW_NAME=-
159
160=== modified file 'usr/lib/byobu/disk_io'
161--- usr/lib/byobu/disk_io 2016-09-15 19:25:51 +0000
162+++ usr/lib/byobu/disk_io 2019-05-26 19:28:57 +0000
163@@ -50,6 +50,7 @@
164 /dev/*) part="${mount_point}";;
165 *) part=$(awk '$2 == mp { print $1 ; exit(0); }' "mp=$mount_point" /etc/mtab);;
166 esac
167+ [ -e "$part" ] || return
168 getdisk "$part"
169 local disk=${_RET}
170 local t2=$(date +%s) t1=
171
172=== modified file 'usr/lib/byobu/hostname'
173--- usr/lib/byobu/hostname 2016-04-07 22:07:52 +0000
174+++ usr/lib/byobu/hostname 2019-05-26 19:28:57 +0000
175@@ -20,12 +20,16 @@
176 # along with this program. If not, see <http://www.gnu.org/licenses/>.
177
178 __hostname_detail() {
179- hostname -f
180+ hostname -f 2>/dev/null
181 }
182
183 __hostname() {
184 local h=
185- h=$(hostname -s 2>/dev/null || hostname)
186+ if eval $BYOBU_TEST hostname >/dev/null 2>&1; then
187+ h=$(hostname -s 2>/dev/null || hostname)
188+ elif [ -r /proc/sys/kernel/hostname ]; then
189+ read h < /proc/sys/kernel/hostname
190+ fi
191 if metadata_available; then
192 local cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/hostname"
193 # Background a retrieval of our public hostname
194
195=== modified file 'usr/lib/byobu/logo'
196--- usr/lib/byobu/logo 2019-03-19 02:18:01 +0000
197+++ usr/lib/byobu/logo 2019-05-26 19:28:57 +0000
198@@ -111,6 +111,10 @@
199 logo=" lm "
200 $MARKUP && printf "$(color g w)$logo$(color -)$(color g w)$(color -) " || printf "$logo"
201 ;;
202+ *openwrt*)
203+ logo="OWrt"
204+ $MARKUP && printf "$(color b colour66 W)%s$(color -)" "$logo" || printf "$logo"
205+ ;;
206 *red*hat*|*rhel*)
207 logo=" RH "
208 $MARKUP && printf "$(color R k)%s$(color -)" "$logo" || printf "$logo"
209
210=== modified file 'usr/lib/byobu/processes'
211--- usr/lib/byobu/processes 2016-04-07 22:07:52 +0000
212+++ usr/lib/byobu/processes 2019-05-26 19:28:57 +0000
213@@ -20,15 +20,15 @@
214 # along with this program. If not, see <http://www.gnu.org/licenses/>.
215
216 __processes_detail() {
217- ps -ej
218+ ps -ej 2>/dev/null
219 }
220
221 __processes() {
222 local count=
223 if [ -r /proc ]; then
224- count=$(ls -d /proc/[0-9]* 2>/dev/null| wc -l)
225+ count=$(ls -d /proc/[0-9]* 2>/dev/null | wc -l)
226 else
227- count=$(ps -ef | wc -l | awk '{print $1}')
228+ count=$(ps -ef | wc -l)
229 fi
230 [ -n "$count" ] || return
231 color b y w; printf "%s" "$count"; color -; color y w; printf "&"; color --
232
233=== modified file 'usr/lib/byobu/raid'
234--- usr/lib/byobu/raid 2016-04-07 22:07:52 +0000
235+++ usr/lib/byobu/raid 2019-05-26 19:28:57 +0000
236@@ -24,6 +24,7 @@
237 }
238
239 __raid() {
240+ [ -r /proc/mdstat ] || return
241 while read line; do
242 local p msg
243 # Errors in your raid
244
245=== modified file 'usr/lib/byobu/release'
246--- usr/lib/byobu/release 2016-09-15 19:25:51 +0000
247+++ usr/lib/byobu/release 2019-05-26 19:28:57 +0000
248@@ -30,7 +30,7 @@
249 true
250 elif [ -r "/etc/os-release" ]; then
251 # lsb_release is *really* slow; try to use /etc/os-release
252- release=$(. /etc/os-release && echo "$VERSION_ID")
253+ RELEASE=$(. /etc/os-release && echo "$VERSION_ID")
254 elif [ -r "/etc/issue" ]; then
255 # next try /etc/issue first
256 local issue
257
258=== modified file 'usr/lib/byobu/services'
259--- usr/lib/byobu/services 2016-04-07 22:07:52 +0000
260+++ usr/lib/byobu/services 2019-05-26 19:28:57 +0000
261@@ -43,7 +43,7 @@
262 }
263
264 __services() {
265- local services=
266+ local services="$SERVICES"
267 # Users can define a list of services to monitor in $BYOBU_CONFIG_DIR/status
268 if [ -z "$services" ]; then
269 if [ -f "/etc/eucalyptus/eucalyptus.conf" ]; then
270
271=== modified file 'usr/lib/byobu/session'
272--- usr/lib/byobu/session 2018-04-11 21:00:52 +0000
273+++ usr/lib/byobu/session 2019-05-26 19:28:57 +0000
274@@ -34,7 +34,7 @@
275 fi
276 ;;
277 screen)
278- local count=$(screen -ls | grep "^ .*\)$" | wc -l)
279+ local count=$(screen -ls | grep "^\s\+.*)$" | wc -l)
280 if [ $count -gt 1 ]; then
281 color u W k; printf "${ICON_SESSION}%S"; color --
282 else
283
284=== modified file 'usr/lib/byobu/updates_available'
285--- usr/lib/byobu/updates_available 2018-05-27 19:58:28 +0000
286+++ usr/lib/byobu/updates_available 2019-05-26 19:28:57 +0000
287@@ -67,9 +67,16 @@
288 elif eval $BYOBU_TEST pacman >/dev/null; then
289 # If pacman (Archlinux) exists, use it
290 LC_ALL=C flock -xn "$flock" pacman -Sup | grep -vc "^\(::\| \)" >$mycache 2>/dev/null &
291+ elif eval $BYOBU_TEST opkg >/dev/null; then
292+ # If opkg (OpenWrt) exists, use it, also background if flock exists
293+ if eval $BYOBU_TEST flock >/dev/null; then
294+ flock -xn "$flock" opkg list-upgradable | wc -l >$mycache 2>/dev/null &
295+ else
296+ opkg list-upgradable | wc -l >$mycache &
297+ fi
298 elif eval $BYOBU_TEST brew >/dev/null; then
299 # If homebrew (Mac OSX) exists, use it, also background if flock exists
300- if eval $BYOBU_TEST flock; then
301+ if eval $BYOBU_TEST flock >/dev/null; then
302 flock -xn "$flock" brew outdated | wc -l >$mycache 2>/dev/null &
303 else
304 brew outdated | wc -l >$mycache &
305@@ -106,6 +113,18 @@
306 [ "$db" -nt "$mycache" ] && return 0
307 done
308 return 1
309+ elif eval $BYOBU_TEST opkg >/dev/null; then
310+ # OpenWrt
311+ [ ! -e /var/lock/opkg.lock ] || return 1
312+ if [ -d /var/opkg-lists ]; then
313+ [ /var/opkg-lists -nt "$mycache" ]
314+ return $?
315+ else
316+ local u s
317+ read u s < "$mycache"
318+ [ "$u" -gt 0 ]
319+ return $?
320+ fi
321 elif eval $BYOBU_TEST brew >/dev/null; then
322 # Mac OSX
323 # check if any new versions have been installed since
324
325=== modified file 'usr/lib/byobu/users'
326--- usr/lib/byobu/users 2016-04-07 22:07:52 +0000
327+++ usr/lib/byobu/users 2019-05-26 19:28:57 +0000
328@@ -22,7 +22,7 @@
329 # along with this program. If not, see <http://www.gnu.org/licenses/>.
330
331 __users_detail() {
332- ps -ef | grep "sshd:.*@" | grep -v grep
333+ ps -ef 2>/dev/null | grep "sshd:.*@" | grep -v grep
334 }
335
336 __users() {
337@@ -35,7 +35,7 @@
338 count=$(pgrep -f "^sshd:.*@|^/usr/sbin/sshd -i" | wc -l) || return
339 fi
340 if [ $count -gt 0 ]; then
341- color b w r; printf "%d" "$count"; color -; color w r; printf "#"; color --
342+ color b w r; printf "%d" "$count"; color -; color w r; printf "##"; color --
343 else
344 rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/users"*
345 fi
346
347=== modified file 'usr/lib/byobu/whoami'
348--- usr/lib/byobu/whoami 2016-04-07 22:07:52 +0000
349+++ usr/lib/byobu/whoami 2019-05-26 19:28:57 +0000
350@@ -19,12 +19,28 @@
351 # You should have received a copy of the GNU General Public License
352 # along with this program. If not, see <http://www.gnu.org/licenses/>.
353
354+___get_user() {
355+ if eval $BYOBU_TEST whoami >/dev/null 2>&1; then
356+ whoami
357+ elif eval $BYOBU_TEST id >/dev/null 2>&1; then
358+ id -un
359+ fi
360+}
361+
362 __whoami_detail() {
363- getent -- passwd "$USER"
364+ local user=$(___get_user)
365+ [ -n "$user" ] || return
366+ if eval $BYOBU_TEST getent >/dev/null 2>&1; then
367+ getent -- passwd "$user"
368+ else
369+ grep "^$user:" /etc/passwd
370+ fi
371 }
372
373 __whoami() {
374- color bold2; printf "%s@" "$(whoami)"; color -
375+ local user=$(___get_user)
376+ [ -n "$user" ] || return
377+ color bold2; printf "%s@" "$user"; color -
378 }
379
380 # vi: syntax=sh ts=4 noexpandtab
381
382=== modified file 'usr/lib/byobu/wifi_quality'
383--- usr/lib/byobu/wifi_quality 2016-04-07 22:07:52 +0000
384+++ usr/lib/byobu/wifi_quality 2019-05-26 19:28:57 +0000
385@@ -19,32 +19,64 @@
386 # You should have received a copy of the GNU General Public License
387 # along with this program. If not, see <http://www.gnu.org/licenses/>.
388
389+___get_dev_list() {
390+ if [ -n "$MONITORED_NETWORK" ]; then
391+ echo "$MONITORED_NETWORK"
392+ else
393+ iw dev | grep Interface | cut -f2 -d\
394+ fi
395+}
396+
397 __wifi_quality_detail() {
398- /sbin/iwconfig 2>/dev/null
399+ if eval $BYOBU_TEST iw >/dev/null 2>&1; then
400+ local dev
401+ for dev in $(___get_dev_list); do
402+ iw dev "$dev" info
403+ iw dev "$dev" link
404+ echo
405+ done
406+ elif eval $BYOBU_TEST iwconfig >/dev/null 2>&1; then
407+ iwconfig 2>/dev/null
408+ fi
409 }
410
411 __wifi_quality() {
412 local out bitrate quality
413- # iwconfig is expected to output lines like:
414- # Bit Rate=54 Mb/s Tx-Power=15 dBm
415- # Link Quality=60/70 Signal level=-50 dBm
416- # the awk below tokenizes the output and prints shell evalable results
417- out=`iwconfig $MONITORED_NETWORK 2>/dev/null |
418- awk '$0 ~ /[ ]*Link Quality./ {
419- sub(/.*=/,"",$2); split($2,a,"/");
420- printf "quality=%.0f\n", 100*a[1]/a[2] };
421- $0 ~ /[ ]*Bit Rate/ { sub(/.*[:=]/,"",$2); printf("bitrate=%s\n", $2); }
422- '`
423- eval "$out"
424- [ -z "$bitrate" ] && bitrate="0"
425- if [ -z "$quality" ] || [ "$quality" = "0" ]; then
426- quality="0"
427+ if eval $BYOBU_TEST iw >/dev/null 2>&1; then
428+ local dev
429+ for dev in $(___get_dev_list); do
430+ # iw is expected to output lines like:
431+ # signal: -50 dBm
432+ # rx bitrate: 216.0 MBit/s MCS 13 40MHz
433+ # signal to quality: https://superuser.com/a/1360447
434+ out=`iw dev "$dev" link 2>/dev/null |
435+ awk '$0 ~ /^\s*signal:/ { a = 100 * ($2 + 110) / 70;
436+ printf "quality=%.0f\n", (a > 100) ? 100 : ((a < 0) ? 0 : a); }
437+ $0 ~ /^\s*rx bitrate:/ { printf "bitrate=%s\n", $3; }
438+ '`
439+ eval "$out"
440+ [ -z "$bitrate" ] || [ -z "$quality" ] || break
441+ done
442+ elif eval $BYOBU_TEST iwconfig >/dev/null 2>&1; then
443+ # iwconfig is expected to output lines like:
444+ # Bit Rate=54 Mb/s Tx-Power=15 dBm
445+ # Link Quality=60/70 Signal level=-50 dBm
446+ # the awk below tokenizes the output and prints shell evalable results
447+ out=`iwconfig $MONITORED_NETWORK 2>/dev/null |
448+ awk '$0 ~ /[ ]*Link Quality./ {
449+ sub(/.*=/,"",$2); split($2,a,"/");
450+ printf "quality=%.0f\n", 100*a[1]/a[2] };
451+ $0 ~ /[ ]*Bit Rate/ { sub(/.*[:=]/,"",$2); printf("bitrate=%s\n", $2); }
452+ '`
453+ eval "$out"
454 fi
455- if [ "$bitrate" = "0" ] || [ "$quality" = "0" ] || [ -z "$bitrate" ] || [ -z "$quality"]; then
456+ [ -n "$bitrate" ] || bitrate=0
457+ [ -n "$quality" ] || quality=0
458+ if [ "$bitrate" -gt 0 ] && [ "$quality" -gt 0 ]; then
459+ printf "${ICON_WIFI}"; color b C k; printf "%s" "$bitrate"; color -; color C k; printf "%s" "$ICON_MBPS"; color -; color b C k; printf "%s" "$quality"; color -; color C k; printf "%s" "$PCT"; color --
460+ else
461 rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/wifi_quality"*
462- return
463 fi
464- printf "${ICON_WIFI}"; color b C k; printf "%s" "$bitrate"; color -; color C k; printf "%s" "$ICON_MBPS"; color -; color b C k; printf "%s" "$quality"; color -; color C k; printf "%s" "$PCT"; color --
465 }
466
467 # vi: syntax=sh ts=4 noexpandtab
468
469=== modified file 'usr/share/byobu/keybindings/f-keys.tmux'
470--- usr/share/byobu/keybindings/f-keys.tmux 2018-04-11 15:16:45 +0000
471+++ usr/share/byobu/keybindings/f-keys.tmux 2019-05-26 19:28:57 +0000
472@@ -26,12 +26,12 @@
473
474 # Byobu's Keybindings
475 # Documented in: $BYOBU_PREFIX/share/doc/byobu/help.tmux.txt
476-bind-key -n F1 new-window -k -n config byobu-config
477-bind-key -n S-F1 new-window -k -n help "sh -c '$BYOBU_PAGER $BYOBU_PREFIX/share/doc/byobu/help.tmux.txt'"
478+bind-key -n F1 new-window -n config byobu-config
479+bind-key -n S-F1 new-window -n help "sh -c '$BYOBU_PAGER $BYOBU_PREFIX/share/doc/byobu/help.tmux.txt'"
480 bind-key -n F2 new-window -c "#{pane_current_path}" \; rename-window "-"
481 bind-key -n C-F2 display-panes \; split-window -h -c "#{pane_current_path}"
482 bind-key -n S-F2 display-panes \; split-window -v -c "#{pane_current_path}"
483-bind-key -n C-S-F2 new-session
484+bind-key -n C-S-F2 new-session \; rename-window "-"
485 bind-key -n F3 previous-window
486 bind-key -n F4 next-window
487 bind-key -n M-Left previous-window
488@@ -54,7 +54,7 @@
489 bind-key -n M-S-Right resize-pane -R
490 bind-key -n F5 source $BYOBU_PREFIX/share/byobu/profiles/tmuxrc
491 bind-key -n M-F5 run-shell '$BYOBU_PREFIX/lib/byobu/include/toggle-utf8' \; source $BYOBU_PREFIX/share/byobu/profiles/tmuxrc
492-bind-key -n S-F5 new-window -k "$BYOBU_PREFIX/lib/byobu/include/cycle-status" \; source $BYOBU_PREFIX/share/byobu/profiles/tmuxrc
493+bind-key -n S-F5 new-window "$BYOBU_PREFIX/lib/byobu/include/cycle-status" \; source $BYOBU_PREFIX/share/byobu/profiles/tmuxrc
494 bind-key -n C-F5 send-keys ". $BYOBU_PREFIX/bin/byobu-reconnect-sockets" \; send-keys Enter
495 bind-key -n C-S-F5 new-window -d "byobu-select-profile -r"
496 bind-key -n F6 detach
497@@ -68,9 +68,9 @@
498 bind-key -n F8 command-prompt -p "(rename-window) " "rename-window '%%'"
499 bind-key -n C-F8 command-prompt -p "(rename-session) " "rename-session '%%'"
500 bind-key -n S-F8 next-layout
501-bind-key -n M-S-F8 new-window -k "byobu-layout restore; clear; $SHELL"
502+bind-key -n M-S-F8 new-window "byobu-layout restore; clear; $SHELL"
503 bind-key -n C-S-F8 command-prompt -p "Save byobu layout as:" "run-shell \"byobu-layout save '%%'\""
504-bind-key -n F9 new-window -k -n config byobu-config
505+bind-key -n F9 new-window -n config byobu-config
506 bind-key -n S-F9 command-prompt -p "Send command to all panes:" "run-shell \"$BYOBU_PREFIX/lib/byobu/include/tmux-send-command-to-all-panes '%%'\""
507 bind-key -n C-F9 command-prompt -p "Send command to all windows:" "run-shell \"$BYOBU_PREFIX/lib/byobu/include/tmux-send-command-to-all-windows '%%'\""
508 bind-key -n M-F9 display-panes \; setw synchronize-panes

Subscribers

People subscribed via source and target branches