mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-21 14:03:18 -07:00
* usr/bin/byobu-disable-prompt.in,
usr/bin/byobu-janitor.in: - Test if $HOME/.bashrc exists before modifying it (and potentially creating it) * usr/bin/byobu-export.in: - Use echo if the gettext command is not available * usr/bin/byobu.in: - Use readlink if the tty command is not available * usr/bin/byobu-janitor.in: - Add fallback if the install command is not available * usr/bin/byobu-launch.in: - Don't autolaunch for ARM serial consoles * usr/lib/byobu/disk_io: - Ensure the detected mount point device exists * usr/lib/byobu/hostname: - Read from /proc/sys/kernel/hostname if the hostname command is not available * usr/lib/byobu/logo: - Add logo for OpenWrt * usr/lib/byobu/processes: - Handle stderr for ps, e.g. unsupported options - Remove unnecessary awk call; wc -l only outputs one value * usr/lib/byobu/raid: - Ensure /proc/mdstat is readable * usr/lib/byobu/release: - Fix typo * usr/lib/byobu/services: - Fix reading services from $BYOBU_CONFIG_DIR/statusrc * usr/lib/byobu/session: - Fix screen session regex * usr/lib/byobu/updates_available: - Add support for opkg (OpenWrt) * usr/lib/byobu/users: - Handle stderr for ps, e.g. unsupported options - Fix trailing '#' sign * usr/lib/byobu/whoami: - Use id if the whoami command is not available - Read from /etc/passwd if the getent command is not available * usr/lib/byobu/wifi_quality: - Add support for iw (preferred over iwconfig) - Make logic more similar to other status notifications * usr/share/byobu/keybindings/f-keys.tmux: - Remove -k for new-window. In older versions of tmux, -k without -t <target-window> had no effect. In tmux 2.8, -k without -t will not trigger a new window; the given command is executed in the current window instead. - Rename the new window created after adding a new session
This commit is contained in:
commit
23d2a62a19
19 changed files with 189 additions and 42 deletions
50
debian/changelog
vendored
50
debian/changelog
vendored
|
@ -1,5 +1,6 @@
|
||||||
byobu (5.128) unreleased; urgency=medium
|
byobu (5.128) unreleased; urgency=medium
|
||||||
|
|
||||||
|
[ Dustin Kirkland ]
|
||||||
* usr/bin/ctail:
|
* usr/bin/ctail:
|
||||||
- Quotes are needed around "$@" to keep parameters from splitting
|
- Quotes are needed around "$@" to keep parameters from splitting
|
||||||
on spaces.
|
on spaces.
|
||||||
|
@ -18,6 +19,55 @@ byobu (5.128) unreleased; urgency=medium
|
||||||
All colors in command prompt should be escaped with [ ]
|
All colors in command prompt should be escaped with [ ]
|
||||||
- https://github.com/dustinkirkland/byobu/pull/30
|
- https://github.com/dustinkirkland/byobu/pull/30
|
||||||
|
|
||||||
|
[ Jeffery To ]
|
||||||
|
* usr/bin/byobu-disable-prompt.in,
|
||||||
|
usr/bin/byobu-janitor.in:
|
||||||
|
- Test if $HOME/.bashrc exists before modifying it (and potentially
|
||||||
|
creating it)
|
||||||
|
* usr/bin/byobu-export.in:
|
||||||
|
- Use echo if the gettext command is not available
|
||||||
|
* usr/bin/byobu.in:
|
||||||
|
- Use readlink if the tty command is not available
|
||||||
|
* usr/bin/byobu-janitor.in:
|
||||||
|
- Add fallback if the install command is not available
|
||||||
|
* usr/bin/byobu-launch.in:
|
||||||
|
- Don't autolaunch for ARM serial consoles
|
||||||
|
* usr/lib/byobu/disk_io:
|
||||||
|
- Ensure the detected mount point device exists
|
||||||
|
* usr/lib/byobu/hostname:
|
||||||
|
- Read from /proc/sys/kernel/hostname if the hostname command is not
|
||||||
|
available
|
||||||
|
* usr/lib/byobu/logo:
|
||||||
|
- Add logo for OpenWrt
|
||||||
|
* usr/lib/byobu/processes:
|
||||||
|
- Handle stderr for ps, e.g. unsupported options
|
||||||
|
- Remove unnecessary awk call; wc -l only outputs one value
|
||||||
|
* usr/lib/byobu/raid:
|
||||||
|
- Ensure /proc/mdstat is readable
|
||||||
|
* usr/lib/byobu/release:
|
||||||
|
- Fix typo
|
||||||
|
* usr/lib/byobu/services:
|
||||||
|
- Fix reading services from $BYOBU_CONFIG_DIR/statusrc
|
||||||
|
* usr/lib/byobu/session:
|
||||||
|
- Fix screen session regex
|
||||||
|
* usr/lib/byobu/updates_available:
|
||||||
|
- Add support for opkg (OpenWrt)
|
||||||
|
* usr/lib/byobu/users:
|
||||||
|
- Handle stderr for ps, e.g. unsupported options
|
||||||
|
- Fix trailing '#' sign
|
||||||
|
* usr/lib/byobu/whoami:
|
||||||
|
- Use id if the whoami command is not available
|
||||||
|
- Read from /etc/passwd if the getent command is not available
|
||||||
|
* usr/lib/byobu/wifi_quality:
|
||||||
|
- Add support for iw (preferred over iwconfig)
|
||||||
|
- Make logic more similar to other status notifications
|
||||||
|
* usr/share/byobu/keybindings/f-keys.tmux:
|
||||||
|
- Remove -k for new-window. In older versions of tmux, -k without
|
||||||
|
-t <target-window> had no effect. In tmux 2.8, -k without -t will
|
||||||
|
not trigger a new window; the given command is executed in the
|
||||||
|
current window instead.
|
||||||
|
- Rename the new window created after adding a new session
|
||||||
|
|
||||||
-- Dustin Kirkland <kirkland@ubuntu.com> Sun, 12 Aug 2018 11:37:11 -0500
|
-- Dustin Kirkland <kirkland@ubuntu.com> Sun, 12 Aug 2018 11:37:11 -0500
|
||||||
|
|
||||||
byobu (5.127-0ubuntu1) cosmic; urgency=medium
|
byobu (5.127-0ubuntu1) cosmic; urgency=medium
|
||||||
|
|
|
@ -22,6 +22,8 @@ PKG="byobu"
|
||||||
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="@prefix@" || export BYOBU_PREFIX
|
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="@prefix@" || export BYOBU_PREFIX
|
||||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
|
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
|
||||||
|
|
||||||
|
[ -w "$HOME/.bashrc" ] || exit 1
|
||||||
|
|
||||||
$BYOBU_SED_INLINE -e "/#byobu-prompt#$/d" "$HOME/.bashrc"
|
$BYOBU_SED_INLINE -e "/#byobu-prompt#$/d" "$HOME/.bashrc"
|
||||||
|
|
||||||
if [ "$1" != "--no-reload" ]; then
|
if [ "$1" != "--no-reload" ]; then
|
||||||
|
|
|
@ -22,7 +22,13 @@ PKG="byobu"
|
||||||
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="@prefix@" || export BYOBU_PREFIX
|
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="@prefix@" || export BYOBU_PREFIX
|
||||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
|
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
|
||||||
|
|
||||||
gettext "
|
if eval $BYOBU_TEST gettext >/dev/null 2>&1; then
|
||||||
|
command=gettext
|
||||||
|
else
|
||||||
|
command=echo
|
||||||
|
fi
|
||||||
|
|
||||||
|
$command "
|
||||||
The byobu-export utility is now deprecated.
|
The byobu-export utility is now deprecated.
|
||||||
|
|
||||||
To install byobu on a system for which byobu is not packaged, or
|
To install byobu on a system for which byobu is not packaged, or
|
||||||
|
|
|
@ -41,7 +41,14 @@ DEFAULT_PROFILE="light"
|
||||||
PROFILE="$BYOBU_CONFIG_DIR/profile"
|
PROFILE="$BYOBU_CONFIG_DIR/profile"
|
||||||
|
|
||||||
# Create byobu-exchange buffer file, with secure permissions, if it doesn't exist
|
# Create byobu-exchange buffer file, with secure permissions, if it doesn't exist
|
||||||
[ -e "$BYOBU_RUN_DIR/printscreen" ] || install -m 600 /dev/null "$BYOBU_RUN_DIR/printscreen"
|
if ! [ -e "$BYOBU_RUN_DIR/printscreen" ]; then
|
||||||
|
if eval $BYOBU_TEST install >/dev/null 2>&1; then
|
||||||
|
install -m 600 /dev/null "$BYOBU_RUN_DIR/printscreen"
|
||||||
|
else
|
||||||
|
cp /dev/null "$BYOBU_RUN_DIR/printscreen"
|
||||||
|
chmod 600 "$BYOBU_RUN_DIR/printscreen"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Affects: users who launched using sudo, such that their config dir
|
# Affects: users who launched using sudo, such that their config dir
|
||||||
# is not writable by them
|
# is not writable by them
|
||||||
|
@ -112,7 +119,8 @@ killall -u $USER byobu-statusd >/dev/null 2>&1 || true
|
||||||
rm -f "$FLAG" "/var/run/screen/S-$USER/$PKG.reload-required"
|
rm -f "$FLAG" "/var/run/screen/S-$USER/$PKG.reload-required"
|
||||||
|
|
||||||
# Affects: Upgrades from <= byobu 5.50, install byobu prompt if using stock bashrc
|
# Affects: Upgrades from <= byobu 5.50, install byobu prompt if using stock bashrc
|
||||||
if ! (grep -qs "#byobu-prompt#$" "$HOME/.bashrc") && ! [ -e "$BYOBU_CONFIG_DIR/prompt" ]; then
|
if [ -r /etc/skel/.bashrc ] && [ -r "$HOME/.bashrc" ] && [ -w "$HOME/.bashrc" ] && \
|
||||||
|
! (grep -qs "#byobu-prompt#$" "$HOME/.bashrc") && ! [ -e "$BYOBU_CONFIG_DIR/prompt" ]; then
|
||||||
if eval $BYOBU_TEST diff >/dev/null 2>&1; then
|
if eval $BYOBU_TEST diff >/dev/null 2>&1; then
|
||||||
if diff /etc/skel/.bashrc "$HOME/.bashrc" >/dev/null 2>&1; then
|
if diff /etc/skel/.bashrc "$HOME/.bashrc" >/dev/null 2>&1; then
|
||||||
printf "[ -r $BYOBU_CONFIG_DIR/prompt ] && . $BYOBU_CONFIG_DIR/prompt #byobu-prompt#\n" >> "$HOME/.bashrc"
|
printf "[ -r $BYOBU_CONFIG_DIR/prompt ] && . $BYOBU_CONFIG_DIR/prompt #byobu-prompt#\n" >> "$HOME/.bashrc"
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
# $HOME/.bashrc: export BYOBU_DISABLE=1
|
# $HOME/.bashrc: export BYOBU_DISABLE=1
|
||||||
|
|
||||||
_tty=$(tty)
|
_tty=$(tty)
|
||||||
if [ "${_tty#/dev/ttyS}" != "$_tty" ]; then
|
if [ "${_tty#/dev/ttyS}" != "$_tty" ] && [ "${_tty#/dev/ttyAMA}" != "$_tty" ]; then
|
||||||
# Don't autolaunch byobu on serial consoles
|
# Don't autolaunch byobu on serial consoles
|
||||||
# You can certainly run 'byobu' manually, though
|
# You can certainly run 'byobu' manually, though
|
||||||
echo
|
echo
|
||||||
|
|
|
@ -62,7 +62,11 @@ esac
|
||||||
export BYOBU_BACKEND
|
export BYOBU_BACKEND
|
||||||
|
|
||||||
# Store the parent tty
|
# Store the parent tty
|
||||||
export BYOBU_TTY=$(tty)
|
if eval $BYOBU_TEST tty >/dev/null 2>&1; then
|
||||||
|
export BYOBU_TTY=$(tty)
|
||||||
|
else
|
||||||
|
export BYOBU_TTY=$(readlink /proc/$$/fd/0)
|
||||||
|
fi
|
||||||
|
|
||||||
# Get the default window name
|
# Get the default window name
|
||||||
[ -n "$BYOBU_WINDOW_NAME" ] || BYOBU_WINDOW_NAME=-
|
[ -n "$BYOBU_WINDOW_NAME" ] || BYOBU_WINDOW_NAME=-
|
||||||
|
|
|
@ -50,6 +50,7 @@ __disk_io() {
|
||||||
/dev/*) part="${mount_point}";;
|
/dev/*) part="${mount_point}";;
|
||||||
*) part=$(awk '$2 == mp { print $1 ; exit(0); }' "mp=$mount_point" /etc/mtab);;
|
*) part=$(awk '$2 == mp { print $1 ; exit(0); }' "mp=$mount_point" /etc/mtab);;
|
||||||
esac
|
esac
|
||||||
|
[ -e "$part" ] || return
|
||||||
getdisk "$part"
|
getdisk "$part"
|
||||||
local disk=${_RET}
|
local disk=${_RET}
|
||||||
local t2=$(date +%s) t1=
|
local t2=$(date +%s) t1=
|
||||||
|
|
|
@ -20,12 +20,16 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
__hostname_detail() {
|
__hostname_detail() {
|
||||||
hostname -f
|
hostname -f 2>/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
__hostname() {
|
__hostname() {
|
||||||
local h=
|
local h=
|
||||||
h=$(hostname -s 2>/dev/null || hostname)
|
if eval $BYOBU_TEST hostname >/dev/null 2>&1; then
|
||||||
|
h=$(hostname -s 2>/dev/null || hostname)
|
||||||
|
elif [ -r /proc/sys/kernel/hostname ]; then
|
||||||
|
read h < /proc/sys/kernel/hostname
|
||||||
|
fi
|
||||||
if metadata_available; then
|
if metadata_available; then
|
||||||
local cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/hostname"
|
local cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/hostname"
|
||||||
# Background a retrieval of our public hostname
|
# Background a retrieval of our public hostname
|
||||||
|
|
|
@ -111,6 +111,10 @@ __logo() {
|
||||||
logo=" lm "
|
logo=" lm "
|
||||||
$MARKUP && printf "$(color g w)$logo$(color -)$(color g w)$(color -) " || printf "$logo"
|
$MARKUP && printf "$(color g w)$logo$(color -)$(color g w)$(color -) " || printf "$logo"
|
||||||
;;
|
;;
|
||||||
|
*openwrt*)
|
||||||
|
logo="OWrt"
|
||||||
|
$MARKUP && printf "$(color b colour66 W)%s$(color -)" "$logo" || printf "$logo"
|
||||||
|
;;
|
||||||
*red*hat*|*rhel*)
|
*red*hat*|*rhel*)
|
||||||
logo=" RH "
|
logo=" RH "
|
||||||
$MARKUP && printf "$(color R k)%s$(color -)" "$logo" || printf "$logo"
|
$MARKUP && printf "$(color R k)%s$(color -)" "$logo" || printf "$logo"
|
||||||
|
|
|
@ -20,15 +20,15 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
__processes_detail() {
|
__processes_detail() {
|
||||||
ps -ej
|
ps -ej 2>/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
__processes() {
|
__processes() {
|
||||||
local count=
|
local count=
|
||||||
if [ -r /proc ]; then
|
if [ -r /proc ]; then
|
||||||
count=$(ls -d /proc/[0-9]* 2>/dev/null| wc -l)
|
count=$(ls -d /proc/[0-9]* 2>/dev/null | wc -l)
|
||||||
else
|
else
|
||||||
count=$(ps -ef | wc -l | awk '{print $1}')
|
count=$(ps -ef | wc -l)
|
||||||
fi
|
fi
|
||||||
[ -n "$count" ] || return
|
[ -n "$count" ] || return
|
||||||
color b y w; printf "%s" "$count"; color -; color y w; printf "&"; color --
|
color b y w; printf "%s" "$count"; color -; color y w; printf "&"; color --
|
||||||
|
|
|
@ -24,6 +24,7 @@ __raid_detail() {
|
||||||
}
|
}
|
||||||
|
|
||||||
__raid() {
|
__raid() {
|
||||||
|
[ -r /proc/mdstat ] || return
|
||||||
while read line; do
|
while read line; do
|
||||||
local p msg
|
local p msg
|
||||||
# Errors in your raid
|
# Errors in your raid
|
||||||
|
|
|
@ -30,7 +30,7 @@ __release() {
|
||||||
true
|
true
|
||||||
elif [ -r "/etc/os-release" ]; then
|
elif [ -r "/etc/os-release" ]; then
|
||||||
# lsb_release is *really* slow; try to use /etc/os-release
|
# lsb_release is *really* slow; try to use /etc/os-release
|
||||||
release=$(. /etc/os-release && echo "$VERSION_ID")
|
RELEASE=$(. /etc/os-release && echo "$VERSION_ID")
|
||||||
elif [ -r "/etc/issue" ]; then
|
elif [ -r "/etc/issue" ]; then
|
||||||
# next try /etc/issue first
|
# next try /etc/issue first
|
||||||
local issue
|
local issue
|
||||||
|
|
|
@ -43,7 +43,7 @@ service_running() {
|
||||||
}
|
}
|
||||||
|
|
||||||
__services() {
|
__services() {
|
||||||
local services=
|
local services="$SERVICES"
|
||||||
# Users can define a list of services to monitor in $BYOBU_CONFIG_DIR/status
|
# Users can define a list of services to monitor in $BYOBU_CONFIG_DIR/status
|
||||||
if [ -z "$services" ]; then
|
if [ -z "$services" ]; then
|
||||||
if [ -f "/etc/eucalyptus/eucalyptus.conf" ]; then
|
if [ -f "/etc/eucalyptus/eucalyptus.conf" ]; then
|
||||||
|
|
|
@ -34,7 +34,7 @@ __session() {
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
screen)
|
screen)
|
||||||
local count=$(screen -ls | grep "^ .*\)$" | wc -l)
|
local count=$(screen -ls | grep "^\s\+.*)$" | wc -l)
|
||||||
if [ $count -gt 1 ]; then
|
if [ $count -gt 1 ]; then
|
||||||
color u W k; printf "${ICON_SESSION}%S"; color --
|
color u W k; printf "${ICON_SESSION}%S"; color --
|
||||||
else
|
else
|
||||||
|
|
|
@ -67,9 +67,16 @@ ___update_cache() {
|
||||||
elif eval $BYOBU_TEST pacman >/dev/null; then
|
elif eval $BYOBU_TEST pacman >/dev/null; then
|
||||||
# If pacman (Archlinux) exists, use it
|
# If pacman (Archlinux) exists, use it
|
||||||
LC_ALL=C flock -xn "$flock" pacman -Sup | grep -vc "^\(::\| \)" >$mycache 2>/dev/null &
|
LC_ALL=C flock -xn "$flock" pacman -Sup | grep -vc "^\(::\| \)" >$mycache 2>/dev/null &
|
||||||
|
elif eval $BYOBU_TEST opkg >/dev/null; then
|
||||||
|
# If opkg (OpenWrt) exists, use it, also background if flock exists
|
||||||
|
if eval $BYOBU_TEST flock >/dev/null; then
|
||||||
|
flock -xn "$flock" opkg list-upgradable | wc -l >$mycache 2>/dev/null &
|
||||||
|
else
|
||||||
|
opkg list-upgradable | wc -l >$mycache &
|
||||||
|
fi
|
||||||
elif eval $BYOBU_TEST brew >/dev/null; then
|
elif eval $BYOBU_TEST brew >/dev/null; then
|
||||||
# If homebrew (Mac OSX) exists, use it, also background if flock exists
|
# If homebrew (Mac OSX) exists, use it, also background if flock exists
|
||||||
if eval $BYOBU_TEST flock; then
|
if eval $BYOBU_TEST flock >/dev/null; then
|
||||||
flock -xn "$flock" brew outdated | wc -l >$mycache 2>/dev/null &
|
flock -xn "$flock" brew outdated | wc -l >$mycache 2>/dev/null &
|
||||||
else
|
else
|
||||||
brew outdated | wc -l >$mycache &
|
brew outdated | wc -l >$mycache &
|
||||||
|
@ -106,6 +113,18 @@ ___update_needed() {
|
||||||
[ "$db" -nt "$mycache" ] && return 0
|
[ "$db" -nt "$mycache" ] && return 0
|
||||||
done
|
done
|
||||||
return 1
|
return 1
|
||||||
|
elif eval $BYOBU_TEST opkg >/dev/null; then
|
||||||
|
# OpenWrt
|
||||||
|
[ ! -e /var/lock/opkg.lock ] || return 1
|
||||||
|
if [ -d /var/opkg-lists ]; then
|
||||||
|
[ /var/opkg-lists -nt "$mycache" ]
|
||||||
|
return $?
|
||||||
|
else
|
||||||
|
local u s
|
||||||
|
read u s < "$mycache"
|
||||||
|
[ "$u" -gt 0 ]
|
||||||
|
return $?
|
||||||
|
fi
|
||||||
elif eval $BYOBU_TEST brew >/dev/null; then
|
elif eval $BYOBU_TEST brew >/dev/null; then
|
||||||
# Mac OSX
|
# Mac OSX
|
||||||
# check if any new versions have been installed since
|
# check if any new versions have been installed since
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
__users_detail() {
|
__users_detail() {
|
||||||
ps -ef | grep "sshd:.*@" | grep -v grep
|
ps -ef 2>/dev/null | grep "sshd:.*@" | grep -v grep
|
||||||
}
|
}
|
||||||
|
|
||||||
__users() {
|
__users() {
|
||||||
|
@ -35,7 +35,7 @@ __users() {
|
||||||
count=$(pgrep -f "^sshd:.*@|^/usr/sbin/sshd -i" | wc -l) || return
|
count=$(pgrep -f "^sshd:.*@|^/usr/sbin/sshd -i" | wc -l) || return
|
||||||
fi
|
fi
|
||||||
if [ $count -gt 0 ]; then
|
if [ $count -gt 0 ]; then
|
||||||
color b w r; printf "%d" "$count"; color -; color w r; printf "#"; color --
|
color b w r; printf "%d" "$count"; color -; color w r; printf "##"; color --
|
||||||
else
|
else
|
||||||
rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/users"*
|
rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/users"*
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -19,12 +19,28 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
___get_user() {
|
||||||
|
if eval $BYOBU_TEST whoami >/dev/null 2>&1; then
|
||||||
|
whoami
|
||||||
|
elif eval $BYOBU_TEST id >/dev/null 2>&1; then
|
||||||
|
id -un
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
__whoami_detail() {
|
__whoami_detail() {
|
||||||
getent -- passwd "$USER"
|
local user=$(___get_user)
|
||||||
|
[ -n "$user" ] || return
|
||||||
|
if eval $BYOBU_TEST getent >/dev/null 2>&1; then
|
||||||
|
getent -- passwd "$user"
|
||||||
|
else
|
||||||
|
grep "^$user:" /etc/passwd
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
__whoami() {
|
__whoami() {
|
||||||
color bold2; printf "%s@" "$(whoami)"; color -
|
local user=$(___get_user)
|
||||||
|
[ -n "$user" ] || return
|
||||||
|
color bold2; printf "%s@" "$user"; color -
|
||||||
}
|
}
|
||||||
|
|
||||||
# vi: syntax=sh ts=4 noexpandtab
|
# vi: syntax=sh ts=4 noexpandtab
|
||||||
|
|
|
@ -19,32 +19,64 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
___get_dev_list() {
|
||||||
|
if [ -n "$MONITORED_NETWORK" ]; then
|
||||||
|
echo "$MONITORED_NETWORK"
|
||||||
|
else
|
||||||
|
iw dev | grep Interface | cut -f2 -d\
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
__wifi_quality_detail() {
|
__wifi_quality_detail() {
|
||||||
/sbin/iwconfig 2>/dev/null
|
if eval $BYOBU_TEST iw >/dev/null 2>&1; then
|
||||||
|
local dev
|
||||||
|
for dev in $(___get_dev_list); do
|
||||||
|
iw dev "$dev" info
|
||||||
|
iw dev "$dev" link
|
||||||
|
echo
|
||||||
|
done
|
||||||
|
elif eval $BYOBU_TEST iwconfig >/dev/null 2>&1; then
|
||||||
|
iwconfig 2>/dev/null
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
__wifi_quality() {
|
__wifi_quality() {
|
||||||
local out bitrate quality
|
local out bitrate quality
|
||||||
# iwconfig is expected to output lines like:
|
if eval $BYOBU_TEST iw >/dev/null 2>&1; then
|
||||||
# Bit Rate=54 Mb/s Tx-Power=15 dBm
|
local dev
|
||||||
# Link Quality=60/70 Signal level=-50 dBm
|
for dev in $(___get_dev_list); do
|
||||||
# the awk below tokenizes the output and prints shell evalable results
|
# iw is expected to output lines like:
|
||||||
out=`iwconfig $MONITORED_NETWORK 2>/dev/null |
|
# signal: -50 dBm
|
||||||
awk '$0 ~ /[ ]*Link Quality./ {
|
# rx bitrate: 216.0 MBit/s MCS 13 40MHz
|
||||||
sub(/.*=/,"",$2); split($2,a,"/");
|
# signal to quality: https://superuser.com/a/1360447
|
||||||
printf "quality=%.0f\n", 100*a[1]/a[2] };
|
out=`iw dev "$dev" link 2>/dev/null |
|
||||||
$0 ~ /[ ]*Bit Rate/ { sub(/.*[:=]/,"",$2); printf("bitrate=%s\n", $2); }
|
awk '$0 ~ /^\s*signal:/ { a = 100 * ($2 + 110) / 70;
|
||||||
'`
|
printf "quality=%.0f\n", (a > 100) ? 100 : ((a < 0) ? 0 : a); }
|
||||||
eval "$out"
|
$0 ~ /^\s*rx bitrate:/ { printf "bitrate=%s\n", $3; }
|
||||||
[ -z "$bitrate" ] && bitrate="0"
|
'`
|
||||||
if [ -z "$quality" ] || [ "$quality" = "0" ]; then
|
eval "$out"
|
||||||
quality="0"
|
[ -z "$bitrate" ] || [ -z "$quality" ] || break
|
||||||
|
done
|
||||||
|
elif eval $BYOBU_TEST iwconfig >/dev/null 2>&1; then
|
||||||
|
# iwconfig is expected to output lines like:
|
||||||
|
# Bit Rate=54 Mb/s Tx-Power=15 dBm
|
||||||
|
# Link Quality=60/70 Signal level=-50 dBm
|
||||||
|
# the awk below tokenizes the output and prints shell evalable results
|
||||||
|
out=`iwconfig $MONITORED_NETWORK 2>/dev/null |
|
||||||
|
awk '$0 ~ /[ ]*Link Quality./ {
|
||||||
|
sub(/.*=/,"",$2); split($2,a,"/");
|
||||||
|
printf "quality=%.0f\n", 100*a[1]/a[2] };
|
||||||
|
$0 ~ /[ ]*Bit Rate/ { sub(/.*[:=]/,"",$2); printf("bitrate=%s\n", $2); }
|
||||||
|
'`
|
||||||
|
eval "$out"
|
||||||
fi
|
fi
|
||||||
if [ "$bitrate" = "0" ] || [ "$quality" = "0" ] || [ -z "$bitrate" ] || [ -z "$quality"]; then
|
[ -n "$bitrate" ] || bitrate=0
|
||||||
|
[ -n "$quality" ] || quality=0
|
||||||
|
if [ "$bitrate" -gt 0 ] && [ "$quality" -gt 0 ]; then
|
||||||
|
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 --
|
||||||
|
else
|
||||||
rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/wifi_quality"*
|
rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/wifi_quality"*
|
||||||
return
|
|
||||||
fi
|
fi
|
||||||
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 --
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# vi: syntax=sh ts=4 noexpandtab
|
# vi: syntax=sh ts=4 noexpandtab
|
||||||
|
|
|
@ -26,12 +26,12 @@ source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.tmux.disable
|
||||||
|
|
||||||
# Byobu's Keybindings
|
# Byobu's Keybindings
|
||||||
# Documented in: $BYOBU_PREFIX/share/doc/byobu/help.tmux.txt
|
# Documented in: $BYOBU_PREFIX/share/doc/byobu/help.tmux.txt
|
||||||
bind-key -n F1 new-window -k -n config byobu-config
|
bind-key -n F1 new-window -n config byobu-config
|
||||||
bind-key -n S-F1 new-window -k -n help "sh -c '$BYOBU_PAGER $BYOBU_PREFIX/share/doc/byobu/help.tmux.txt'"
|
bind-key -n S-F1 new-window -n help "sh -c '$BYOBU_PAGER $BYOBU_PREFIX/share/doc/byobu/help.tmux.txt'"
|
||||||
bind-key -n F2 new-window -c "#{pane_current_path}" \; rename-window "-"
|
bind-key -n F2 new-window -c "#{pane_current_path}" \; rename-window "-"
|
||||||
bind-key -n C-F2 display-panes \; split-window -h -c "#{pane_current_path}"
|
bind-key -n C-F2 display-panes \; split-window -h -c "#{pane_current_path}"
|
||||||
bind-key -n S-F2 display-panes \; split-window -v -c "#{pane_current_path}"
|
bind-key -n S-F2 display-panes \; split-window -v -c "#{pane_current_path}"
|
||||||
bind-key -n C-S-F2 new-session
|
bind-key -n C-S-F2 new-session \; rename-window "-"
|
||||||
bind-key -n F3 previous-window
|
bind-key -n F3 previous-window
|
||||||
bind-key -n F4 next-window
|
bind-key -n F4 next-window
|
||||||
bind-key -n M-Left previous-window
|
bind-key -n M-Left previous-window
|
||||||
|
@ -54,7 +54,7 @@ bind-key -n M-S-Left resize-pane -L
|
||||||
bind-key -n M-S-Right resize-pane -R
|
bind-key -n M-S-Right resize-pane -R
|
||||||
bind-key -n F5 source $BYOBU_PREFIX/share/byobu/profiles/tmuxrc
|
bind-key -n F5 source $BYOBU_PREFIX/share/byobu/profiles/tmuxrc
|
||||||
bind-key -n M-F5 run-shell '$BYOBU_PREFIX/lib/byobu/include/toggle-utf8' \; source $BYOBU_PREFIX/share/byobu/profiles/tmuxrc
|
bind-key -n M-F5 run-shell '$BYOBU_PREFIX/lib/byobu/include/toggle-utf8' \; source $BYOBU_PREFIX/share/byobu/profiles/tmuxrc
|
||||||
bind-key -n S-F5 new-window -k "$BYOBU_PREFIX/lib/byobu/include/cycle-status" \; source $BYOBU_PREFIX/share/byobu/profiles/tmuxrc
|
bind-key -n S-F5 new-window "$BYOBU_PREFIX/lib/byobu/include/cycle-status" \; source $BYOBU_PREFIX/share/byobu/profiles/tmuxrc
|
||||||
bind-key -n C-F5 send-keys ". $BYOBU_PREFIX/bin/byobu-reconnect-sockets" \; send-keys Enter
|
bind-key -n C-F5 send-keys ". $BYOBU_PREFIX/bin/byobu-reconnect-sockets" \; send-keys Enter
|
||||||
bind-key -n C-S-F5 new-window -d "byobu-select-profile -r"
|
bind-key -n C-S-F5 new-window -d "byobu-select-profile -r"
|
||||||
bind-key -n F6 detach
|
bind-key -n F6 detach
|
||||||
|
@ -68,9 +68,9 @@ bind-key -n M-PPage copy-mode \; send-keys PPage
|
||||||
bind-key -n F8 command-prompt -p "(rename-window) " "rename-window '%%'"
|
bind-key -n F8 command-prompt -p "(rename-window) " "rename-window '%%'"
|
||||||
bind-key -n C-F8 command-prompt -p "(rename-session) " "rename-session '%%'"
|
bind-key -n C-F8 command-prompt -p "(rename-session) " "rename-session '%%'"
|
||||||
bind-key -n S-F8 next-layout
|
bind-key -n S-F8 next-layout
|
||||||
bind-key -n M-S-F8 new-window -k "byobu-layout restore; clear; $SHELL"
|
bind-key -n M-S-F8 new-window "byobu-layout restore; clear; $SHELL"
|
||||||
bind-key -n C-S-F8 command-prompt -p "Save byobu layout as:" "run-shell \"byobu-layout save '%%'\""
|
bind-key -n C-S-F8 command-prompt -p "Save byobu layout as:" "run-shell \"byobu-layout save '%%'\""
|
||||||
bind-key -n F9 new-window -k -n config byobu-config
|
bind-key -n F9 new-window -n config byobu-config
|
||||||
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 '%%'\""
|
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 '%%'\""
|
||||||
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 '%%'\""
|
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 '%%'\""
|
||||||
bind-key -n M-F9 display-panes \; setw synchronize-panes
|
bind-key -n M-F9 display-panes \; setw synchronize-panes
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue