最初コミット
このコミットが含まれているのは:
コミット
65d5fcdfd4
|
@ -0,0 +1,22 @@
|
|||
NAME=byobu
|
||||
# Linux = /usr, FreeBSD/OpenBSD = /usr/local, NetBSD = /usr/pkg
|
||||
PREFIX=/usr
|
||||
MANPREFIX=${PREFIX}/share/man
|
||||
|
||||
install: all
|
||||
mkdir -p ${DESTDIR}${PREFIX}/{bin,lib/${NAME},share/${NAME},share/man/man1}
|
||||
cp -f bin/* ${DESTDIR}${PREFIX}/bin
|
||||
cp -f lib/${NAME}/* ${DESTDIR}${PREFIX}/lib
|
||||
cp -f share/${NAME}/* ${DESTDIR}${PREFIX}/share
|
||||
chmod 755 ${DESTDIR}${PREFIX}/bin/${NAME}*
|
||||
chmod -R 755 ${DESTDIR}${PREFIX}/lib/${NAME}
|
||||
cp -f share/man/man1/${NAME}.1 ${DESTDIR}${MANPREFIX}/man1
|
||||
chmod 644 ${DESTDIR}${MANPREFIX}/man1/${NAME}.1
|
||||
|
||||
uninstall:
|
||||
rm -f ${DESTDIOR}${PREFIX}/bin/${NAME}*\
|
||||
${DESTDIR}${PREFIX}/lib/${NAME} \
|
||||
${DESTDIR}${PREFIX}/share/${NAME} \
|
||||
${DESTDIR}${MANPREFIX}/man1/${NAME}.1
|
||||
|
||||
.PHONY:install uninstall
|
|
@ -0,0 +1 @@
|
|||
元のbyobuはDebian向けらしい、だからArtix、CRUX、OpenBSD、及びFreeBSDでもうまく機能している間で変更した
|
|
@ -0,0 +1,263 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# byobu - wrapper script
|
||||
# Copyright (C) 2008-2009 Canonical Ltd.
|
||||
# Copyright (C) 2008-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
VERSION=5.133
|
||||
PKG="byobu"
|
||||
|
||||
# All sorts of things go wrong if you don't own your $HOME dir.
|
||||
# This happens under sudo, if you don't use the -H option; Byobu will
|
||||
# create a bunch of files in your $HOME which will be owned by root.
|
||||
if [ ! -O "$HOME" ]; then
|
||||
echo "Cannot run $PKG because [$USER] does not own [$HOME]" 1>&2
|
||||
if [ -n "$SUDO_USER" ]; then
|
||||
echo "To run $PKG under sudo, you MUST use 'sudo -H'" 1>&2
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Source local byobu config
|
||||
if [ -r "$HOME/.byoburc" ]; then
|
||||
# Ensure that this configuration is usable
|
||||
. "$HOME/.byoburc" || mv -f "$HOME/.byoburc" "$HOME/.byoburc".orig
|
||||
fi
|
||||
if [ -z "${BYOBU_PREFIX}" ]; then
|
||||
# Find and export the installation location prefix
|
||||
greadlink -f . >/dev/null 2>&1 && export BYOBU_READLINK="greadlink" || export BYOBU_READLINK="readlink"
|
||||
prefix="$(dirname $(dirname $($BYOBU_READLINK -f $0)))"
|
||||
if [ "$prefix" != "/usr" ]; then
|
||||
echo "export BYOBU_PREFIX='$prefix'" >> "$HOME/.byoburc"
|
||||
. "$HOME/.byoburc"
|
||||
fi
|
||||
fi
|
||||
export BYOBU_CHARMAP=$(locale charmap)
|
||||
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
|
||||
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
|
||||
|
||||
# Override backend if we can determine intentions from argv[0]
|
||||
[ -r "$HOME/.$PKG/backend" ] && . "$HOME/.$PKG/backend"
|
||||
case "$0" in
|
||||
*byobu-screen) BYOBU_BACKEND="screen" ;;
|
||||
*byobu-tmux) BYOBU_BACKEND="tmux" ;;
|
||||
esac
|
||||
|
||||
# At this point, we're sure BYOBU_BACKEND is properly defined
|
||||
export BYOBU_BACKEND
|
||||
|
||||
# Store the parent 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
|
||||
[ -n "$BYOBU_WINDOW_NAME" ] || BYOBU_WINDOW_NAME=-
|
||||
|
||||
# Add a version argument for debugging purposes, enter manpage for help
|
||||
if [ "$#" = "1" ]; then
|
||||
case "$1" in
|
||||
-v|--version)
|
||||
echo "$PKG version $VERSION"
|
||||
if eval $BYOBU_TEST bash >/dev/null 2>&1; then
|
||||
# Check ulimits
|
||||
u=$(bash -c "ulimit -n")
|
||||
[ "$u" = "unlimited" ] || [ $u -ge 15 ] || echo "WARNING: ulimit -n is too low" 1>&2
|
||||
u=$(bash -c "ulimit -u")
|
||||
[ "$u" = "unlimited" ] || [ $u -ge 1600 ] || echo "WARNING: ulimit -u is too low" 1>&2
|
||||
fi
|
||||
exec $BYOBU_BACKEND $BYOBU_ARG_VERSION
|
||||
exit 0
|
||||
;;
|
||||
-h|--help)
|
||||
exec man $PKG
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Check if we're being autolaunched, and this user explicitly does not want it.
|
||||
if [ "$0" = "/etc/profile.d/Z97-$PKG.sh" ] && [ -r "$BYOBU_CONFIG_DIR/disable-autolaunch" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Sanitize the environment
|
||||
byobu-janitor --force
|
||||
|
||||
# Set the window title if this is a TTY
|
||||
if [ -t 1 ]; then
|
||||
[ -r "$BYOBU_CONFIG_DIR/statusrc" ] && . "$BYOBU_CONFIG_DIR/statusrc"
|
||||
. $BYOBU_PREFIX/lib/$PKG/ip_address
|
||||
BYOBU_TITLE=${BYOBU_ALT_TITLE:-'${USER}@${HOSTNAME:-$(hostname)} ($(__ip_address t)) - ${PKG}'}
|
||||
[ -n "$BYOBU_NO_TITLE" ] || eval printf \"\\033\]0\;${BYOBU_TITLE}\\007\"
|
||||
fi
|
||||
|
||||
# Drop a symlink to the ssh socket in $HOME, since we can ensure that exists
|
||||
if [ -S "$SSH_AUTH_SOCK" ] && [ ! -h "$SSH_AUTH_SOCK" ]; then
|
||||
ln -sf "$SSH_AUTH_SOCK" "$BYOBU_CONFIG_DIR/.ssh-agent"
|
||||
export SSH_AUTH_SOCK="$BYOBU_CONFIG_DIR/.ssh-agent"
|
||||
fi
|
||||
|
||||
# Fallback terminfo
|
||||
[ -z "$BYOBU_DEFAULT_TERM" ] && BYOBU_DEFAULT_TERM="screen"
|
||||
|
||||
# Color terminfo to use, if possible
|
||||
[ -z "$BYOBU_COLOR_TERM" ] && BYOBU_COLOR_TERM="screen-256color"
|
||||
|
||||
# Check if our terminfo supports 256 colors
|
||||
CAN_SHOW_COLORS=
|
||||
if eval $BYOBU_TEST tput >/dev/null 2>&1; then
|
||||
if [ "$(tput colors 2>/dev/null || echo 0)" = "256" ]; then
|
||||
CAN_SHOW_COLORS=1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check if the color terminfo is available
|
||||
HAS_COLOR_TERM=
|
||||
if eval $BYOBU_TEST infocmp >/dev/null 2>&1; then
|
||||
if infocmp "$BYOBU_COLOR_TERM" >/dev/null 2>&1; then
|
||||
HAS_COLOR_TERM=1
|
||||
fi
|
||||
fi
|
||||
|
||||
case $BYOBU_BACKEND in
|
||||
tmux)
|
||||
# Use 256 colors if possible
|
||||
if [ -n "$CAN_SHOW_COLORS" ] || [ "$COLORTERM" = "gnome-terminal" ] || [ "$TERM" = "xterm" ] || [ "$TERM" = "xterm-256color" ] || [ "$TERM" = "screen" ]; then
|
||||
[ -z "$SCREEN_TERM" ] && SCREEN_TERM="-2"
|
||||
fi
|
||||
if [ -z "$BYOBU_TERM" ]; then
|
||||
if [ -n "$SCREEN_TERM" -a -n "$HAS_COLOR_TERM" ]; then
|
||||
BYOBU_TERM="$BYOBU_COLOR_TERM"
|
||||
else
|
||||
BYOBU_TERM="$BYOBU_DEFAULT_TERM"
|
||||
fi
|
||||
fi
|
||||
BYOBU_PROFILE="-f $BYOBU_PREFIX/share/$PKG/profiles/tmuxrc"
|
||||
# Set default window, unless user has overriden
|
||||
if egrep -qs "default-command|default-shell" $HOME/.$PKG/.tmux.conf >/dev/null 2>&1; then
|
||||
DEFAULT_WINDOW=
|
||||
else
|
||||
DEFAULT_WINDOW="new-session -n $BYOBU_WINDOW_NAME ${BYOBU_PREFIX}/bin/byobu-shell"
|
||||
fi
|
||||
sessions=$($BYOBU_BACKEND list-sessions 2>/dev/null) || true
|
||||
CUSTOM_WINDOW_SET=0
|
||||
if [ -s "$BYOBU_CONFIG_DIR/windows.tmux.$BYOBU_WINDOWS" ]; then
|
||||
CUSTOM_WINDOW_SET=1
|
||||
BYOBU_WINDOWS="$BYOBU_CONFIG_DIR/windows.tmux.$BYOBU_WINDOWS"
|
||||
elif [ -s "$BYOBU_CONFIG_DIR/windows.tmux" ]; then
|
||||
CUSTOM_WINDOW_SET=1
|
||||
BYOBU_WINDOWS="$BYOBU_CONFIG_DIR/windows.tmux"
|
||||
fi
|
||||
;;
|
||||
screen)
|
||||
# Allow override of default window list, with BYOBU_WINDOWS environment variable
|
||||
CUSTOM_WINDOW_SET=0
|
||||
if [ -s "$BYOBU_WINDOWS" ]; then
|
||||
CUSTOM_WINDOW_SET=1
|
||||
elif [ -s "$BYOBU_CONFIG_DIR/windows.$BYOBU_WINDOWS" ]; then
|
||||
CUSTOM_WINDOW_SET=1
|
||||
BYOBU_WINDOWS="$BYOBU_CONFIG_DIR/windows.$BYOBU_WINDOWS"
|
||||
elif [ "$#" = "0" ]; then
|
||||
BYOBU_WINDOWS="$BYOBU_CONFIG_DIR/windows"
|
||||
else
|
||||
BYOBU_WINDOWS="/dev/null"
|
||||
fi
|
||||
export BYOBU_WINDOWS
|
||||
# Launch shell, unless the user has default windows set to launch
|
||||
uncommented_lines < "$BYOBU_WINDOWS" && DEFAULT_WINDOW= || DEFAULT_WINDOW="${BYOBU_PREFIX}/bin/byobu-shell"
|
||||
# Use 256 colors if possible
|
||||
if [ -z "$BYOBU_TERM" ]; then
|
||||
if [ -n "$CAN_SHOW_COLORS" -a -n "$HAS_COLOR_TERM" ]; then
|
||||
BYOBU_TERM="$BYOBU_COLOR_TERM"
|
||||
else
|
||||
BYOBU_TERM="$BYOBU_DEFAULT_TERM"
|
||||
fi
|
||||
fi
|
||||
SCREEN_TERM="-T $BYOBU_TERM"
|
||||
# Some users want to maintain separate configurations
|
||||
# if they use both GNU Screen and byobu on the same system
|
||||
if [ -r "$BYOBU_CONFIG_DIR/.screenrc" ]; then
|
||||
BYOBU_PROFILE="-c $BYOBU_PREFIX/share/$PKG/profiles/byoburc"
|
||||
else
|
||||
BYOBU_PROFILE="-c $BYOBU_PREFIX/share/$PKG/profiles/screenrc"
|
||||
fi
|
||||
BYOBU_SESSION_NAME="-S $PKG"
|
||||
# Zero out $BYOBU_SESSION_NAME if user has specified a session name
|
||||
for i in "$@"; do
|
||||
case $i in
|
||||
-*r*|-*d*|-*D*|-*S*|-ls|-list)
|
||||
BYOBU_SESSION_NAME=
|
||||
;;
|
||||
esac
|
||||
done
|
||||
sessions=$($BYOBU_BACKEND -wipe 2>/dev/null) || true
|
||||
;;
|
||||
esac
|
||||
|
||||
export BYOBU_TERM
|
||||
|
||||
# Save session info
|
||||
[ -n "$DBUS_SESSION_BUS_ADDRESS" ] && printf "DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS\n" > "$BYOBU_RUN_DIR/sockets"
|
||||
[ -n "$SESSION_MANAGER" ] && printf "SESSION_MANAGER=$SESSION_MANAGER\n" >> "$BYOBU_RUN_DIR/sockets"
|
||||
|
||||
# Now let's execute the backend!
|
||||
if [ "$#" = "0" ]; then
|
||||
if [ "$CUSTOM_WINDOW_SET" = "1" ]; then
|
||||
# Start new custom window set session
|
||||
case $BYOBU_BACKEND in
|
||||
tmux)
|
||||
exec tmux -u $SCREEN_TERM $BYOBU_PROFILE $(cat "$BYOBU_WINDOWS")
|
||||
;;
|
||||
screen)
|
||||
exec screen $SCREEN_TERM $BYOBU_SESSION_NAME $BYOBU_PROFILE
|
||||
;;
|
||||
esac
|
||||
else
|
||||
case "$sessions" in
|
||||
*\(*\)*)
|
||||
# Select and attach to an existing session
|
||||
exec byobu-select-session
|
||||
;;
|
||||
*)
|
||||
# Start new default session
|
||||
case $BYOBU_BACKEND in
|
||||
tmux)
|
||||
exec tmux -u $SCREEN_TERM $BYOBU_PROFILE $DEFAULT_WINDOW
|
||||
;;
|
||||
screen)
|
||||
exec screen $SCREEN_TERM $BYOBU_SESSION_NAME $BYOBU_PROFILE $DEFAULT_WINDOW
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
else
|
||||
# Launch with command line args
|
||||
case $BYOBU_BACKEND in
|
||||
tmux)
|
||||
exec tmux -u $SCREEN_TERM $BYOBU_PROFILE "$@"
|
||||
;;
|
||||
screen)
|
||||
exec screen $SCREEN_TERM $BYOBU_SESSION_NAME $BYOBU_PROFILE "$@"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# byobu-config - interactive byobu configuration wrapper script
|
||||
# Copyright (C) 2013-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
PKG="byobu"
|
||||
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
|
||||
|
||||
${BYOBU_PYTHON} "${BYOBU_PREFIX}/lib/${PKG}/include/config.py"
|
|
@ -0,0 +1,150 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# byobu-ctrl-a - set the ctrl-a behavior
|
||||
# Copyright (C) 2011 Canonical Ltd.
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Usage() {
|
||||
cat <<EOF
|
||||
Usage: ${0##*/} [mode]
|
||||
mode is one of 'screen' or 'emacs'
|
||||
if not specified, prompt the user
|
||||
EOF
|
||||
}
|
||||
|
||||
PKG="byobu"
|
||||
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
|
||||
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
|
||||
|
||||
bind_to=""
|
||||
keybindings="$BYOBU_CONFIG_DIR/keybindings"
|
||||
[ "$BYOBU_BACKEND" = "tmux" ] && keybindings="$keybindings.tmux"
|
||||
touch "$keybindings"
|
||||
|
||||
# If the user has already chosen an escape sequence, then
|
||||
# presumably they want ctrl-a to operate in emacs mode
|
||||
case "$BYOBU_BACKEND" in
|
||||
"screen")
|
||||
if grep -qs "^escape" "$keybindings"; then
|
||||
# Check for escape definition in local keybindings config
|
||||
bind_to="emacs"
|
||||
fi
|
||||
;;
|
||||
"tmux")
|
||||
if grep -qs "^set -g prefix" "$keybindings"e; then
|
||||
# Check for escape definition in local keybindings config
|
||||
bind_to="emacs"
|
||||
fi
|
||||
# Check for some other escape sequence in tmux keys
|
||||
if $BYOBU_BACKEND list-keys 2>/dev/null | grep -qs "^bind-key\s\+[^a]\s\+send-prefix"; then
|
||||
bind_to="emacs"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
case "${1}" in
|
||||
-h|--help) Usage; exit 0;;
|
||||
screen) bind_to="screen";;
|
||||
emacs) bind_to="emacs";;
|
||||
"") :;;
|
||||
*) { Usage printf "%s\n" "Bad argument $1"; } 1>&2; exit 1;;
|
||||
esac
|
||||
|
||||
if [ "${2}" ]; then
|
||||
KEY=$(printf "$2" | $BYOBU_SED 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/')
|
||||
key=$(printf "$2" | $BYOBU_SED 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')
|
||||
else
|
||||
KEY="A"
|
||||
key="a"
|
||||
fi
|
||||
|
||||
while [ -z "$bind_to" ]; do
|
||||
echo
|
||||
echo "Configure Byobu's ctrl-a behavior..."
|
||||
echo
|
||||
echo "When you press ctrl-a in Byobu, do you want it to operate in:"
|
||||
echo " (1) Screen mode (GNU Screen's default escape sequence)"
|
||||
echo " (2) Emacs mode (go to beginning of line)"
|
||||
echo
|
||||
echo "Note that:"
|
||||
echo " - F12 also operates as an escape in Byobu"
|
||||
echo " - You can press F9 and choose your escape character"
|
||||
echo " - You can run 'byobu-ctrl-a' at any time to change your selection"
|
||||
echo
|
||||
printf "Select [1 or 2]: "
|
||||
s=$(head -n1)
|
||||
echo
|
||||
case "$s" in
|
||||
1) bind_to="screen"; break;;
|
||||
2) bind_to="emacs"; break;;
|
||||
esac
|
||||
done
|
||||
|
||||
case "$bind_to" in
|
||||
emacs)
|
||||
case "$BYOBU_BACKEND" in
|
||||
screen)
|
||||
$BYOBU_SED_INLINE -e "/^register x /d" -e "/^bindkey /d" -e "/^escape /d" "$keybindings"
|
||||
echo "bindkey \"^${KEY}\"" >> "$keybindings"
|
||||
$BYOBU_BACKEND -X at 0 source "$BYOBU_CONFIG_DIR/profile"
|
||||
;;
|
||||
tmux)
|
||||
$BYOBU_SED_INLINE -e "/^set -g prefix/d" -e "/ send-prefix/d" -e "/^unbind-key -n C-${key}/d" "$keybindings"
|
||||
echo "set -g prefix F12" >> "$keybindings"
|
||||
echo "unbind-key -n C-${key}" >> "$keybindings"
|
||||
$BYOBU_BACKEND source "$BYOBU_PREFIX/share/byobu/profiles/tmuxrc" 2>/dev/null
|
||||
;;
|
||||
esac
|
||||
echo "INFO: ctrl-a will now operate in emacs mode"
|
||||
;;
|
||||
screen)
|
||||
case "$BYOBU_BACKEND" in
|
||||
screen)
|
||||
$BYOBU_SED_INLINE -e "/^register x /d" -e "/^bindkey \"^\"/d" -e "/^escape /d" "$keybindings"
|
||||
echo "bindkey \"^${KEY}\"" >> "$keybindings"
|
||||
echo "escape \"^${KEY}${key}\"" >> "$keybindings"
|
||||
echo "register x \"^${KEY}\"" >> "$keybindings"
|
||||
$BYOBU_BACKEND -X at 0 source "$BYOBU_CONFIG_DIR/profile"
|
||||
;;
|
||||
tmux)
|
||||
$BYOBU_SED_INLINE -e "/^set -g prefix/d" -e "/ send-prefix/d" -e "/^unbind-key -n C-${key}/d" "$keybindings"
|
||||
echo "unbind-key -n C-${key}" >> "$keybindings"
|
||||
if $BYOBU_BACKEND -V | grep " 1.5"; then
|
||||
# tmux 1.5 supports a list of prefixes
|
||||
echo "set -g prefix ^${KEY},F12" >> "$keybindings"
|
||||
else
|
||||
# tmux 1.6 and above supports prefix and prefix2
|
||||
echo "set -g prefix ^${KEY}" >> "$keybindings"
|
||||
echo "set -g prefix2 F12" >> "$keybindings"
|
||||
fi
|
||||
echo "bind ${key} send-prefix" >> "$keybindings"
|
||||
$BYOBU_BACKEND source "$BYOBU_PREFIX/share/byobu/profiles/tmuxrc" 2>/dev/null
|
||||
;;
|
||||
esac
|
||||
echo "INFO: ctrl-a will now operate in GNU Screen mode"
|
||||
;;
|
||||
*)
|
||||
echo "Error: bad value for binding: $bind_to"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "${2}" ]; then
|
||||
echo "To modify this behavior again later, run 'byobu-ctrl-a'"
|
||||
echo
|
||||
fi
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,41 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# byobu-disable: disable byobu at login
|
||||
# Copyright (C) 2010 Canonical Ltd.
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
PKG="byobu"
|
||||
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
|
||||
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
|
||||
|
||||
byobu-launcher-uninstall
|
||||
|
||||
echo
|
||||
echo "The Byobu window manager will no longer be launched automatically at login."
|
||||
echo
|
||||
echo "To re-enable this behavior later, just run:"
|
||||
echo " byobu-enable"
|
||||
echo
|
||||
|
||||
# If we're in a byobu session, let's exit that too
|
||||
case "$STY" in
|
||||
*byobu)
|
||||
$BYOBU_BACKEND -X at 0 quit
|
||||
;;
|
||||
esac
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,40 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# byobu-disable-prompt
|
||||
# Copyright (C) 2013-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
PKG="byobu"
|
||||
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
|
||||
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
|
||||
|
||||
[ -w "$HOME/.bashrc" ] || exit 1
|
||||
|
||||
$BYOBU_SED_INLINE -e "/#byobu-prompt#$/d" "$HOME/.bashrc"
|
||||
|
||||
if [ "$1" != "--no-reload" ]; then
|
||||
if [ -n "$TMUX" ] && [ "$SHELL" = "/bin/bash" ]; then
|
||||
tmux send-keys " . ~/.bashrc" \; send-keys Enter
|
||||
else
|
||||
echo
|
||||
echo "You will need to reload your shell configuration for this to take effect..."
|
||||
echo " . ~/.bashrc"
|
||||
echo
|
||||
fi
|
||||
fi
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,34 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# byobu-enable: enable launch byobu at login
|
||||
# Copyright (C) 2010 Canonical Ltd.
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
PKG="byobu"
|
||||
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
|
||||
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
|
||||
|
||||
byobu-launcher-install
|
||||
|
||||
echo
|
||||
echo "The Byobu window manager will be launched automatically at each text login."
|
||||
echo
|
||||
echo "To disable this behavior later, just run:"
|
||||
echo " byobu-disable"
|
||||
echo
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,42 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# byobu-enable-prompt
|
||||
# Copyright (C) 2013-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
[ "$SHELL" = "/bin/bash" ] || exit 1
|
||||
|
||||
PKG="byobu"
|
||||
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
|
||||
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
|
||||
|
||||
|
||||
prompt="${BYOBU_CONFIG_DIR}/prompt"
|
||||
printf ". ${BYOBU_PREFIX}/share/${PKG}/profiles/bashrc #byobu-prompt#\n" > "$prompt"
|
||||
$PKG-disable-prompt --no-reload "$1" || true
|
||||
printf "[ -r $prompt ] && . $prompt #byobu-prompt#\n" >> "$HOME/.bashrc"
|
||||
|
||||
if [ -n "$TMUX" ]; then
|
||||
tmux send-keys " . ~/.bashrc" \; send-keys Enter
|
||||
else
|
||||
echo
|
||||
echo "You will need to reload your shell configuration for this to take effect..."
|
||||
echo " . ~/.bashrc"
|
||||
echo
|
||||
fi
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,42 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# byobu-export
|
||||
# Copyright (C) 2008-2010 Canonical Ltd.
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
PKG="byobu"
|
||||
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
|
||||
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
|
||||
|
||||
if eval $BYOBU_TEST gettext >/dev/null 2>&1; then
|
||||
command=gettext
|
||||
else
|
||||
command=echo
|
||||
fi
|
||||
|
||||
$command "
|
||||
The byobu-export utility is now deprecated.
|
||||
|
||||
To install byobu on a system for which byobu is not packaged, or
|
||||
where you are not the root user, simply:
|
||||
* Download the latest release (>= 3.0) from:
|
||||
https://launchpad.net/byobu/+download
|
||||
* And follow the instructions in the README
|
||||
|
||||
"
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,139 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# byobu-janitor - a collection of byobu tasks that ensure a clean
|
||||
# environtment and smooth upgrades
|
||||
#
|
||||
# Copyright (C) 2009 Canonical Ltd.
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
PKG="byobu"
|
||||
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
|
||||
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
|
||||
|
||||
# Ensure that all updates get run immediately
|
||||
rm -rf "$BYOBU_RUN_DIR/.last.$BYOBU_BACKEND"
|
||||
|
||||
# Ensure that we re-check metadata service
|
||||
rm -f "$BYOBU_CONFIG_DIR/.metadata_available" "$BYOBU_RUN_DIR/.metadata_available"
|
||||
|
||||
# Exit immediately, if we're not forced, and there is no reload flag
|
||||
FLAG="$BYOBU_RUN_DIR/reload-required"
|
||||
if [ "$1" != "--force" ] && [ ! -e "$FLAG" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Set the rest of the variables
|
||||
DEFAULT_PROFILE="light"
|
||||
PROFILE="$BYOBU_CONFIG_DIR/profile"
|
||||
|
||||
# Create byobu-exchange buffer file, with secure permissions, if it doesn't exist
|
||||
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
|
||||
# is not writable by them
|
||||
if [ -d "$BYOBU_CONFIG_DIR" ] && [ ! -w "$BYOBU_CONFIG_DIR" ]; then
|
||||
echo "ERROR: [$BYOBU_CONFIG_DIR] is not writable by the current user" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Affects: Upgrades from <= byobu 4.30
|
||||
# Clear out old style status configuration
|
||||
if ! grep -qs "^screen_upper_left=" "$BYOBU_CONFIG_DIR/status"; then
|
||||
rm -f "$BYOBU_CONFIG_DIR/status" "$BYOBU_CONFIG_DIR/statusrc"
|
||||
fi
|
||||
|
||||
# NOTE: Older version of Screen have an arbitrary limit of only being able
|
||||
# to change colors 16 times in this 'hardstatus string'.
|
||||
# Also committed in Upstream git, but not yet released.
|
||||
# * http://savannah.gnu.org/bugs/?22146
|
||||
# If we could reliably tell if we had a patched screen, we'd do so here...
|
||||
MC=0
|
||||
|
||||
# Affects: First runs with no configuration
|
||||
# Seed the configuration
|
||||
# Setup initial local user configuration
|
||||
[ -r "$BYOBU_CONFIG_DIR/color" ] || printf "BACKGROUND=k\nFOREGROUND=w\nMONOCHROME=$MC" > "$BYOBU_CONFIG_DIR/color"
|
||||
[ -r "$BYOBU_CONFIG_DIR/color.tmux" ] || sed -e "s/^#.*//" -e "/^\s*$/d" -e "s/^export //" "$BYOBU_PREFIX/lib/$PKG/include/colors" > "$BYOBU_CONFIG_DIR/color.tmux"
|
||||
[ -r "$BYOBU_CONFIG_DIR/datetime.tmux" ] || printf 'BYOBU_DATE="%%Y-%%m-%%d "\nBYOBU_TIME="%%H:%%M:%%S"\n' > "$BYOBU_CONFIG_DIR/datetime.tmux"
|
||||
[ -r "$BYOBU_CONFIG_DIR/profile" ] || echo "source \$BYOBU_PREFIX/share/$PKG/profiles/common" > "$BYOBU_CONFIG_DIR/profile"
|
||||
[ -r "$BYOBU_CONFIG_DIR/profile.tmux" ] || echo "source \$BYOBU_PREFIX/share/$PKG/profiles/tmux" > "$BYOBU_CONFIG_DIR/profile.tmux"
|
||||
[ -r "$BYOBU_CONFIG_DIR/keybindings" ] || echo "source \$BYOBU_PREFIX/share/$PKG/keybindings/common" > "$BYOBU_CONFIG_DIR/keybindings"
|
||||
[ -r "$BYOBU_CONFIG_DIR/keybindings.tmux" ] || touch "$BYOBU_CONFIG_DIR/keybindings.tmux"
|
||||
[ -r "$BYOBU_CONFIG_DIR/windows" ] || touch "$BYOBU_CONFIG_DIR/windows"
|
||||
[ -r "$BYOBU_CONFIG_DIR/windows.tmux" ] || touch "$BYOBU_CONFIG_DIR/windows.tmux"
|
||||
[ -r "$BYOBU_CONFIG_DIR/backend" ] || echo "BYOBU_BACKEND=$BYOBU_BACKEND" > "$BYOBU_CONFIG_DIR/backend"
|
||||
[ -r "$BYOBU_CONFIG_DIR/.screenrc" ] || touch "$BYOBU_CONFIG_DIR/.screenrc"
|
||||
[ -r "$BYOBU_CONFIG_DIR/.tmux.conf" ] || touch "$BYOBU_CONFIG_DIR/.tmux.conf"
|
||||
for f in status statusrc; do
|
||||
if [ ! -r "$BYOBU_CONFIG_DIR/$f" ]; then
|
||||
# Copy from skeleton, if possible
|
||||
cp -f "$BYOBU_PREFIX/share/$PKG/status/$f" "$BYOBU_CONFIG_DIR/$f"
|
||||
fi
|
||||
done
|
||||
|
||||
# Affects: Upgrades from <= byobu-2.70 that autolaunch
|
||||
# Update the byobu-launch line, if necessary
|
||||
if grep -qs " $PKG-launch$" "$HOME"/.profile; then
|
||||
$PKG-launcher-install
|
||||
fi
|
||||
|
||||
# Affects: Upgrades from <= byobu-2.78 which might have "motd+shell"
|
||||
# in their window list; update this to just "shell"
|
||||
if grep -qs "motd+shell" "$BYOBU_CONFIG_DIR/windows"; then
|
||||
$BYOBU_SED_INLINE -e "s/motd+shell/shell/g" "$($BYOBU_READLINK -f $BYOBU_CONFIG_DIR/windows)" || true
|
||||
fi
|
||||
|
||||
# Affects: Upgrades from <= byobu 4.3, remove ec2_rates
|
||||
rm -f "$BYOBU_CONFIG_DIR/ec2_rates"
|
||||
|
||||
# Affects: Upgrades from <= byobu 4.4, update "shell" -> "byobu-shell"
|
||||
if grep -qs " shell$" "$BYOBU_CONFIG_DIR/windows"; then
|
||||
$BYOBU_SED_INLINE -e "s/ shell$/ $PKG-shell/g" "$($BYOBU_READLINK -f $BYOBU_CONFIG_DIR/windows)" || true
|
||||
fi
|
||||
|
||||
# Affects: Upgrades from <= byobu 4.22
|
||||
killall -u $USER byobu-statusd >/dev/null 2>&1 || true
|
||||
|
||||
# Clean up flag (new and old)
|
||||
rm -f "$FLAG" "/var/run/screen/S-$USER/$PKG.reload-required"
|
||||
|
||||
# Affects: Upgrades from <= byobu 5.50, install byobu prompt if using stock bashrc
|
||||
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 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"
|
||||
fi
|
||||
elif eval $BYOBU_TEST md5sum >/dev/null 2>&1; then
|
||||
if [ "$(cat /etc/skel/.bashrc | md5sum)" = "$(cat $HOME/.bashrc | md5sum)" ]; then
|
||||
printf "[ -r $BYOBU_CONFIG_DIR/prompt ] && . $BYOBU_CONFIG_DIR/prompt #byobu-prompt#\n" >> "$HOME/.bashrc"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
[ -r "$BYOBU_CONFIG_DIR/prompt" ] || printf "[ -r ${BYOBU_PREFIX}/share/${PKG}/profiles/bashrc ] && . ${BYOBU_PREFIX}/share/${PKG}/profiles/bashrc #byobu-prompt#\n" > "$BYOBU_CONFIG_DIR/prompt"
|
||||
|
||||
# Affects: Upgrades from <= byobu 5.126, clear out ec2/rcs cost statuses
|
||||
rm -f "$BYOBU_RUN_DIR"/cache.tmux/ec2_cost* "$BYOBU_RUN_DIR"/cache.tmux/rcs_cost* "$BYOBU_RUN_DIR"/status.tmux/ec2_cost* "$BYOBU_RUN_DIR"/status.tmux/rcs_cost*
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,47 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# byobu-keybindings - toggle on/off the Byobu f-key shortcuts
|
||||
# Copyright (C) 2013-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
case "$BYOBU_BACKEND" in
|
||||
"tmux")
|
||||
enabled=$(tmux list-keys | grep "f-keys.tmux.disable ;")
|
||||
if [ -n "$enabled" ]; then
|
||||
tmux source "$BYOBU_PREFIX/share/byobu/keybindings/f-keys.tmux.disable"
|
||||
echo "Byobu keybindings: [OFF]"
|
||||
else
|
||||
tmux source "$BYOBU_PREFIX/share/byobu/keybindings/f-keys.tmux"
|
||||
echo "Byobu keybindings: [ON]"
|
||||
fi
|
||||
|
||||
;;
|
||||
"screen")
|
||||
if [ -n "$STY" ]; then
|
||||
flag="$BYOBU_RUN_DIR/.${STY}__f-keys_disabled"
|
||||
if [ -e "$flag" ]; then
|
||||
screen -X -S $STY at "*" eval 'process x' 'process e'
|
||||
rm -f "$flag"
|
||||
echo "Byobu keybindings: [ON]"
|
||||
else
|
||||
screen -X -S $STY at "*" eval 'process x' 'process d'
|
||||
touch "$flag"
|
||||
echo "Byobu keybindings: [OFF]"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
|
@ -0,0 +1,81 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# byobu-launch - call the launcher if we're in an interactive shell
|
||||
# Copyright (C) 2010 Canonical Ltd.
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# 1) Prevent recursion, and multiple sourcing of profiles with the BYOBU_SOURCED_PROFILE environment variable.
|
||||
# 2) Respect environment variables (LC_BYOBU and BYOBU_DISABLE) passable over SSH to disable
|
||||
# Byobu launch. This puts that configurability on the SSH client,
|
||||
# in addition to the server.
|
||||
# To use over SSH, your /etc/ssh/sshd_config and /etc/ssh/ssh_config
|
||||
# must pass this variable with AcceptEnv and SendEnv.
|
||||
# Note that LC_* are passed by default on Debian/Ubuntu, we'll optionally
|
||||
# support LC_BYOBU=0
|
||||
# And in your local bashrc:
|
||||
# $HOME/.bashrc: export LC_BYOBU=0
|
||||
# or edit your sshd_config, ssh_config, and set:
|
||||
# $HOME/.bashrc: export BYOBU_DISABLE=1
|
||||
|
||||
_tty=$(tty)
|
||||
if [ "${_tty#/dev/ttyS}" != "$_tty" ] && [ "${_tty#/dev/ttyAMA}" != "$_tty" ]; then
|
||||
# Don't autolaunch byobu on serial consoles
|
||||
# You can certainly run 'byobu' manually, though
|
||||
echo
|
||||
echo "INFO: Disabling auto-launch of Byobu on this serial console"
|
||||
echo "INFO: You can still run 'byobu' manually at the command line"
|
||||
echo
|
||||
elif [ "$BYOBU_SOURCED_PROFILE" != "1" ] && [ "$LC_BYOBU" != "0" ] && [ "$BYOBU_DISABLE" != "1" ] && [ -O "$HOME" ]; then
|
||||
unset _tty
|
||||
BYOBU_SOURCED_PROFILE=1
|
||||
PKG="byobu"
|
||||
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
|
||||
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
|
||||
# Ensure that autolaunch is not explicitly disabled
|
||||
if [ ! -r "$BYOBU_CONFIG_DIR/disable-autolaunch" ]; then
|
||||
case "$-" in
|
||||
*i*)
|
||||
# Attempt to merge shell history across sessions/windows (works with some exceptions)
|
||||
for i in shopt setopt; do
|
||||
if eval $BYOBU_TEST $i >/dev/null; then
|
||||
case $i in
|
||||
shopt) $i -s histappend || true ;;
|
||||
setopt) $i appendhistory || true ;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
[ -n "$PROMPT_COMMAND" ] && PROMPT_COMMAND="history -a;history -r;$PROMPT_COMMAND" || PROMPT_COMMAND="history -a;history -r"
|
||||
# Source profile, if necessary
|
||||
[ -z "$_byobu_sourced" ] && [ -r "$HOME/.profile" ] && . "$HOME/.profile"
|
||||
if byobu-launcher "$@" ; then
|
||||
# Wait very briefly for the no-logout flag to get written?
|
||||
sleep 0.1
|
||||
if [ -e "$BYOBU_CONFIG_DIR/no-logout-on-detach" ] || [ -e "$BYOBU_RUN_DIR/no-logout" ]; then
|
||||
# The user does not want to logout on byobu detach
|
||||
rm -f "$BYOBU_RUN_DIR/no-logout" # Remove one-time no-logout flag, if it exists
|
||||
true
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
unset _tty
|
||||
true
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,54 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# byobu-launcher - conditionally launch byobu
|
||||
# Copyright (C) 2010 Canonical Ltd.
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
PKG="byobu"
|
||||
# Bad things happen if you run byobu, but you don't own your $HOME
|
||||
# ie, rather than "sudo byobu", you must run "sudo -H byobu"
|
||||
if [ -O "$HOME" ]; then
|
||||
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
|
||||
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
|
||||
if [ -e "$BYOBU_CONFIG_DIR/disable-autolaunch" ]; then
|
||||
false
|
||||
else
|
||||
case "$TERM" in
|
||||
*screen*)
|
||||
# Handle nesting
|
||||
if [ -n "$SSH_CONNECTION" ] && [ "$(printf "$SSH_CONNECTION" | awk '{print $1}')" != "$(printf "$SSH_CONNECTION" | awk '{print $3}')" ]; then
|
||||
# Safeguard against ssh-ing into ourself, which causes an infinite loop
|
||||
exec $BYOBU_PREFIX/bin/byobu "$@"
|
||||
else
|
||||
echo "INFO: Disabling auto-launch of Byobu in this SSH connection, to avoid a potential infinite loop" 1>&2
|
||||
echo "INFO: You can still run 'byobu' manually at the command line, if you know what you're doing" 1>&2
|
||||
true
|
||||
fi
|
||||
;;
|
||||
dumb)
|
||||
# Dumb terminal, don't launch
|
||||
false
|
||||
;;
|
||||
*)
|
||||
exec $BYOBU_PREFIX/bin/byobu "$@"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
false
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,90 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# byobu-launcher-install
|
||||
# Copyright (C) 2008 Canonical Ltd.
|
||||
#
|
||||
# Authors: Nick Barcet <nick.barcet@ubuntu.com>
|
||||
# Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
PKG="byobu"
|
||||
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
|
||||
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
|
||||
|
||||
FLAG="$BYOBU_CONFIG_DIR/no-logout-on-detach"
|
||||
|
||||
LOGOUT_ON_DETACH=1
|
||||
for i in $@; do
|
||||
case "$i" in
|
||||
-n|--no-logout)
|
||||
LOGOUT_ON_DETACH=0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
update_flag() {
|
||||
if [ "$LOGOUT_ON_DETACH" = "1" ]; then
|
||||
rm -f "$FLAG"
|
||||
else
|
||||
touch "$FLAG"
|
||||
fi
|
||||
}
|
||||
|
||||
install_launcher() {
|
||||
$PKG-launcher-uninstall "$1" || true
|
||||
printf "_byobu_sourced=1 . ${BYOBU_PREFIX}/bin/byobu-launch 2>/dev/null || true\n" >> "$1"
|
||||
}
|
||||
|
||||
install_launcher_fish() {
|
||||
$PKG-launcher-uninstall "$1" || true
|
||||
printf "status --is-login; and status --is-interactive; and exec byobu-launcher" >> "$1"
|
||||
}
|
||||
|
||||
# Sanitize the environment
|
||||
$PKG-launcher-uninstall || true
|
||||
|
||||
# Handle bourne shells, if not set globally in /etc/profile.d
|
||||
if [ ! -h "/etc/profile.d/Z97-$PKG.sh" ]; then
|
||||
# Install in $HOME/.profile unconditionally
|
||||
install_launcher "$HOME/.profile"
|
||||
# Now, install in any shell-specific profiles, if they exist
|
||||
# This list may grow to support other shells
|
||||
for i in ".bash_profile" ".bash_login"; do
|
||||
if [ -w "$HOME/$i" ]; then
|
||||
install_launcher "$HOME/$i"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Install in zprofile if default shell is zsh
|
||||
case "$SHELL" in
|
||||
*zsh)
|
||||
install_launcher "$HOME/.zprofile"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Handle fish shell
|
||||
if [ -d "$HOME/.config/fish" ]; then
|
||||
install_launcher_fish "$HOME/.config/fish/config.fish"
|
||||
fi
|
||||
|
||||
# Hush login, since we will handle motd printing
|
||||
touch "$HOME"/.hushlogin
|
||||
rm -f "$BYOBU_CONFIG_DIR/disable-autolaunch"
|
||||
|
||||
# Update the logout/nologout flag
|
||||
update_flag
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,47 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# byobu-launcher-uninstall
|
||||
# Copyright (C) 2008 Canonical Ltd.
|
||||
#
|
||||
# Authors: Nick Barcet <nick.barcet@ubuntu.com>
|
||||
# Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
PKG="byobu"
|
||||
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
|
||||
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
|
||||
|
||||
remove_launcher() {
|
||||
dest=$1
|
||||
if [ -w "$dest" ]; then
|
||||
# keep any comments, and remove lines invoking byobu:
|
||||
$BYOBU_SED_INLINE -e '/^\s*#/n' -e "/\b$PKG-launch/d" -e "/\bscreen-launch/d" "$dest"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -f "$1" ]; then
|
||||
remove_launcher "$1"
|
||||
else
|
||||
for i in ".profile" ".bashrc" ".bash_profile" ".bash_login" ".zprofile" ".config/fish/config.fish"; do
|
||||
remove_launcher "$HOME/$i"
|
||||
done
|
||||
fi
|
||||
|
||||
mkdir -p "$BYOBU_CONFIG_DIR"
|
||||
touch "$BYOBU_CONFIG_DIR/disable-autolaunch"
|
||||
# install disabled motd printing; re-enable
|
||||
rm -f "$HOME"/.hushlogin
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,126 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# layout: save and restore byobu layouts
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
PKG="byobu"
|
||||
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
|
||||
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
|
||||
|
||||
# Get the layouts directory
|
||||
DIR="$BYOBU_CONFIG_DIR/layouts"
|
||||
mkdir -p "$DIR"
|
||||
PRESETS="even-horizontal even-vertical main-horizontal main-vertical tiled"
|
||||
current_panes=$(tmux list-panes | wc -l)
|
||||
|
||||
list_layouts() {
|
||||
echo
|
||||
echo "Byobu Saved Layouts"
|
||||
local count=0 i= desc= count= p=
|
||||
for i in $PRESETS "$DIR"/*; do
|
||||
desc=${i##*/}
|
||||
count=$(expr $count + 1)
|
||||
[ -f "$i" ] && p=$(head -n1 "$i")
|
||||
[ -n "$p" ] && p=" ($p splits)"
|
||||
echo " $count. $desc$p"
|
||||
done
|
||||
echo
|
||||
_RET="$count"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
"save")
|
||||
layout=$(tmux list-windows | grep "(active)$" | sed -e "s/.*\[layout //" -e "s/\] .*(active)$//")
|
||||
panes=$(tmux list-panes | wc -l)
|
||||
if [ -n "$2" ]; then
|
||||
name="$2"
|
||||
else
|
||||
echo
|
||||
echo "Restore layout with <shift-F8>, save a layout with <shift-ctrl-F8>"
|
||||
while true; do
|
||||
list_layouts
|
||||
echo -n "Enter a unique name to save this layout: "
|
||||
name=$(head -n1)
|
||||
valid=1
|
||||
for i in $PRESETS "$DIR"/*; do
|
||||
i=${i##*/}
|
||||
if [ "$i" = "$name" ]; then
|
||||
valid=0
|
||||
fi
|
||||
done
|
||||
[ "$valid" = "1" ] && break
|
||||
done
|
||||
fi
|
||||
printf "$panes\n$layout\n" > "$BYOBU_CONFIG_DIR/layouts/$name"
|
||||
;;
|
||||
"restore")
|
||||
if [ -n "$2" ]; then
|
||||
# Layout selected on the command line
|
||||
name="$2"
|
||||
else
|
||||
# List the saved layouts, prompt the user to select one
|
||||
list_layouts
|
||||
count="$_RET"
|
||||
while true; do
|
||||
echo -n "Select a layout to restore [1-$count]: "
|
||||
selected=$(head -n1)
|
||||
if [ -n "$selected" ] && [ $selected -le $count ] && [ $selected -ge 1 ]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
count=0
|
||||
for i in $PRESETS "$DIR"/*; do
|
||||
count=$(expr $count + 1)
|
||||
if [ $count -eq $selected ]; then
|
||||
name=$(basename "$i")
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
# Get the details of the selected layout
|
||||
panes=
|
||||
layout=
|
||||
if [ -f "$DIR/$name" ]; then
|
||||
panes=$(head -n1 "$DIR/$name")
|
||||
layout=$(tail -n1 "$DIR/$name")
|
||||
else
|
||||
if [ $current_panes -eq 1 ]; then
|
||||
panes=4
|
||||
else
|
||||
panes=0
|
||||
fi
|
||||
layout="$name"
|
||||
fi
|
||||
# Create panes if nececessary to restore the layout
|
||||
while [ $(tmux list-panes | wc -l) -lt $panes ]; do
|
||||
tmux split-window
|
||||
tmux select-layout tiled
|
||||
done
|
||||
# Finally, restore the layout and refresh
|
||||
tmux select-layout "$layout"
|
||||
tmux source "$BYOBU_PREFIX/share/byobu/profiles/tmuxrc"
|
||||
;;
|
||||
list)
|
||||
list_layouts
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: Invalid argument, try [save|restore|list]" 2>&1
|
||||
exit 1
|
||||
;;
|
||||
esac
|
|
@ -0,0 +1,37 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# byobu-prompt
|
||||
# Copyright (C) 2013-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
PKG="byobu"
|
||||
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
|
||||
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
|
||||
|
||||
echo
|
||||
echo -n "Do you want to enable Byobu's bash color prompt? [Y/n]: "
|
||||
answer=$(head -n1)
|
||||
echo
|
||||
case "$answer" in
|
||||
"n"|"N")
|
||||
exec byobu-disable-prompt
|
||||
;;
|
||||
*)
|
||||
exec byobu-enable-prompt
|
||||
esac
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,39 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# byobu-quiet - disable the hardstatus and all indicators
|
||||
# Copyright (C) 2011 Canonical Ltd.
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
PKG="byobu"
|
||||
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
|
||||
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
|
||||
|
||||
FLAG="$BYOBU_CONFIG_DIR/status.disable"
|
||||
|
||||
# Clean up environment
|
||||
$BYOBU_SED_INLINE "/hardstatus/d" "$BYOBU_CONFIG_DIR/keybindings" || true
|
||||
if [ "$1" = "--undo" ]; then
|
||||
rm -f "$FLAG"
|
||||
else
|
||||
touch "$FLAG"
|
||||
# BUG: Need to make this dynamic and following
|
||||
status="$USER@$(hostname)"
|
||||
echo "hardstatus lastline '$status'" >> "$BYOBU_CONFIG_DIR/keybindings"
|
||||
fi
|
||||
$BYOBU_BACKEND -X at 0 source "$BYOBU_CONFIG_DIR/profile"
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,106 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# byobu-reconnect-sockets - source this file to re-establish
|
||||
# GPG_AGENT_INFO and DBUS_SESSION_BUS_ADDRESS,
|
||||
# useful when reconnecting to an existing
|
||||
# byobu session.
|
||||
#
|
||||
# Copyright (C) 2009 Canonical Ltd.
|
||||
# Copyright (C) 2012-2014 Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
# Ryan C. Thompson <rct@thompsonclan.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
PKG="byobu"
|
||||
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
|
||||
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
|
||||
|
||||
case "$-" in
|
||||
*i*)
|
||||
# no-op
|
||||
;;
|
||||
*)
|
||||
echo 2>&1
|
||||
echo "ERROR: You must source this file, rather than execute it." 2>&1
|
||||
echo " . $0" 2>&1
|
||||
echo 2>&1
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
export_and_send () {
|
||||
var="$1"
|
||||
value="$(eval "echo \$$var")"
|
||||
export "$var"
|
||||
case $BYOBU_BACKEND in
|
||||
tmux)
|
||||
tmux setenv "$var" "$value"
|
||||
;;
|
||||
screen)
|
||||
screen -X setenv "$var" "$value"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
screen_update () {
|
||||
# Ensure that screen's environment variables/values get propagated here
|
||||
# Enable word splitting for zsh:
|
||||
[ "x$ZSH_VERSION" != x ] && setopt local_options sh_word_split
|
||||
tempfile=$(mktemp -q ${BYOBU_RUN_DIR}/sockets-XXXXXXXX) && {
|
||||
for var in $VARS_TO_UPDATE; do
|
||||
screen sh -c "echo export $var=\$$var >> \"$tempfile\""
|
||||
done
|
||||
. "$tempfile"
|
||||
rm -f "$tempfile"
|
||||
}
|
||||
}
|
||||
|
||||
tmux_update () {
|
||||
# Ensure that tmux's environment variables/values get propagated here
|
||||
# Enable word splitting for zsh:
|
||||
[ "x$ZSH_VERSION" != x ] && setopt local_options sh_word_split
|
||||
for var in $VARS_TO_UPDATE; do
|
||||
expr="$(tmux showenv | grep "^$var=")"
|
||||
if [ -n "$expr" ]; then
|
||||
export "$expr"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Pull environment variables/values from backend and update/export here
|
||||
VARS_TO_UPDATE="DISPLAY DBUS_SESSION_BUS_ADDRESS SESSION_MANAGER GPG_AGENT_INFO XDG_SESSION_COOKIE XDG_SESSION_PATH GNOME_KEYRING_CONTROL GNOME_KEYRING_PID GPG_AGENT_INFO SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID WINDOWID UPSTART_JOB UPSTART_EVENTS UPSTART_SESSION UPSTART_INSTANCE"
|
||||
|
||||
case $BYOBU_BACKEND in
|
||||
tmux)
|
||||
tmux_update
|
||||
;;
|
||||
screen)
|
||||
screen_update
|
||||
;;
|
||||
esac
|
||||
|
||||
# Establish gpg-agent socket, helps when reconnecting to a detached session
|
||||
newest "$HOME/.gnupg/gpg-agent-info-*" && . "$_RET" && export_and_send GPG_AGENT_INFO
|
||||
|
||||
# Reconnect dbus, source the most recently touched session-bus
|
||||
# Sorry, ls -t is needed here, to sort by time
|
||||
newest "$HOME/.dbus/session-bus/*" && . "$_RET"
|
||||
|
||||
[ -r "$BYOBU_RUN_DIR/sockets" ] && . "$BYOBU_RUN_DIR/sockets"
|
||||
export_and_send DBUS_SESSION_BUS_ADDRESS
|
||||
export_and_send SESSION_MANAGER
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1 @@
|
|||
byobu
|
|
@ -0,0 +1,63 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# byobu-select-backend
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
PKG="byobu"
|
||||
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
|
||||
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
|
||||
|
||||
usage () {
|
||||
cat <<EOT
|
||||
Usage: $0 [screen|tmux]
|
||||
|
||||
Without any parameters, it runs interactively.
|
||||
EOT
|
||||
exit 1
|
||||
}
|
||||
|
||||
prompt() {
|
||||
local choice
|
||||
echo
|
||||
echo "Select the byobu backend:"
|
||||
echo " 1. tmux"
|
||||
echo " 2. screen"
|
||||
echo
|
||||
printf "Choose 1-2 [1]: "
|
||||
choice=$(head -n1)
|
||||
case $choice in
|
||||
1|"") _RET="tmux" ;;
|
||||
2) _RET="screen" ;;
|
||||
*) prompt ;;
|
||||
esac
|
||||
}
|
||||
|
||||
case $1 in
|
||||
"")
|
||||
prompt
|
||||
choice="$_RET"
|
||||
;;
|
||||
screen|tmux)
|
||||
choice="$1"
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
echo "BYOBU_BACKEND=$choice" > "$BYOBU_CONFIG_DIR/backend"
|
|
@ -0,0 +1,211 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# byobu-select-profile
|
||||
# Copyright (C) 2008 Canonical Ltd.
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
# Nick Barcet <nick.barcet@ubuntu.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# If you change any strings, please generate localization information with:
|
||||
# ./debian/rules get-po
|
||||
|
||||
PKG="byobu"
|
||||
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
|
||||
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
|
||||
|
||||
TEXTDOMAIN="$PKG"
|
||||
|
||||
COLORS="default_light \
|
||||
default_dark \
|
||||
white \
|
||||
black \
|
||||
grey \
|
||||
dark_grey \
|
||||
light_grey \
|
||||
blue \
|
||||
light_blue \
|
||||
cyan \
|
||||
light_cyan \
|
||||
green \
|
||||
light_green \
|
||||
purple \
|
||||
light_purple \
|
||||
red \
|
||||
light_red \
|
||||
yellow \
|
||||
brown"
|
||||
|
||||
# Find a hash utility
|
||||
for i in md5sum md5 sha512sum sha256sum sha1sum shasum shasum5.12 shasum5.10; do
|
||||
if eval $BYOBU_TEST $i >/dev/null 2>&1; then
|
||||
HASH="$i"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
usage () {
|
||||
cat <<EOT
|
||||
Usage: $0 [OPTION]
|
||||
-l,--list list available profiles
|
||||
-b,--background COLOR set the background color
|
||||
-f,--foreground COLOR set the foreground color
|
||||
-h,--hostnmae set the colors based on a hash of the hostname
|
||||
-i,--ip set the colors based on a hash of the ip
|
||||
-r,--random set the colors randomly
|
||||
--help this help
|
||||
EOT
|
||||
}
|
||||
|
||||
# Initialize variables
|
||||
FILE="$BYOBU_CONFIG_DIR/color"
|
||||
PROFILE="$BYOBU_CONFIG_DIR/profile"
|
||||
[ -r "$PROFILE" ] || ln -sf $BYOBU_PREFIX/share/$PKG/profiles/common "$PROFILE"
|
||||
selected=-1
|
||||
color=
|
||||
|
||||
listprofiles() {
|
||||
# Display list of profiles, one per line
|
||||
for x in $COLORS; do
|
||||
echo "$x"
|
||||
done
|
||||
}
|
||||
|
||||
getletter() {
|
||||
count=$(echo "$1" | wc -c)
|
||||
if [ "$count" = "2" ]; then
|
||||
echo "$1"
|
||||
return
|
||||
fi
|
||||
color="$1"
|
||||
case $color in
|
||||
default_light) letter="d";;
|
||||
default_dark) letter="D";;
|
||||
black) letter="k";;
|
||||
dark_grey) letter="K";;
|
||||
blue) letter="b";;
|
||||
light_blue) letter="B";;
|
||||
cyan) letter="c";;
|
||||
light_cyan) letter="C";;
|
||||
green) letter="g";;
|
||||
light_green) letter="G";;
|
||||
purple) letter="m";;
|
||||
light_purple) letter="M";;
|
||||
red) letter="r";;
|
||||
light_red) letter="R";;
|
||||
grey) letter="w";;
|
||||
light_grey) letter="W";;
|
||||
white) letter="w";;
|
||||
yellow) letter="Y";;
|
||||
brown) letter="y";;
|
||||
*) letter="d";;
|
||||
esac
|
||||
echo "$letter"
|
||||
}
|
||||
|
||||
setcolor_screen() {
|
||||
which="$1"
|
||||
color="$2"
|
||||
[ -r $FILE ] && . $FILE
|
||||
if [ "$which" = "foreground" ]; then
|
||||
FOREGROUND=$(getletter "$color")
|
||||
else
|
||||
BACKGROUND=$(getletter "$color")
|
||||
fi
|
||||
[ "$MONOCHROME" = "1" ] || MONOCHROME=0
|
||||
printf "FOREGROUND=$FOREGROUND\nBACKGROUND=$BACKGROUND\nMONOCHROME=$MONOCHROME" > $FILE
|
||||
touch "$BYOBU_RUN_DIR/reload-required"
|
||||
$BYOBU_BACKEND -X at 0 source "$BYOBU_CONFIG_DIR/profile"
|
||||
}
|
||||
|
||||
get_contrast() {
|
||||
# See section 2.2: http://www.w3.org/TR/AERT#color-contrast
|
||||
local awk="awk"
|
||||
if eval $BYOBU_TEST gawk >/dev/null 2>&1; then
|
||||
awk="gawk"
|
||||
fi
|
||||
local hex="$(echo "$1" | sed -e "s/\(..\)\(..\)\(..\)/\1 \2 \3/")"
|
||||
local bright=$(echo $hex | $awk --non-decimal-data '{printf "%0.0f",(("0x"$1)*299+("0x"$2)*587+("0x"$3)*114)/1000}')
|
||||
if [ $bright -ge 130 ]; then
|
||||
_RET="black"
|
||||
else
|
||||
_RET="white"
|
||||
fi
|
||||
}
|
||||
|
||||
setcolor_tmux() {
|
||||
if [ "$BYOBU_BACKEND" != "tmux" ]; then
|
||||
echo "WARNING: This functionality is only supported in Byobu with the tmux backend" 1>&2
|
||||
fi
|
||||
dark="$1"
|
||||
get_contrast "$dark"
|
||||
light="$_RET"
|
||||
accent="magenta"
|
||||
highlight="red"
|
||||
monochrome="0"
|
||||
printf "BYOBU_DARK=\"$dark\"\nBYOBU_LIGHT=$light\nBYOBU_ACCENT=$accent\nBYOBU_HIGHLIGHT=$highlight\nMONOCHROME=$MONOCHROME" > "$FILE".tmux
|
||||
tmux source "$BYOBU_PREFIX/share/byobu/profiles/tmuxrc"
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
usage
|
||||
else
|
||||
while true; do
|
||||
case "$1" in
|
||||
-b|--background)
|
||||
setcolor_screen "background" "$2"
|
||||
shift 2
|
||||
;;
|
||||
-f|--foreground)
|
||||
setcolor_screen "foreground" "$2"
|
||||
shift 2
|
||||
;;
|
||||
-h|--hostname)
|
||||
color=$(hostname | $HASH | head -c 6)
|
||||
setcolor_tmux "$color"
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-i|--ip)
|
||||
[ -r "$BYOBU_CONFIG_DIR/statusrc" ] && . "$BYOBU_CONFIG_DIR/statusrc"
|
||||
. $BYOBU_PREFIX/lib/$PKG/ip_address
|
||||
color=$(__ip_address t| $HASH | head -c 6)
|
||||
setcolor_tmux "$color"
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-r|--random)
|
||||
color=$(head -c 10 /dev/urandom | $HASH | head -c 6)
|
||||
setcolor_tmux "\#$color"
|
||||
shift
|
||||
break
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
esac
|
||||
[ $# -eq 0 ] && break
|
||||
done
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# byobu-select-session - interactive session select wrapper script
|
||||
# Copyright (C) 2013-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
PKG="byobu"
|
||||
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
|
||||
|
||||
exec ${BYOBU_PYTHON} "${BYOBU_PREFIX}/lib/${PKG}/include/select-session.py"
|
|
@ -0,0 +1,46 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# byobu-shell: display the MOTD and launch the default shell
|
||||
# Copyright (C) 2008 Canonical Ltd.
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
PKG="byobu"
|
||||
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
|
||||
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
|
||||
|
||||
FLAG="$BYOBU_CONFIG_DIR/.welcome-displayed"
|
||||
|
||||
# Find a MOTD, seems that they're moving around
|
||||
for i in /etc/motd /run/motd.dynamic /run/motd; do
|
||||
[ -r $i ] && [ ! -e "$HOME"/.hushlogin ] && cat $i && break
|
||||
done
|
||||
|
||||
if [ ! -e "$FLAG" ]; then
|
||||
echo
|
||||
echo "Welcome to the light, powerful, text window manager, Byobu."
|
||||
echo "You can toggle the launch of Byobu at login with:"
|
||||
echo " 'byobu-disable' and 'byobu-enable'"
|
||||
echo
|
||||
echo "For tips, tricks, and more information, see:"
|
||||
echo " * https://bit.ly/byobu-tips"
|
||||
echo
|
||||
touch "$FLAG"
|
||||
fi
|
||||
|
||||
[ -n "$SHELL" -a -x "$SHELL" ] && exec "$SHELL" || exec /bin/sh
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,37 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# byobu-silence - disable the hardstatus, all indicators, and the window list
|
||||
# Copyright (C) 2011 Canonical Ltd.
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
PKG="byobu"
|
||||
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
|
||||
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
|
||||
|
||||
FLAG="$BYOBU_CONFIG_DIR/status.disable"
|
||||
|
||||
# Clean up environment
|
||||
$BYOBU_SED_INLINE "/caption/d" "$BYOBU_CONFIG_DIR/keybindings" || true
|
||||
if [ "$1" = "--undo" ]; then
|
||||
rm -f "$FLAG"
|
||||
else
|
||||
touch "$FLAG"
|
||||
echo "caption splitonly ''" >> "$BYOBU_CONFIG_DIR/keybindings"
|
||||
fi
|
||||
exec byobu-quiet "$@"
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,181 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# byobu-status: byobu's cached status gathering
|
||||
#
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
PKG="byobu"
|
||||
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
|
||||
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
|
||||
|
||||
# Make sure status is not disabled
|
||||
[ -f "$BYOBU_CONFIG_DIR/status.disable" ] && exit 0
|
||||
|
||||
# Clean and create cache directories
|
||||
[ -d "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND" ] || mkdir -p "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND"
|
||||
[ -d "$BYOBU_RUN_DIR/.last.$BYOBU_BACKEND" ] || mkdir -p "$BYOBU_RUN_DIR/.last.$BYOBU_BACKEND"
|
||||
|
||||
# Source configurations
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/icons"
|
||||
for i in "${BYOBU_PREFIX}/share/$PKG/status/status" "${BYOBU_PREFIX}/share/$PKG/status/statusrc" "$BYOBU_CONFIG_DIR/status" "$BYOBU_CONFIG_DIR/statusrc" "$BYOBU_CONFIG_DIR/color" "$BYOBU_CONFIG_DIR/color.tmux"; do
|
||||
[ -r "$i" ] && . "$i"
|
||||
done
|
||||
[ -r "$BYOBU_CONFIG_DIR/datetime.tmux" ] && . "$BYOBU_CONFIG_DIR/datetime.tmux"
|
||||
|
||||
case "$BYOBU_BACKEND" in
|
||||
screen)
|
||||
# Reload profile, if necessary
|
||||
if [ -e "/var/run/screen/S-$USER/$PKG.reload-required" ] || [ -e "$BYOBU_RUN_DIR/reload-required" ]; then
|
||||
if [ -r "$BYOBU_CONFIG_DIR/profile" ]; then
|
||||
# If the forced janitorial steps succeed, try a profile reload
|
||||
byobu-janitor --force && screen -X at 0 source "$BYOBU_CONFIG_DIR/profile" >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
tmux)
|
||||
# Fix status printing for small terminal sizes in tmux
|
||||
width=$(tmux list-windows -F "#{session_width}")
|
||||
if [ -r "$BYOBU_RUN_DIR/width" ]; then
|
||||
read w_last < $BYOBU_RUN_DIR/width 2>/dev/null 1>&2
|
||||
else
|
||||
w_last=0
|
||||
fi
|
||||
for w in $width; do
|
||||
if [ "$w" != "$w_last" ]; then
|
||||
# go through cat due to possible tmux/epoll bug
|
||||
tmux set -g status-left-length $(($w*1/4)) | cat >/dev/null 2>&1
|
||||
tmux set -g status-right-length $(($w*3/4)) | cat >/dev/null 2>&1
|
||||
printf "$w" > $BYOBU_RUN_DIR/width
|
||||
break
|
||||
fi
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
||||
# Get the current timestamp
|
||||
get_now; NOW=${_RET}
|
||||
|
||||
get_status() {
|
||||
local cachepath="$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/$1"
|
||||
local lastpath="$BYOBU_RUN_DIR/.last.$BYOBU_BACKEND/$1"
|
||||
local lastrun=0
|
||||
[ -r "$lastpath" ] && read lastrun < "$lastpath"
|
||||
case "$1" in
|
||||
ip_address4)
|
||||
local IPV6=0
|
||||
local function="ip_address"
|
||||
;;
|
||||
ip_address6)
|
||||
local IPV6=1
|
||||
local function="ip_address"
|
||||
;;
|
||||
*)
|
||||
local function="$1"
|
||||
;;
|
||||
esac
|
||||
status_freq "$function"
|
||||
local expiry=$(($lastrun+$_RET))
|
||||
find_script "$function" && . "${_RET}"
|
||||
# Update cache now, if necessary
|
||||
if [ $NOW -ge $expiry ] || [ "$lastrun" = "0" ]; then
|
||||
"__$function" > "$cachepath".new
|
||||
fi
|
||||
# Check if we have data in the cache
|
||||
if [ -s "$cachepath".new ]; then
|
||||
# Looks like we have an updated cache, use it
|
||||
mv -f "$cachepath".new "$cachepath"
|
||||
printf "%s" "$NOW" > "$lastpath"
|
||||
IFS= read line < "$cachepath"; printf "%s" "$line"
|
||||
elif [ -s "$cachepath" ]; then
|
||||
# New cache is empty, but we have data from our last run, use it
|
||||
IFS= read line < "$cachepath"; printf "%s" "$line"
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
*left|*right)
|
||||
eval items="\$$1"
|
||||
for i in $items; do
|
||||
if [ "$BYOBU_BACKEND" = "tmux" ]; then
|
||||
case "$i" in
|
||||
\#date)
|
||||
if [ -n "$BYOBU_DATE" ]; then
|
||||
$BYOBU_SED_INLINE -e "/BYOBU_DATE=/d" "$BYOBU_CONFIG_DIR/datetime.tmux"
|
||||
printf "%s\n" 'BYOBU_DATE=' >> "$BYOBU_CONFIG_DIR/datetime.tmux"
|
||||
touch "$BYOBU_RUN_DIR/reload-required"
|
||||
continue
|
||||
fi
|
||||
;;
|
||||
\#time)
|
||||
if [ -n "$BYOBU_TIME" ]; then
|
||||
$BYOBU_SED_INLINE -e "/BYOBU_TIME=/d" "$BYOBU_CONFIG_DIR/datetime.tmux"
|
||||
printf "%s\n" 'BYOBU_TIME=' >> "$BYOBU_CONFIG_DIR/datetime.tmux"
|
||||
touch "$BYOBU_RUN_DIR/reload-required"
|
||||
continue
|
||||
fi
|
||||
;;
|
||||
date)
|
||||
if [ -z "$BYOBU_DATE" ]; then
|
||||
$BYOBU_SED_INLINE -e "/BYOBU_DATE=/d" "$BYOBU_CONFIG_DIR/datetime.tmux"
|
||||
printf "%s\n" 'BYOBU_DATE="%Y-%m-%d "' >> "$BYOBU_CONFIG_DIR/datetime.tmux"
|
||||
touch "$BYOBU_RUN_DIR/reload-required"
|
||||
continue
|
||||
fi
|
||||
;;
|
||||
time)
|
||||
if [ -z "$BYOBU_TIME" ]; then
|
||||
$BYOBU_SED_INLINE -e "/BYOBU_TIME=/d" "$BYOBU_CONFIG_DIR/datetime.tmux"
|
||||
printf "%s\n" 'BYOBU_TIME="%H:%M:%S"' >> "$BYOBU_CONFIG_DIR/datetime.tmux"
|
||||
touch "$BYOBU_RUN_DIR/reload-required"
|
||||
continue
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
case "$i" in \#*) continue ;; esac
|
||||
get_status "$i"
|
||||
done
|
||||
;;
|
||||
--detail)
|
||||
VER=
|
||||
if eval $BYOBU_TEST dpkg-query >/dev/null; then
|
||||
VER=$(set -- $(dpkg-query --show $PKG); printf "%s\n" "$2")
|
||||
fi
|
||||
printf "$PKG-$VER Detailed Status Navigation\n"
|
||||
if eval $BYOBU_TEST vim >/dev/null && `vim --version | grep -q +folding`; then
|
||||
printf " Expand all - zr\t\tCollapse all - zm\n Expand one - zo\t\tCollapse one - zc\n\n"
|
||||
fi
|
||||
for i in "$BYOBU_PREFIX/lib/$PKG"/*; do
|
||||
[ -f "$i" ] || continue
|
||||
i=${i##*/}
|
||||
case "$i" in
|
||||
include|menu|notify_osd|time_binary) continue ;;
|
||||
esac
|
||||
find_script "$i" && . "${_RET}"
|
||||
short=$(eval "__${i}" | $BYOBU_SED -e 's/^\s*//' -e 's/\s*$//' -e 's/.{[^}]*}//g')
|
||||
detail=$(eval "__${i}_detail" 2>/dev/null | $BYOBU_SED -e '/^$/d' -e 's/^/\t/g')
|
||||
printf "%s\n\t(%s)\n" "$short" "$i"
|
||||
[ -n "$detail" ] && printf "%s\n" "$detail"
|
||||
done
|
||||
;;
|
||||
color)
|
||||
[ -z "$FOREGROUND" ] && FOREGROUND="w"
|
||||
[ -z "$BACKGROUND" ] && BACKGROUND="k"
|
||||
printf "$ESC{= $BACKGROUND$FOREGROUND}"
|
||||
;;
|
||||
esac
|
|
@ -0,0 +1,31 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# byobu-status-detail
|
||||
# Copyright (C) 2008 Canonical Ltd.
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
PKG="byobu"
|
||||
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
|
||||
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
|
||||
|
||||
if which vim >/dev/null && `vim --version | grep -q +folding`; then
|
||||
byobu-status --detail | vim -c "set foldmethod=indent" -c "set foldminlines=0" -c "set foldnestmax=1" -c "set foldcolumn=2" -R -
|
||||
else
|
||||
byobu-status --detail | $BYOBU_PAGER
|
||||
fi
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1 @@
|
|||
byobu
|
|
@ -0,0 +1,218 @@
|
|||
#!/bin/bash
|
||||
#---------------------------------------------------------------------
|
||||
# Script to display a byobu notification "history graph".
|
||||
#
|
||||
# Designed to work with the wonderful byobu(1) but can be run
|
||||
# stand-alone.
|
||||
#---------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (C) 2011 Canonical Ltd.
|
||||
#
|
||||
# Author: James Hunt <james.hunt@canonical.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
|
||||
PKG="byobu"
|
||||
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
|
||||
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
|
||||
|
||||
script_name=${0##*/}
|
||||
min_default=0
|
||||
max_default=100
|
||||
points_default=5
|
||||
theme_default=vbars_8
|
||||
newline="\n"
|
||||
rotate=y
|
||||
|
||||
error()
|
||||
{
|
||||
msg="$*"
|
||||
echo "ERROR: $msg" >&2
|
||||
}
|
||||
|
||||
die()
|
||||
{
|
||||
error "$*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
usage()
|
||||
{
|
||||
cat <<EOT
|
||||
Description: Display a graph of historical indicator values using
|
||||
byobu-ulevel.
|
||||
|
||||
Usage: $script_name [options] [command [args...]]
|
||||
|
||||
Options:
|
||||
|
||||
-f <file> : File to read data points from.
|
||||
(only required if no command specified).
|
||||
-h : Show this help.
|
||||
-m <num> : Minimum value (default=$min_default).
|
||||
-n : Supress output of newline character.
|
||||
-p <points> : Specify number of data points in graph
|
||||
(default=$points_default).
|
||||
-r : Do not rotate file <file> (default is to rotate).
|
||||
Option implies file <file> should not be written to
|
||||
so a command cannot follow script options in this case.
|
||||
-t <theme> : 'byobu-ulevel' theme to use (default=$theme_default).
|
||||
-x <num> : Maximum value (default=$max_default).
|
||||
|
||||
|
||||
Examples:
|
||||
|
||||
Using $script_name to run a command, rotate log and display graph.
|
||||
|
||||
Here we specify a command to display available memory.
|
||||
Trailing echo adds a required newline
|
||||
Note no filename specified.
|
||||
|
||||
$script_name "(/usr/lib/byobu/mem_used | sed -e 's/% //g';echo)"
|
||||
|
||||
|
||||
Using $script_name just to rotate log and display the graph
|
||||
|
||||
file=/tmp/load.dat
|
||||
awk '{ print \$1}' /proc/loadavg >> \$file
|
||||
# Note: we need to specify what we consider to be a "reasonable" maximum load
|
||||
$script_name -m 3.0 -f \$file
|
||||
|
||||
Notes:
|
||||
|
||||
- If you specify 'command', care must be taken with shell quoting to
|
||||
avoid expansion prior to this script running the command.
|
||||
- If '-r' is not specified, the file <file> will be rotated such that
|
||||
at most <points> lines are retained on each invocation of this
|
||||
script.
|
||||
|
||||
EOT
|
||||
}
|
||||
|
||||
get_data()
|
||||
{
|
||||
needed_lines=$points
|
||||
|
||||
if [ ! -f $file ]
|
||||
then
|
||||
return
|
||||
fi
|
||||
|
||||
lines=$(wc -l $file|awk '{print $1}')
|
||||
|
||||
if [ $lines -lt $needed_lines ]
|
||||
then
|
||||
# insufficient data
|
||||
return
|
||||
fi
|
||||
|
||||
bytes=$(<${file})
|
||||
bytes=$(echo "$bytes"|tail -n ${needed_lines})
|
||||
[ $lines -eq $needed_lines -o $rotate = n ] && echo "$bytes" && return
|
||||
|
||||
# rotate
|
||||
tmp=`tempfile`
|
||||
echo "$bytes" > $tmp
|
||||
mv $tmp $file
|
||||
|
||||
echo "$bytes"
|
||||
}
|
||||
|
||||
while getopts "f:hm:np:rt:x:" opt
|
||||
do
|
||||
case "$opt" in
|
||||
f)
|
||||
file="$OPTARG"
|
||||
;;
|
||||
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
|
||||
m)
|
||||
min=$OPTARG
|
||||
;;
|
||||
|
||||
n)
|
||||
newline=
|
||||
;;
|
||||
|
||||
p)
|
||||
points=$OPTARG
|
||||
;;
|
||||
|
||||
r)
|
||||
rotate=n
|
||||
;;
|
||||
|
||||
t)
|
||||
theme="$OPTARG"
|
||||
;;
|
||||
|
||||
x)
|
||||
max=$OPTARG
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
shift $[$OPTIND-1]
|
||||
|
||||
cmd="$@"
|
||||
|
||||
[ -z "$theme" ] && theme=$theme_default
|
||||
|
||||
if [ -z "$cmd" ]
|
||||
then
|
||||
if [ -z "$file" ]
|
||||
then
|
||||
error "must specify file"
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$file" ]
|
||||
then
|
||||
# we could go cryptic+safe by calling tempfile(1), but that then
|
||||
# makes it very difficult to find in case of need.
|
||||
file=/tmp/${USER}-${script_name}-$$.dat
|
||||
fi
|
||||
|
||||
[ -z "$min" ] && min=$min_default
|
||||
[ -z "$max" ] && max=$max_default
|
||||
[ -z "$points" ] && points=$points_default
|
||||
|
||||
if [ ! -z "$cmd" ]
|
||||
then
|
||||
if [ $rotate = n ]
|
||||
then
|
||||
error "cannot write to file if rotate disabled"
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
eval "$cmd >>$file"
|
||||
fi
|
||||
|
||||
data=$(get_data)
|
||||
|
||||
[ -z "$data" ] && printf "%*.s${newline}" $points && exit 0
|
||||
|
||||
for datum in $data
|
||||
do
|
||||
byobu-ulevel -n -m $min -x $max -p -c $datum -t $theme
|
||||
done
|
|
@ -0,0 +1,538 @@
|
|||
#!/bin/bash
|
||||
#---------------------------------------------------------------------
|
||||
# Script to display unicode characters representing the level of
|
||||
# some indicator.
|
||||
#
|
||||
# Designed to work with the wonderful byobu(1) but can be run
|
||||
# stand-alone.
|
||||
#---------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (C) 2011 Canonical Ltd.
|
||||
#
|
||||
# Author: James Hunt <james.hunt@canonical.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
|
||||
#------------------------------
|
||||
# Themes with 2 values.
|
||||
#
|
||||
# Two-value themes are handled differently to other n-value types of
|
||||
# theme: the first array entry in each theme is generally some unfilled
|
||||
# glyph, denoting an "off" value and the second value is the filled
|
||||
# version of the unfilled glyph and denotes an "on" value. Note that
|
||||
# you can always change the ordering of these values using the 'invert'
|
||||
# command-line option.
|
||||
|
||||
PKG="byobu"
|
||||
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
|
||||
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
|
||||
|
||||
circles_2=(○ ●)
|
||||
diamonds_2=(◇ ◆)
|
||||
flags_2=(⚐ ⚑)
|
||||
hearts_2=(♡ ♥)
|
||||
squares_2=(◻ ◼)
|
||||
squares_small_2=(◽ ◾)
|
||||
stars_2=(☆ ★)
|
||||
faces_2=(☹ ☺)
|
||||
|
||||
#------------------------------
|
||||
# Themes with 4 values.
|
||||
|
||||
vdots_thick_4=(⣀ ⣤ ⣶ ⣿)
|
||||
vdots_thin_4=(⢀ ⢠ ⢰ ⢸)
|
||||
fractions_4=(¼ ½ ¾ ¹)
|
||||
quadrants_4=(◔ ◑ ◕ ●)
|
||||
shades_4=(░ ▒ ▓ █)
|
||||
|
||||
#------------------------------
|
||||
# Themes with 5 values.
|
||||
|
||||
circles_5=(◦ ○ ◎ ◉ ●)
|
||||
|
||||
#------------------------------
|
||||
# Themes with 6 values.
|
||||
|
||||
dice_6=(⚀ ⚁ ⚂ ⚃ ⚄ ⚅)
|
||||
|
||||
#------------------------------
|
||||
# Themes with 8 values.
|
||||
|
||||
hbars_8=(▏ ▎ ▍ ▌ ▋ ▊ ▉ █)
|
||||
vbars_8=(▁ ▂ ▃ ▄ ▅ ▆ ▇ █)
|
||||
|
||||
#------------------------------
|
||||
# Themes with 10 values.
|
||||
|
||||
circle_number_10=(➀ ➁ ➂ ➃ ➄ ➅ ➆ ➇ ➈ ➉)
|
||||
solid_numbers_a_10=(➊ ➋ ➌ ➍ ➎ ➏ ➐ ➑ ➒ ➓)
|
||||
solid_numbers_b_10=(❶ ❷ ❸ ❹ ❺ ❻ ❼ ❽ ❾ ❿)
|
||||
|
||||
#------------------------------
|
||||
# XXX: remember to update if you add new themes above!
|
||||
|
||||
theme_list=\
|
||||
(
|
||||
'circles_2 diamonds_2 flags_2 hearts_2 squares_2 squares_small_2 stars_2'
|
||||
'vdots_thick_4 vdots_thin_4 fractions_4 quadrants_4 shades_4'
|
||||
'circles_5'
|
||||
'dice_6'
|
||||
'hbars_8 vbars_8'
|
||||
'circle_number_10 solid_numbers_a_10 solid_numbers_b_10'
|
||||
)
|
||||
|
||||
#------------------------------
|
||||
|
||||
default_decimal_places=2
|
||||
a11y=n
|
||||
a11y_variable=BYOBU_A11Y
|
||||
debug_enabled=n
|
||||
newline=
|
||||
list=n
|
||||
quiet=n
|
||||
invert=n
|
||||
reverse=n
|
||||
script_name=${0##*/}
|
||||
min_default=0
|
||||
max_default=100
|
||||
width_default=5
|
||||
zero_as_space=n
|
||||
theme_default=vbars_8
|
||||
permissive=n
|
||||
|
||||
debug()
|
||||
{
|
||||
msg="$*"
|
||||
[ $debug_enabled = y ] && echo "DEBUG: $msg"
|
||||
}
|
||||
|
||||
error()
|
||||
{
|
||||
msg="$*"
|
||||
echo "ERROR: $msg" >&2
|
||||
}
|
||||
|
||||
die()
|
||||
{
|
||||
error "$*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
check_a11y()
|
||||
{
|
||||
eval result="\$$a11y_variable"
|
||||
[ ! -z "$result" ] && a11y=y
|
||||
}
|
||||
|
||||
# return 1 if expression specified is true (no return if false)
|
||||
bc_test()
|
||||
{
|
||||
expr="$*"
|
||||
echo $(echo "if ( $expr ) { print \"1\" }"|bc -l)
|
||||
}
|
||||
|
||||
assert()
|
||||
{
|
||||
expr="$1"
|
||||
str="$2"
|
||||
|
||||
debug "assert: expr='$expr'"
|
||||
ret=$(bc_test "$expr")
|
||||
|
||||
[ ! -z "$ret" ] && return
|
||||
|
||||
die "$str"
|
||||
}
|
||||
|
||||
usage()
|
||||
{
|
||||
cat <<EOT
|
||||
Description: Display unicode characters representing the relative
|
||||
level of some indicator value within a range.
|
||||
|
||||
Usage: $script_name [options] -c <current_num>
|
||||
$script_name [options] <current_num>
|
||||
$script_name <current_num>
|
||||
|
||||
Options:
|
||||
|
||||
-a : Accessibility mode: only output ASCII.
|
||||
(Also enabled if variable '$a11y_variable' set).
|
||||
-b : Display current value as space if zero, rather than lowest
|
||||
'value' of theme.
|
||||
-c <num> : Current value of your indicator.
|
||||
-d : Enable debug output.
|
||||
-e <int> : Number of decimal places to use for accessibility mode
|
||||
(default=$default_decimal_places).
|
||||
-h : Show this help.
|
||||
-i : Invert colour scheme (rating themes only).
|
||||
-l : List available themes. If '-t' also specified,
|
||||
show all values for specified theme.
|
||||
-m <num> : Minimum value (default=$min_default).
|
||||
-n : Supress output of newline character.
|
||||
-p : Permissive mode - if current value out of bounds, set it
|
||||
to the nearest bound (min or max).
|
||||
-q : Suppress messages (requires '-t').
|
||||
-r : Reverse 'direction' of display (rating theme only).
|
||||
-t <theme> : Name of theme (default=$theme_default).
|
||||
-u <chars> : Specify a user theme (2 or more values).
|
||||
-w <int> : Width of rating theme (default=$width_default).
|
||||
-x <num> : Maximum value (default=$max_default).
|
||||
|
||||
|
||||
Examples:
|
||||
|
||||
# Display character representing 27% using default theme.
|
||||
$script_name 27
|
||||
|
||||
# As above.
|
||||
$script_name -c 27
|
||||
|
||||
# Example showing floating-point and negative values.
|
||||
$script_name -c 1.100001 -m -5.00234 -x 2.71828 -t dice_6
|
||||
|
||||
# Use accessibility mode to display a percentage value
|
||||
# (rounded to nearest percentage)
|
||||
$script_name -m -22.613 -x 5.00212 -c 0.10203 -a -e 0
|
||||
|
||||
# Display value using a "rating theme" (displayed left-to-right).
|
||||
$script_name -c 83 -t stars_2
|
||||
|
||||
# Display right-to-left inverted "rating theme".
|
||||
$script_name -c 60 -t diamonds_2 -ri
|
||||
|
||||
# Display all glyphs in 'solid_numbers_a_10' theme.
|
||||
$script_name -l -t solid_numbers_a_10
|
||||
|
||||
# Display a user-specified rating theme 10 glyphs wide.
|
||||
$script_name -c 666.321 -m -273.15 -x 1370 -u "· ☢" -w 10
|
||||
|
||||
# A multi-element user theme (this prints 'e').
|
||||
$script_name -c 50 -u "a b c d e f g h i j"
|
||||
|
||||
|
||||
Notes:
|
||||
|
||||
- Arguments of type "<int>" denote an integer value, whereas arguments
|
||||
of type "<num>" denotes either an integer or a floating-point
|
||||
number.
|
||||
- The final '_<number>' in a theme name denotes the number of glyphs
|
||||
in it.
|
||||
- "Rating themes" are those with only 2 values.
|
||||
- The <chars> argument to '-u' must contain space-delimited
|
||||
characters.
|
||||
|
||||
EOT
|
||||
}
|
||||
|
||||
# this is horribly inefficient - we should probably do some clever
|
||||
# tricks using printf formats to avoid the silly while loop.
|
||||
# Additionally, it is rather similar to show_theme_entry() but was split
|
||||
# out from that in a vain attempt to make the overall logic clearer :)
|
||||
show_rating_theme()
|
||||
{
|
||||
theme="$1"
|
||||
min="$2"
|
||||
max="$3"
|
||||
current="$4"
|
||||
percent="$5"
|
||||
|
||||
if [ $invert = n ]
|
||||
then
|
||||
on=1
|
||||
off=0
|
||||
else
|
||||
on=0
|
||||
off=1
|
||||
fi
|
||||
|
||||
debug "width=$width"
|
||||
debug "percent=$percent"
|
||||
|
||||
percent_per_glyph=$(echo "scale=4;100/${width}"|bc -l)
|
||||
assert "$percent_per_glyph > 1.0" "width ($width) too great"
|
||||
debug "percent_per_glyph=$percent_per_glyph"
|
||||
|
||||
debug "glyph_count=$glyph_count"
|
||||
|
||||
g=$percent_per_glyph
|
||||
i=0
|
||||
value=""
|
||||
while [ $i -lt $width ]
|
||||
do
|
||||
if [ ! -z "$(bc_test "$g <= $percent")" ]
|
||||
then
|
||||
eval content="\${$theme[${on}]}"
|
||||
else
|
||||
eval content="\${$theme[${off}]}"
|
||||
fi
|
||||
if [ $reverse = n ]
|
||||
then
|
||||
value="${value}${content}"
|
||||
else
|
||||
value="${content}${value}"
|
||||
fi
|
||||
g=$(echo "$g + $percent_per_glyph"|bc -l)
|
||||
i=$((i + 1))
|
||||
done
|
||||
echo $newline "$value"
|
||||
}
|
||||
|
||||
show_theme_entry()
|
||||
{
|
||||
theme="$1"
|
||||
min="$2"
|
||||
max="$3"
|
||||
current="$4"
|
||||
|
||||
debug "theme=$theme"
|
||||
debug "min=$min"
|
||||
debug "max=$max"
|
||||
debug "current=$current"
|
||||
|
||||
range=$(echo "($max - $min)"|bc -l)
|
||||
|
||||
quotient=$(echo "scale=4;((${current} - ${min})/${range})"|bc -l)
|
||||
percent=$(echo "$quotient * 100"|bc -l)
|
||||
|
||||
glyph_count=$(echo $theme|awk -F\_ '{print $NF}')
|
||||
|
||||
debug "range=$range"
|
||||
debug "quotient=$quotient"
|
||||
debug "percent=$percent"
|
||||
debug "glyph_count=$glyph_count"
|
||||
|
||||
# just ASCII please
|
||||
if [ $a11y = y ]
|
||||
then
|
||||
[ -z "$decimal_places" ] && decimal_places=$default_decimal_places
|
||||
val=$(echo|awk -v p=$percent -v dp=$decimal_places '{printf("%.*f", dp, p)}')
|
||||
echo $newline "$val"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ $glyph_count -eq 2 ]
|
||||
then
|
||||
show_rating_theme "$theme" "$min" "$max" "$current" "$percent"
|
||||
return
|
||||
fi
|
||||
|
||||
percent_per_glyph=$(echo "100/$glyph_count"|bc -l)
|
||||
debug "percent_per_glyph=$percent_per_glyph"
|
||||
|
||||
assert "$percent_per_glyph > 1.0" "width ($width) too great"
|
||||
|
||||
# with this scheme, assuming current value is 0-100 and theme has 10
|
||||
# elements:
|
||||
#
|
||||
# current glyph from theme
|
||||
#
|
||||
# 0-19 1st
|
||||
# 20-29 2nd
|
||||
# 30-39 3rd
|
||||
# :
|
||||
# 90-99 9th
|
||||
# 100 10th
|
||||
i=$(echo|awk \
|
||||
-v quotient=$quotient \
|
||||
-v glyph_count=$glyph_count \
|
||||
'{
|
||||
x= int( (quotient * glyph_count) ) - 1;
|
||||
x = (x > (glyph_count-1) ? (glyph_count-1) : x);
|
||||
if ( x < 0 ) x = 0;
|
||||
printf("%d", x);
|
||||
}')
|
||||
|
||||
debug "index=$i"
|
||||
eval content="\${$theme[$i]}"
|
||||
|
||||
[ ! -z "$(bc_test "$current == 0")" -a $zero_as_space = y ] && content=' '
|
||||
echo $newline "$content"
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
list_theme()
|
||||
{
|
||||
theme="$1"
|
||||
eval content="\${$theme[@]}"
|
||||
echo
|
||||
for c in $content
|
||||
do
|
||||
printf "$c "
|
||||
done
|
||||
echo -e "\n"
|
||||
}
|
||||
|
||||
list_themes()
|
||||
{
|
||||
for entry in ${theme_list[@]}
|
||||
do
|
||||
for arg in "$entry"
|
||||
do
|
||||
echo "$arg"
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
theme_valid()
|
||||
{
|
||||
theme="$1"
|
||||
[ -z "`list_themes|grep "^${theme}$"`" ] && return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
check_a11y
|
||||
|
||||
# XXX: the seemingly pointless 'tr' calls translate unicode dashes (look
|
||||
# closely!) into ASCII dashes. This is required since 'bc' borks on
|
||||
# unicode and it is easy to mistakenly pass unicode dashes if you paste
|
||||
# characters from another application, such as a web-browser.
|
||||
while getopts "abc:de:hilm:npqrt:u:w:x:" opt
|
||||
do
|
||||
case "$opt" in
|
||||
a)
|
||||
a11y=y
|
||||
;;
|
||||
|
||||
b)
|
||||
zero_as_space=y
|
||||
;;
|
||||
|
||||
c)
|
||||
current=$(echo $OPTARG|tr '−' '-')
|
||||
;;
|
||||
|
||||
d)
|
||||
debug_enabled=y
|
||||
;;
|
||||
|
||||
e)
|
||||
decimal_places=$OPTARG
|
||||
;;
|
||||
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
|
||||
i)
|
||||
invert=y
|
||||
;;
|
||||
|
||||
l)
|
||||
list=y
|
||||
;;
|
||||
|
||||
m)
|
||||
min=$(echo $OPTARG|tr '−' '-')
|
||||
;;
|
||||
|
||||
n)
|
||||
newline=-n
|
||||
;;
|
||||
|
||||
p)
|
||||
permissive=y
|
||||
;;
|
||||
|
||||
q)
|
||||
quiet=y
|
||||
;;
|
||||
|
||||
r)
|
||||
reverse=y
|
||||
;;
|
||||
|
||||
t)
|
||||
theme=$OPTARG
|
||||
;;
|
||||
|
||||
u)
|
||||
user_theme="$OPTARG"
|
||||
;;
|
||||
|
||||
w)
|
||||
width=$OPTARG
|
||||
;;
|
||||
|
||||
x)
|
||||
max=$(echo $OPTARG|tr '−' '-')
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
shift $[$OPTIND-1]
|
||||
|
||||
if [ ! -z "$user_theme" ]
|
||||
then
|
||||
elements=$(echo "$user_theme"|awk '{print NF}')
|
||||
|
||||
assert "$elements >= 2" "user themes need >= 2 values"
|
||||
|
||||
# create new theme
|
||||
name="_user_${elements}"
|
||||
eval "$name=($user_theme)"
|
||||
|
||||
# add it to list
|
||||
theme_list=("${theme_list[@]}" $name)
|
||||
|
||||
[ -z "$theme" ] && theme=$name
|
||||
fi
|
||||
|
||||
if [ "$list" = y ]
|
||||
then
|
||||
if [ -z "$theme" ]
|
||||
then
|
||||
list_themes && exit 0
|
||||
else
|
||||
theme_valid "$theme" || die "invalid theme: $theme"
|
||||
[ "$quiet" = n ] && echo "Listing theme '$theme'"
|
||||
list_theme $theme && exit 0
|
||||
fi
|
||||
fi
|
||||
[ -z "$min" ] && min=$min_default
|
||||
[ -z "$max" ] && max=$max_default
|
||||
[ -z "$width" ] && width=$width_default
|
||||
|
||||
assert "$min <= $max" "minimum ($min) > maximum ($max)"
|
||||
assert "$min != $max" "minimum ($min) == maximum"
|
||||
|
||||
[ -z "$current" -a ! -z "$1" ] && current="$1"
|
||||
|
||||
if [ -z "$current" ]
|
||||
then
|
||||
error "must specify current value"
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $permissive = n ]
|
||||
then
|
||||
assert "$current >= $min" "current ($current) < minimum ($min)"
|
||||
assert "$current <= $max" "current ($current) > maximum ($max)"
|
||||
else
|
||||
[ ! -z "$(bc_test "$current < $min")" ] && current=$min
|
||||
[ ! -z "$(bc_test "$current > $max")" ] && current=$max
|
||||
fi
|
||||
|
||||
[ -z "$theme" ] && theme=$theme_default
|
||||
|
||||
theme_valid "$theme" || die "invalid theme: $theme"
|
||||
|
||||
show_theme_entry $theme $min $max $current
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,49 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# apport: note if there are crash dumps available for apporting
|
||||
#
|
||||
# Copyright (C) 2009 Canonical Ltd.
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__apport_detail() {
|
||||
for i in /var/crash/*.crash; do
|
||||
if [ -f "$i" ]; then
|
||||
printf "\nTo file bugs on the existing crash reports, run:\n"
|
||||
which apport-cli >/dev/null || printf " sudo apt-get install apport\n"
|
||||
for i in /var/crash/*.crash; do
|
||||
printf " apport-cli $i\n"
|
||||
done
|
||||
printf "\nTo clear the pending reports:\n"
|
||||
printf " rm -f /var/crash/*.crash\n\n"
|
||||
return
|
||||
fi
|
||||
done
|
||||
printf "No pending crash reports\n"
|
||||
}
|
||||
|
||||
__apport() {
|
||||
# Print {!} if a /var/crash/*.crash file exists
|
||||
for i in /var/crash/*.crash; do
|
||||
if [ -f "$i" ]; then
|
||||
color y k; printf "{!}"; color --
|
||||
return
|
||||
fi
|
||||
done
|
||||
rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/apport"*
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,30 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# arch: print the machine architecture
|
||||
#
|
||||
# Copyright (C) 2008 Canonical Ltd.
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__arch_detail() {
|
||||
uname -a
|
||||
}
|
||||
|
||||
__arch() {
|
||||
printf "%s " $(uname -m)
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,92 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
__battery_detail() {
|
||||
local bat
|
||||
for bat in /proc/acpi/battery/*; do
|
||||
cat "$bat/info"
|
||||
cat "$bat/state"
|
||||
done
|
||||
}
|
||||
|
||||
__battery() {
|
||||
local bat line present sign state percent full rem color bcolor
|
||||
present=""; full="0"; rem="0"; state=""
|
||||
case "$(uname)" in
|
||||
OpenBSD)
|
||||
percent=$(apm -l)
|
||||
case $(apm -a) in
|
||||
0) state="discharging";;
|
||||
1) state="charging";;
|
||||
2) state="on-line";;
|
||||
esac
|
||||
;;
|
||||
Linux)
|
||||
for bat in $BATTERY /sys/class/power_supply/* /proc/acpi/battery/*; do
|
||||
case "$bat" in
|
||||
/sys/*)
|
||||
if [ -r "$bat/uevent" ]; then
|
||||
. "$bat/uevent"
|
||||
case "$POWER_SUPPLY_NAME" in AC|ac|Ac|aC) continue ;; esac
|
||||
present="$POWER_SUPPLY_PRESENT"
|
||||
[ -n "$POWER_SUPPLY_CHARGE_FULL" ] && full=$((POWER_SUPPLY_CHARGE_FULL+full))
|
||||
[ -n "$POWER_SUPPLY_ENERGY_FULL" ] && full=$((POWER_SUPPLY_ENERGY_FULL+full))
|
||||
[ -n "$POWER_SUPPLY_CHARGE_NOW" ] && rem=$((POWER_SUPPLY_CHARGE_NOW+rem))
|
||||
[ -n "$POWER_SUPPLY_ENERGY_NOW" ] && rem=$((POWER_SUPPLY_ENERGY_NOW+rem))
|
||||
if [ -n "$POWER_SUPPLY_CAPACITY" ] && [ ! -n "$POWER_SUPPLY_ENERGY_NOW" ] && [ ! -n "$POWER_SUPPLY_CHARGE_NOW" ]; then
|
||||
rem="$POWER_SUPPLY_CAPACITY" && full="100"
|
||||
fi
|
||||
[ "$POWER_SUPPLY_STATUS" != "Unknown" ] && state="$POWER_SUPPLY_STATUS"
|
||||
fi
|
||||
;;
|
||||
/proc/*)
|
||||
[ -f "$bat/info" ] || continue
|
||||
while read line; do
|
||||
set -- ${line}
|
||||
case "$line" in
|
||||
present:*)
|
||||
[ "$2" = "no" ] && continue 2
|
||||
present="$2";;
|
||||
last\ full\ capacity:*) full="$4";;
|
||||
esac
|
||||
[ -n "$present" -a -n "$full" ] && break
|
||||
done < "${bat}/info"
|
||||
while read line; do
|
||||
set -- ${line}
|
||||
case "$line" in
|
||||
remaining\ capacity:*) rem="$3";;
|
||||
charging\ state:*) state="$3";;
|
||||
esac
|
||||
[ -n "$rem" -a -n "$state" ] && break
|
||||
done < "$bat/state"
|
||||
[ -n "$full" ] && [ -n "$rem" ] && [ -n "$state" ] && break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
esac
|
||||
|
||||
if [ $percent -ge 0 ]; then
|
||||
if [ "$percent" -lt 33 ]; then
|
||||
color="R w"
|
||||
bcolor="b R w"
|
||||
elif [ "$percent" -lt 67 ]; then
|
||||
color="Y k"
|
||||
bcolor="b Y k"
|
||||
else
|
||||
color="G k"
|
||||
bcolor="b G k"
|
||||
fi
|
||||
percent="${percent}${PCT}"
|
||||
state=$(printf "%s" "$state" | $BYOBU_SED 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')
|
||||
case $state in
|
||||
charging) sign="+" ;;
|
||||
discharging) sign="-" ;;
|
||||
on-line) sign="=" ;;
|
||||
*) sign="$state" ;;
|
||||
esac
|
||||
if [ -z "$percent" ]; then
|
||||
rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/battery"*
|
||||
return
|
||||
fi
|
||||
color $bcolor; printf "%s" "$percent"; color -; color $color; printf "%s" "$sign"; color --
|
||||
fi
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# color: print the background/foreground color escape codes
|
||||
#
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__color_detail() {
|
||||
true
|
||||
}
|
||||
|
||||
__color() {
|
||||
[ -z "$FOREGROUND" ] && FOREGROUND="w"
|
||||
[ -z "$BACKGROUND" ] && BACKGROUND="k"
|
||||
case "$BYOBU_BACKEND" in
|
||||
tmux)
|
||||
true
|
||||
;;
|
||||
screen)
|
||||
printf "\005{= $BACKGROUND$FOREGROUND}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,32 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# cpu_count: count cpu's on a systems
|
||||
#
|
||||
# Copyright (C) 2008 Canonical Ltd.
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__cpu_count_detail() {
|
||||
grep -i "^model name" /proc/cpuinfo
|
||||
}
|
||||
|
||||
__cpu_count() {
|
||||
local c
|
||||
c=$(getconf _NPROCESSORS_ONLN 2>/dev/null || grep -ci "^processor" /proc/cpuinfo)
|
||||
[ "$c" = "1" ] || printf "%sx" "$c"
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,50 @@
|
|||
#!/bin/sh -e
|
||||
__cpu_freq_detail() {
|
||||
cat /proc/cpuinfo
|
||||
}
|
||||
|
||||
__cpu_freq() {
|
||||
local hz freq count cores unit=""
|
||||
if [ -r "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq" ]; then
|
||||
# Linux
|
||||
cores=$(getconf _NPROCESSORS_ONLN 2>/dev/null)
|
||||
read hz < /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
|
||||
fpdiv $hz "1000000" 1 # 1Ghz
|
||||
freq="${_RET}"
|
||||
unit="GHz"
|
||||
elif [ -r "/proc/cpuinfo" ]; then
|
||||
# 他のLinux
|
||||
cores=$(getconf _NPROCESSORS_ONLN 2>/dev/null || grep -ci "^processor" /proc/cpuinfo)
|
||||
if egrep -q -s -i -m 1 "^cpu MHz|^clock" /proc/cpuinfo; then
|
||||
freq=$(egrep -i -m 1 "^cpu MHz|^clock" /proc/cpuinfo | awk -F"[:.]" '{ printf "%01.1f", $2 / 1000 }')
|
||||
unit="GHz"
|
||||
else
|
||||
freq=$(egrep -i -m 1 "^bogomips" /proc/cpuinfo | awk -F"[:.]" '{ print $2 }')
|
||||
freq=$(printf "%s %s" "$freq" "$count" | awk '{printf "%01.1f\n", $1/$2/1000}')
|
||||
unit="GHz"
|
||||
fi
|
||||
elif hz=$(sysctl -n dev.cpu.0.freq 2>/dev/null); then
|
||||
# FreeBSD
|
||||
cores=$(sysctl -n hw.ncpu 2>/dev/null)
|
||||
if [ "$hz" -ge "1000" ]; then
|
||||
fpdiv $hz "1000" 1 # 1Ghz
|
||||
freq="${_RET}"
|
||||
unit="GHz"
|
||||
else
|
||||
freq="${hz}"
|
||||
unit="MHz"
|
||||
fi
|
||||
elif cores=$(sysctl -n hw.ncpuonline 2>/dev/null) && hz=$(sysctl -n hw.cpuspeed 2>/dev/null); then
|
||||
# OpenBSD
|
||||
if [ "$hz" -ge "1000" ]; then
|
||||
fpdiv $hz "1000" 1 # 1Ghz
|
||||
freq="${_RET}"
|
||||
unit="GHz"
|
||||
else
|
||||
freq="${hz}"
|
||||
unit="MHz"
|
||||
fi
|
||||
fi
|
||||
[ -n "$freq" ] || return
|
||||
color c W; printf "%s" "${cores}x"; color b c W; printf "%s" "$freq"; color -; color c W; printf "%s" "$unit"; color --
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# cpu_temp: cpu temperature
|
||||
#
|
||||
# Copyright (C) 2008 Canonical Ltd.
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__cpu_temp_detail() {
|
||||
local i
|
||||
for i in $MONITORED_TEMP /sys/class/hwmon/hwmon*/device/temp*_input /sys/class/hwmon/hwmon*/temp*_input /proc/acpi/ibm/thermal /proc/acpi/thermal_zone/*/temperature /sys/class/thermal/thermal_zone*/temp; do
|
||||
[ -r "$i" ] || continue
|
||||
printf "%s\n" "$i:"
|
||||
cat "$i"/*
|
||||
done
|
||||
}
|
||||
|
||||
__cpu_temp() {
|
||||
local i t unit
|
||||
for i in $MONITORED_TEMP /sys/class/hwmon/hwmon*/device/temp*_input /sys/class/hwmon/hwmon*/temp*_input /proc/acpi/ibm/thermal /proc/acpi/thermal_zone/*/temperature /sys/class/thermal/thermal_zone*/temp; do
|
||||
case "$i" in
|
||||
*temp*_input|*thermal_zone*/temp)
|
||||
[ -s "$i" ] && read t < "$i" && t=$(($t/1000))
|
||||
;;
|
||||
*)
|
||||
[ -s "$i" ] && t=$($BYOBU_SED -e "s/^[^0-9]\+//" -e "s/\s.*$//" "$i")
|
||||
;;
|
||||
esac
|
||||
if [ -n "$t" ] && [ "$t" -gt 0 ]; then
|
||||
unit="$ICON_C"
|
||||
if [ "$TEMP" = "F" ]; then
|
||||
t=$(($t*9/5 + 32))
|
||||
unit="$ICON_F"
|
||||
fi
|
||||
color b k Y; printf "%s" "$t"; color -; color k Y; printf "%s" "$unit"; color --
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,68 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# custom: run the user's custom status scripts
|
||||
#
|
||||
# Copyright (C) 2009 Canonical Ltd.
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__custom_detail() {
|
||||
return
|
||||
}
|
||||
|
||||
__custom() {
|
||||
local cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/custom"
|
||||
local i= output=
|
||||
for i in "$BYOBU_CONFIG_DIR/bin/"[0-9]*_*; do
|
||||
# Loop over custom scripts
|
||||
# Ensure executable
|
||||
[ -x "$i" ] || continue
|
||||
# Ignore vim backup files ending in ~
|
||||
case "$i" in
|
||||
*~) continue ;;
|
||||
esac
|
||||
local now="$(date +%s)"
|
||||
local script=${i##*/}
|
||||
local freq=${script%%_*}
|
||||
freq=${freq#0}
|
||||
local lastrun=
|
||||
[ -r "$cache.$script.last" ] && read lastrun < "$cache.$script.last" || lastrun=0
|
||||
local expiration=$(($lastrun+$freq))
|
||||
if [ $now -ge $expiration ]; then
|
||||
"$i" > "$cache.$script" 2>/dev/null
|
||||
printf "%s\n" "${now}" > "$cache.$script.last"
|
||||
fi
|
||||
readfile < "$cache.$script"
|
||||
local str="${_RET}"
|
||||
case "$str" in
|
||||
*"$ESC{"*)
|
||||
# User has formatted the colors
|
||||
output="$output$(printf "$str")"
|
||||
;;
|
||||
*)
|
||||
# Default coloring
|
||||
output="$output$str "
|
||||
;;
|
||||
esac
|
||||
done
|
||||
if [ -z "$output" ]; then
|
||||
rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/custom"*
|
||||
return
|
||||
fi
|
||||
printf "$output" | $BYOBU_SED ':a;N;$!ba;s/\n//g'
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,34 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# date: print the date in YYYY-MM-DD format
|
||||
#
|
||||
# Copyright (C) 2008 Canonical Ltd.
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__date_detail() {
|
||||
date
|
||||
}
|
||||
|
||||
__date() {
|
||||
case "$BYOBU_BACKEND" in
|
||||
screen)
|
||||
color none; printf "\005Y-\005m-\005d"; color --
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,40 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
__disk_detail() {
|
||||
df -h -P
|
||||
}
|
||||
|
||||
__disk() {
|
||||
local out="" MP="" size="" free="" unit=""
|
||||
[ -z "$MONITORED_DISK" ] && MP="/" || MP="$MONITORED_DISK"
|
||||
case $MP in
|
||||
/dev/*) MP=$(awk '$1 == m { print $2; exit(0); }' "m=$MP" /proc/mounts);;
|
||||
esac
|
||||
|
||||
if [ "$(uname)" = "FreeBSD" ]; then
|
||||
out=$(df -h | grep "${MP}$" | awk '{ printf("%s %s", $4, $2); }')
|
||||
else
|
||||
out=$({ df -h -P "$MP" 2>/dev/null || df -h "$MP"; } | awk 'END { printf("%s %s", $3, $2); }')
|
||||
fi
|
||||
|
||||
set -- ${out}
|
||||
free=${1}; size=${2};
|
||||
free_unit=${free#${free%?}}
|
||||
free=${free%?};
|
||||
unit=${size#${size%?}}
|
||||
size=${size%?};
|
||||
case "$unit" in
|
||||
k*|K*) unit="$ICON_KB" ;;
|
||||
m*|M*) unit="$ICON_MB" ;;
|
||||
g*|G*) unit="$ICON_GB" ;;
|
||||
t*|T*) unit="$ICON_TB" ;;
|
||||
esac
|
||||
case "$free_unit" in
|
||||
k*|K*) free_unit="$ICON_KB" ;;
|
||||
m*|M*) free_unit="$ICON_MB" ;;
|
||||
g*|G*) free_unit="$ICON_GB" ;;
|
||||
t*|T*) free_unit="$ICON_TB" ;;
|
||||
esac
|
||||
[ -n "$size" ] || return
|
||||
color b m W; printf "%s%s/%s%s" "$free" "$free_unit" "$size" "$unit"; color --;
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# disk_io: calculate the disk io rate
|
||||
#
|
||||
# Copyright (C) 2010 Canonical Ltd.
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__disk_io_detail() {
|
||||
if eval $BYOBU_TEST iostat >/dev/null; then
|
||||
iostat -d -m -h
|
||||
else
|
||||
printf "%s\n" "Please install iostat if you want detailed information on your disk throughput"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
getdisk() {
|
||||
local t=""
|
||||
if [ -L "${1}" ]; then
|
||||
t=$($BYOBU_READLINK -f "$1")
|
||||
else
|
||||
t="$1"
|
||||
fi
|
||||
t="${t##*/}";
|
||||
[ -h "/sys/block/$t" ] && _RET="$t" || rtrim "$t" "0-9"
|
||||
}
|
||||
|
||||
__disk_io() {
|
||||
local part= i=
|
||||
# Default to disk providing /, but let users override with MONITORED_DISK
|
||||
[ -z "$MONITORED_DISK" ] && mount_point="/" || mount_point="$MONITORED_DISK"
|
||||
# By default, we won't bug the user with the display of network traffic
|
||||
# below DISK_IO_THRESHOLD in kB/s; override in $BYOBU_CONFIG_DIR/status
|
||||
[ -n "$DISK_IO_THRESHOLD" ] || DISK_IO_THRESHOLD=50
|
||||
case "$mount_point" in
|
||||
/dev/*) part="${mount_point}";;
|
||||
*) part=$(awk '$2 == mp { print $1 ; exit(0); }' "mp=$mount_point" /etc/mtab);;
|
||||
esac
|
||||
[ -e "$part" ] || return
|
||||
getdisk "$part"
|
||||
local disk=${_RET}
|
||||
local t2=$(date +%s) t1=
|
||||
for i in "read" "write"; do
|
||||
local cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/disk.$i"
|
||||
t1=$(stat -c %Y "$cache") 2>/dev/null || t1=0
|
||||
local unit="kB/s"
|
||||
local rate=0 x1=0 x2=0 symbol= unit=
|
||||
if [ $t2 -le $t1 ]; then
|
||||
rate=0
|
||||
else
|
||||
[ -r "$cache" ] && read x1 < "$cache" || x1=0
|
||||
local a1= a2= a3= a4= a5= a6= a7= a8= a9= a10=
|
||||
read a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 other < "/sys/block/$disk/stat"
|
||||
if [ "$i" = "read" ]; then
|
||||
symbol="$ICON_RD"
|
||||
[ -n "$a3" ] && x2="$a3" || x2=0
|
||||
else
|
||||
symbol="$ICON_WR"
|
||||
[ -n "$a7" ] && x2="$a7" || x2=0
|
||||
fi
|
||||
printf "%s" "$x2" > "$cache"
|
||||
rate=$((($x2 - $x1) / ($t2 - $t1) * 512 / 1024))
|
||||
if [ $rate -lt $DISK_IO_THRESHOLD ]; then
|
||||
# Below threshold, don't print
|
||||
continue
|
||||
elif [ "$rate" -lt 0 ]; then
|
||||
rate=0
|
||||
elif [ "$rate" -gt 1048576 ]; then
|
||||
unit="GB/s"
|
||||
fpdiv "$rate" 1048576 0
|
||||
rate=${_RET}
|
||||
elif [ "$rate" -gt 1024 ]; then
|
||||
unit="MB/s"
|
||||
fpdiv "$rate" 1024 0
|
||||
rate=${_RET}
|
||||
else
|
||||
unit="kB/s"
|
||||
fi
|
||||
fi
|
||||
if [ -z "$rate" ] || [ "$rate" = "0" ]; then
|
||||
rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/disk_io"*
|
||||
else
|
||||
color b M W; printf "%s%s" "$symbol" "$rate"; color -; color M W; printf "%s" "$unit"; color --
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,37 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# distro: grab the distro/os
|
||||
#
|
||||
# Copyright (C) 2008 Canonical Ltd.
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__distro_detail() {
|
||||
lsb_release -a 2>/dev/null
|
||||
}
|
||||
|
||||
__distro() {
|
||||
local DISTRO="${DISTRO}"
|
||||
if [ -n "$DISTRO" ]; then
|
||||
# user defined
|
||||
true
|
||||
else
|
||||
DISTRO="$BYOBU_DISTRO"
|
||||
fi
|
||||
color bold2; printf "%s" "$DISTRO"; color --
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# entropy: system entropy
|
||||
#
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__entropy_detail() {
|
||||
cat /proc/sys/kernel/random/entropy_avail 2>/dev/null
|
||||
}
|
||||
|
||||
__entropy() {
|
||||
if [ -r /proc/sys/kernel/random/entropy_avail ]; then
|
||||
local e=$(cat /proc/sys/kernel/random/entropy_avail)
|
||||
[ -n "$e" ] || return
|
||||
color K Y; printf "e%s" "$e"; color --
|
||||
fi
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,58 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# fan_speed: speed of the cpu or case fan
|
||||
#
|
||||
# Copyright (C) 2009 Canonical Ltd.
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__fan_speed_detail() {
|
||||
# Nothing interesting to say here about fan speed
|
||||
return
|
||||
}
|
||||
|
||||
__fan_speed() {
|
||||
local i="" speed=0
|
||||
# Let's check a few different probes for fan speed
|
||||
# This seems to cover most of them:
|
||||
for i in $FAN /sys/class/hwmon/*/*/fan1_input /sys/class/hwmon/*/device/hwmon/*/fan1_input; do
|
||||
[ -f "$i" ] || continue
|
||||
read speed < "$i"
|
||||
if [ -n "$speed" ] && [ "$speed" -gt 0 ]; then
|
||||
color bold1; printf "%s" "$speed"; color -; color none; printf "rpm"; color --
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
# But others (e.g. Dell Inspirons) seem to be here:
|
||||
if [ -r /proc/i8k ]; then
|
||||
local line=""
|
||||
read line < /proc/i8k
|
||||
set -- $line
|
||||
for speed in $7 $8; do
|
||||
if [ -n "$speed" ] && [ "$speed" -gt 0 ]; then
|
||||
# I8K_FAN_MULT defaults to 30 (buggy BIOS workaround?),
|
||||
# use `modprobe i8k fan_mult=1` to disable if unneeded,
|
||||
# resulting in nonsensical speeds
|
||||
[ "$speed" -gt 10000 ] && speed=$((${speed} / 30))
|
||||
color bold1; printf "%s" "$speed"; color -; color none; printf "rpm"; color --
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,44 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# hostname: report a host's name
|
||||
#
|
||||
# Copyright (C) 2008-2011 Canonical Ltd.
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__hostname_detail() {
|
||||
hostname -f 2>/dev/null
|
||||
}
|
||||
|
||||
__hostname() {
|
||||
local h=
|
||||
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
|
||||
local cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/hostname"
|
||||
# Background a retrieval of our public hostname
|
||||
timeout 0.2 wget -q -O- http://169.254.169.254/latest/meta-data/public-hostname </dev/null >"$cache" 2>/dev/null &
|
||||
sleep 0.02
|
||||
[ -s "$cache" ] && read h < "$cache"
|
||||
fi
|
||||
[ -n "$h" ] || return
|
||||
color bold2; printf "%s" "$h"; color --
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,34 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# colors: some color values needed by all library status scripts
|
||||
#
|
||||
# Copyright (C) 2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Default colors
|
||||
# Inspired by http://design.ubuntu.com/brand/colour-palette
|
||||
|
||||
# Cool grey
|
||||
export BYOBU_DARK="\#333333"
|
||||
|
||||
# Warm white
|
||||
export BYOBU_LIGHT="\#EEEEEE"
|
||||
|
||||
# Aubergine
|
||||
export BYOBU_ACCENT="\#75507B"
|
||||
|
||||
# Ubuntu orange
|
||||
export BYOBU_HIGHLIGHT="\#DD4814"
|
|
@ -0,0 +1,55 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# common: common stuff sourced by all scripts
|
||||
#
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if [ -z "${BYOBU_INCLUDED_LIBS}" ]; then
|
||||
# Needed to set up $BYOBU_CONFIG_DIR
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/dirs"
|
||||
|
||||
# Find command/type/which
|
||||
for BYOBU_TEST in "command -v" "type" "which"; do
|
||||
eval $BYOBU_TEST ls >/dev/null 2>&1 && break || true
|
||||
done
|
||||
|
||||
# If the backend is already set (eg. running `byobu-tmux`), do nothing.
|
||||
if [ -z "${BYOBU_BACKEND}" ]; then
|
||||
[ -r "/etc/$PKG/backend" ] && . "/etc/$PKG/backend"
|
||||
[ -r "$BYOBU_CONFIG_DIR/backend" ] && . "$BYOBU_CONFIG_DIR/backend"
|
||||
# Just in case there's no config file at all
|
||||
if [ -z "${BYOBU_BACKEND}" ]; then
|
||||
# New byobu configuration, default to tmux
|
||||
if eval $BYOBU_TEST tmux >/dev/null; then
|
||||
BYOBU_BACKEND="tmux"
|
||||
elif eval $BYOBU_TEST screen >/dev/null; then
|
||||
BYOBU_BACKEND="screen"
|
||||
else
|
||||
printf "%s\n" "ERROR: $PKG won't work without tmux or screen installed" 1>&2
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Creating backend cache
|
||||
[ -d "$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND" ] || mkdir -p "$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND"
|
||||
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/shutil"
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/constants"
|
||||
get_distro || true
|
||||
export BYOBU_DISTRO="$_RET"
|
||||
BYOBU_INCLUDED_LIBS=1
|
||||
fi
|
|
@ -0,0 +1,397 @@
|
|||
#!/usr/bin/env python3
|
||||
#
|
||||
# config.py
|
||||
# Copyright (C) 2008 Canonical Ltd.
|
||||
# Copyright (C) 2008-2014 Dustin Kirkland <kirkland@byobu.org>
|
||||
|
||||
#
|
||||
# Authors: Nick Barcet <nick.barcet@ubuntu.com>
|
||||
# Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# If you change any strings, please generate localization information with:
|
||||
# ./debian/rules get-po
|
||||
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
import os
|
||||
import os.path
|
||||
import time
|
||||
import string
|
||||
import subprocess
|
||||
import gettext
|
||||
import glob
|
||||
|
||||
|
||||
def error(msg):
|
||||
print("ERROR: %s" % msg)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
try:
|
||||
import snack
|
||||
from snack import *
|
||||
except Exception:
|
||||
error("Could not import the python snack module")
|
||||
|
||||
|
||||
PKG = "byobu"
|
||||
HOME = os.getenv("HOME")
|
||||
USER = os.getenv("USER")
|
||||
BYOBU_CONFIG_DIR = os.getenv("BYOBU_CONFIG_DIR", HOME + "/.byobu")
|
||||
BYOBU_RUN_DIR = os.getenv("BYOBU_RUN_DIR", HOME + "/.cache/byobu")
|
||||
BYOBU_BACKEND = os.getenv("BYOBU_BACKEND", "tmux")
|
||||
BYOBU_SOCKETDIR = os.getenv("SOCKETDIR", "/var/run/screen")
|
||||
BYOBU_PREFIX = os.getenv("BYOBU_PREFIX", "/usr")
|
||||
SHARE = BYOBU_PREFIX + '/share/' + PKG
|
||||
DOC = BYOBU_PREFIX + '/share/doc/' + PKG
|
||||
if not os.path.exists(SHARE):
|
||||
SHARE = BYOBU_CONFIG_DIR + "/" + SHARE
|
||||
if not os.path.exists(DOC):
|
||||
DOC = BYOBU_PREFIX + '/share/doc/packages/' + PKG
|
||||
if not os.path.exists(DOC):
|
||||
DOC = BYOBU_CONFIG_DIR + "/" + DOC
|
||||
DEF_ESC = "A"
|
||||
RELOAD = "If you are using the default set of keybindings, press\n<F5> or <ctrl-a-R> to activate these changes.\n\nOtherwise, exit this session and start a new one."
|
||||
RELOAD_FLAG = "%s/reload-required" % (BYOBU_RUN_DIR)
|
||||
ESC = ''
|
||||
snack.hotkeys[ESC] = ord(ESC)
|
||||
snack.hotkeys[ord(ESC)] = ESC
|
||||
gettext.bindtextdomain(PKG, SHARE + '/po')
|
||||
gettext.textdomain(PKG)
|
||||
_ = gettext.gettext
|
||||
|
||||
|
||||
def ioctl_GWINSZ(fd):
|
||||
# Discover terminal width
|
||||
try:
|
||||
import fcntl
|
||||
import termios
|
||||
import struct
|
||||
import os
|
||||
cr = struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ, '1234'))
|
||||
except Exception:
|
||||
return None
|
||||
return cr
|
||||
|
||||
|
||||
def reload_required():
|
||||
try:
|
||||
if not os.path.exists(BYOBU_CONFIG_DIR):
|
||||
# 493 (decimal) is 0755 (octal)
|
||||
# Use decimal for portability across all python versions
|
||||
os.makedirs(BYOBU_CONFIG_DIR, 493)
|
||||
f = open(RELOAD_FLAG, 'w')
|
||||
f.close()
|
||||
if BYOBU_BACKEND == "screen":
|
||||
subprocess.call([BYOBU_BACKEND, "-X", "at", "0", "source", "%s/profile" % BYOBU_CONFIG_DIR])
|
||||
except Exception:
|
||||
True
|
||||
|
||||
|
||||
def terminal_size():
|
||||
# decide on some terminal size
|
||||
cr = ioctl_GWINSZ(0) or ioctl_GWINSZ(1) or ioctl_GWINSZ(2)
|
||||
# try open fds
|
||||
if not cr:
|
||||
# ...then ctty
|
||||
try:
|
||||
fd = os.open(os.ctermid(), os.O_RDONLY)
|
||||
cr = ioctl_GWINSZ(fd)
|
||||
os.close(fd)
|
||||
except Exception:
|
||||
pass
|
||||
if not cr:
|
||||
# env vars or finally defaults
|
||||
try:
|
||||
cr = (env['LINES'], env['COLUMNS'])
|
||||
except Exception:
|
||||
cr = (25, 80)
|
||||
# reverse rows, cols
|
||||
return int(cr[1] - 5), int(cr[0] - 5)
|
||||
|
||||
|
||||
def menu(snackScreen, size, isInstalled):
|
||||
if isInstalled:
|
||||
installtext = _("Byobu currently launches at login (toggle off)")
|
||||
else:
|
||||
installtext = _("Byobu currently does not launch at login (toggle on)")
|
||||
li = Listbox(height=6, width=60, returnExit=1)
|
||||
li.append(_("Help -- Quick Start Guide"), 1)
|
||||
li.append(_("Toggle status notifications"), 2)
|
||||
li.append(_("Change escape sequence"), 3)
|
||||
li.append(installtext, 4)
|
||||
bb = ButtonBar(snackScreen, (("Exit", "exit", ESC),), compact=1)
|
||||
g = GridForm(snackScreen, _(" Byobu Configuration Menu"), 1, 2)
|
||||
g.add(li, 0, 0, padding=(4, 2, 4, 2))
|
||||
g.add(bb, 0, 1, padding=(1, 1, 0, 0))
|
||||
if bb.buttonPressed(g.runOnce()) == "exit":
|
||||
return 0
|
||||
else:
|
||||
return li.current()
|
||||
|
||||
|
||||
def messagebox(snackScreen, width, height, title, text, scroll=0, buttons=((_("Okay"), "okay"), (_("Cancel"), "cancel", ESC))):
|
||||
t = Textbox(width, height, text, scroll=scroll)
|
||||
bb = ButtonBar(snackScreen, buttons, compact=1)
|
||||
g = GridForm(snackScreen, title, 1, 2)
|
||||
g.add(t, 0, 0, padding=(0, 0, 0, 0))
|
||||
g.add(bb, 0, 1, padding=(1, 1, 0, 0))
|
||||
return bb.buttonPressed(g.runOnce())
|
||||
|
||||
|
||||
def help(snackScreen, size):
|
||||
f = open(DOC + '/help.' + BYOBU_BACKEND + '.txt')
|
||||
text = f.read()
|
||||
f.close()
|
||||
text = text.replace("<esckey>", getesckey(), 1)
|
||||
t = Textbox(67, 16, text, scroll=1, wrap=1)
|
||||
bb = ButtonBar(snackScreen, ((_("Menu"), "menu", ESC),), compact=1)
|
||||
g = GridForm(snackScreen, _("Byobu Help"), 2, 4)
|
||||
g.add(t, 1, 0)
|
||||
g.add(bb, 1, 1, padding=(1, 1, 0, 0))
|
||||
button = bb.buttonPressed(g.runOnce())
|
||||
return 100
|
||||
|
||||
|
||||
def readstatus():
|
||||
status = {}
|
||||
glo = {}
|
||||
loc = {}
|
||||
for f in [SHARE + '/status/status', BYOBU_CONFIG_DIR + '/status']:
|
||||
if os.path.exists(f):
|
||||
try:
|
||||
exec(open(f).read(), glo, loc)
|
||||
except Exception:
|
||||
error("Invalid configuration [%s]" % f)
|
||||
if BYOBU_BACKEND == "tmux":
|
||||
items = "%s %s" % (loc["tmux_left"], loc["tmux_right"])
|
||||
else:
|
||||
items = "%s %s %s %s" % (loc["screen_upper_left"], loc["screen_upper_right"], loc["screen_lower_left"], loc["screen_lower_right"])
|
||||
for i in items.split():
|
||||
if i.startswith("#"):
|
||||
i = i.replace("#", "")
|
||||
status[i] = "0"
|
||||
else:
|
||||
status[i] = "1"
|
||||
li = []
|
||||
keys = list(status.keys())
|
||||
for i in sorted(keys):
|
||||
window = [int(status[i]), i]
|
||||
li.append(window)
|
||||
return li
|
||||
|
||||
|
||||
def genstatusstring(s, status):
|
||||
new = ""
|
||||
glo = {}
|
||||
loc = {}
|
||||
exec(open(SHARE + '/status/status').read(), glo, loc)
|
||||
for i in loc[s].split():
|
||||
if i.startswith("#"):
|
||||
i = i.replace("#", "")
|
||||
if status[i] == 1:
|
||||
new += " " + i
|
||||
else:
|
||||
new += " #" + i
|
||||
return new
|
||||
|
||||
|
||||
def writestatus(items):
|
||||
status = {}
|
||||
path = BYOBU_CONFIG_DIR + '/status'
|
||||
for i in items:
|
||||
status[i[1]] = i[0]
|
||||
for key in ["tmux_left", "tmux_right", "screen_upper_left", "screen_upper_right", "screen_lower_left", "screen_lower_right"]:
|
||||
if key.startswith(BYOBU_BACKEND):
|
||||
try:
|
||||
f = open(path, "r")
|
||||
except Exception:
|
||||
f = open(SHARE + '/status/status', "r")
|
||||
lines = f.readlines()
|
||||
f.close()
|
||||
try:
|
||||
f = open(path, "w")
|
||||
except Exception:
|
||||
f = open(path, "a+")
|
||||
for l in lines:
|
||||
if l.startswith("%s=" % key):
|
||||
val = genstatusstring(key, status)
|
||||
f.write("%s=\"%s\"\n" % (key, val))
|
||||
else:
|
||||
f.write(l)
|
||||
f.close
|
||||
|
||||
|
||||
def togglestatus(snackScreen, size):
|
||||
itemlist = readstatus()
|
||||
rl = Label("")
|
||||
r = CheckboxTree(12, scroll=1)
|
||||
count = 0
|
||||
for item in itemlist:
|
||||
if item[0] != -1:
|
||||
r.append(item[1], count, selected=item[0])
|
||||
count = count + 1
|
||||
bb = ButtonBar(snackScreen, ((_("Apply"), "apply"), (_("Cancel"), "cancel", ESC)), compact=1)
|
||||
g = GridForm(snackScreen, _("Toggle status notifications"), 2, 4)
|
||||
g.add(rl, 0, 0, anchorLeft=1, anchorTop=1, padding=(4, 0, 0, 1))
|
||||
g.add(r, 1, 0)
|
||||
g.add(bb, 1, 1, padding=(4, 1, 0, 0))
|
||||
if bb.buttonPressed(g.runOnce()) != "cancel":
|
||||
count = 0
|
||||
for item in itemlist:
|
||||
if item[0] != -1:
|
||||
item[0] = r.getEntryValue(count)[1]
|
||||
count = count + 1
|
||||
writestatus(itemlist)
|
||||
reload_required()
|
||||
return 100
|
||||
|
||||
|
||||
def install(snackScreen, size, isInstalled):
|
||||
out = ""
|
||||
if isInstalled:
|
||||
if subprocess.call(["byobu-launcher-uninstall"]) == 0:
|
||||
out = _("Byobu will not be launched next time you login.")
|
||||
button = messagebox(snackScreen, 60, 2, _("Message"), out, buttons=((_("Menu"), )))
|
||||
return 101
|
||||
else:
|
||||
if subprocess.call(["byobu-launcher-install"]) == 0:
|
||||
out = _("Byobu will be launched automatically next time you login.")
|
||||
button = messagebox(snackScreen, 60, 2, "Message", out, buttons=((_("Menu"), )))
|
||||
return 100
|
||||
|
||||
|
||||
def appendtofile(p, s):
|
||||
f = open(p, 'a')
|
||||
try:
|
||||
f.write(s)
|
||||
except IOError:
|
||||
f.close()
|
||||
return
|
||||
f.close()
|
||||
return
|
||||
|
||||
|
||||
def getesckey():
|
||||
line = ""
|
||||
if BYOBU_BACKEND == "tmux":
|
||||
path = BYOBU_CONFIG_DIR + '/keybindings.tmux'
|
||||
if os.path.exists(path):
|
||||
for l in open(path):
|
||||
if l.startswith("set -g prefix "):
|
||||
line = l
|
||||
else:
|
||||
return DEF_ESC
|
||||
else:
|
||||
path = BYOBU_CONFIG_DIR + '/keybindings'
|
||||
if os.path.exists(path):
|
||||
for l in open(path):
|
||||
if l.startswith("escape "):
|
||||
line = l
|
||||
else:
|
||||
return DEF_ESC
|
||||
if line == "":
|
||||
return DEF_ESC
|
||||
esc = line[line.find('^') + 1]
|
||||
if esc == "`":
|
||||
esc = " "
|
||||
return esc
|
||||
|
||||
|
||||
def setesckey(key):
|
||||
if key.isalpha():
|
||||
# throw away outputs in order that the view isn't broken
|
||||
nullf = open(os.devnull, "w")
|
||||
subprocess.call(["byobu-ctrl-a", "screen", key], stdout=nullf)
|
||||
nullf.close()
|
||||
|
||||
|
||||
def chgesc(snackScreen, size):
|
||||
esc = Entry(2, text=getesckey(), returnExit=1)
|
||||
escl = Label(_("Escape key: ctrl-"))
|
||||
bb = ButtonBar(snackScreen, ((_("Apply"), "apply"), (_("Cancel"), "cancel", ESC)), compact=1)
|
||||
g = GridForm(snackScreen, _("Change escape sequence"), 2, 4)
|
||||
g.add(escl, 0, 0, anchorLeft=1, padding=(1, 0, 0, 1))
|
||||
g.add(esc, 1, 0, anchorLeft=1)
|
||||
g.add(bb, 1, 1)
|
||||
g.setTimer(100)
|
||||
loop = 1
|
||||
while loop:
|
||||
which = g.run()
|
||||
if which == "TIMER":
|
||||
val = esc.value()
|
||||
if len(val) > 1:
|
||||
esc.set(val[1])
|
||||
# Ensure that escape sequence is not \ or /
|
||||
if val == '/' or val == '\\':
|
||||
esc.set(DEF_ESC)
|
||||
# Ensure that the escape sequence is not set to a number
|
||||
try:
|
||||
dummy = int(esc.value())
|
||||
esc.set(DEF_ESC)
|
||||
except Exception:
|
||||
# do nothing
|
||||
dummy = "foo"
|
||||
else:
|
||||
loop = 0
|
||||
snackScreen.popWindow()
|
||||
button = bb.buttonPressed(which)
|
||||
if button != "cancel":
|
||||
setesckey(esc.value())
|
||||
reload_required()
|
||||
if button == "exit":
|
||||
return 0
|
||||
return 100
|
||||
|
||||
|
||||
def autolaunch():
|
||||
if os.path.exists(BYOBU_CONFIG_DIR + "/disable-autolaunch"):
|
||||
return 0
|
||||
try:
|
||||
for line in open("%s/.profile" % HOME):
|
||||
if "byobu-launch" in line:
|
||||
return 1
|
||||
except Exception:
|
||||
return 0
|
||||
if os.path.exists("/etc/profile.d/Z97-%s.sh" % PKG):
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
def main():
|
||||
"""This is the main loop of our utility"""
|
||||
size = terminal_size()
|
||||
snackScreen = SnackScreen()
|
||||
snackScreen.drawRootText(1, 0, _('Byobu Configuration Menu'))
|
||||
snackScreen.pushHelpLine(_('<Tab> between elements | <Enter> selects | <Esc> exits'))
|
||||
isInstalled = autolaunch()
|
||||
tag = 100
|
||||
while tag > 0:
|
||||
tag = menu(snackScreen, size, isInstalled)
|
||||
if tag == 1:
|
||||
tag = help(snackScreen, size)
|
||||
elif tag == 2:
|
||||
tag = togglestatus(snackScreen, size)
|
||||
elif tag == 3:
|
||||
tag = chgesc(snackScreen, size)
|
||||
elif tag == 4:
|
||||
tag = install(snackScreen, size, isInstalled)
|
||||
isInstalled = autolaunch()
|
||||
snackScreen.finish()
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1,73 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# constants: some constant values needed by all library status scripts
|
||||
#
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
PKG="byobu"
|
||||
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/icons"
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/colors"
|
||||
|
||||
PCT="%"
|
||||
|
||||
# Support two different backends (screen/tmux)
|
||||
if [ -z "$BYOBU_BACKEND" ]; then
|
||||
[ -r "/etc/byobu/backend" ] && . "/etc/byobu/backend"
|
||||
[ -r "$BYOBU_CONFIG_DIR/backend" ] && . "$BYOBU_CONFIG_DIR/backend"
|
||||
fi
|
||||
case "$BYOBU_BACKEND" in
|
||||
tmux)
|
||||
export BYOBU_BACKEND
|
||||
BYOBU_ARG_VERSION="-V"
|
||||
ESC=
|
||||
;;
|
||||
screen)
|
||||
export BYOBU_BACKEND
|
||||
BYOBU_ARG_VERSION="-v"
|
||||
ESC="\005"
|
||||
;;
|
||||
esac
|
||||
|
||||
# MacOS Support
|
||||
eval $BYOBU_TEST gsed >/dev/null 2>&1 && export BYOBU_SED="gsed" || export BYOBU_SED="sed"
|
||||
eval $BYOBU_TEST greadlink >/dev/null 2>&1 && export BYOBU_READLINK="greadlink" || export BYOBU_READLINK="readlink"
|
||||
eval $BYOBU_TEST sensible-pager >/dev/null 2>&1 && export BYOBU_PAGER="sensible-pager" || export BYOBU_PAGER="less"
|
||||
eval $BYOBU_TEST sensible-editor >/dev/null 2>&1 && export BYOBU_EDITOR="sensible-editor" || export BYOBU_EDITOR="$EDITOR"
|
||||
eval $BYOBU_TEST "$BYOBU_EDITOR" >/dev/null 2>&1 || export BYOBU_EDITOR="vim"
|
||||
|
||||
|
||||
# Check sed's follow-symlinks feature
|
||||
$BYOBU_SED --follow-symlinks "s///" /dev/null 2>/dev/null && BYOBU_SED_INLINE="$BYOBU_SED -i --follow-symlinks" || BYOBU_SED_INLINE="$BYOBU_SED -i"
|
||||
|
||||
# Determine if we have ulimit support
|
||||
eval $BYOBU_TEST ulimit >/dev/null 2>&1 && export BYOBU_ULIMIT="ulimit" || export BYOBU_ULIMIT="false"
|
||||
|
||||
# Find a suitable python interpreter, if undefined
|
||||
if [ -z "$BYOBU_PYTHON" ]; then
|
||||
if python3 -c "import snack" >/dev/null 2>&1; then
|
||||
export BYOBU_PYTHON="python3"
|
||||
elif python2 -c "import snack" >/dev/null 2>&1; then
|
||||
export BYOBU_PYTHON="python2"
|
||||
elif python -c "import snack" >/dev/null 2>&1; then
|
||||
export BYOBU_PYTHON="python"
|
||||
fi
|
||||
fi
|
||||
|
||||
export BYOBU_WINDOW_NAME="-"
|
||||
export BYOBU_DATE="%Y-%m-%d "
|
||||
export BYOBU_TIME="%H:%M:%S"
|
|
@ -0,0 +1,41 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# cycle-status: cycle the status bar through multiple configurations
|
||||
#
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# Find line number of the enabled tmux_right
|
||||
current=$(grep -n "^tmux_right=" "$BYOBU_CONFIG_DIR/status" | awk -F: '{print $1}' | tail -n1)
|
||||
|
||||
# Find next line number to enable
|
||||
all=$(grep -n "tmux_right=" "$BYOBU_CONFIG_DIR/status" | awk -F: '{print $1}')
|
||||
next=
|
||||
for i in $all $all; do
|
||||
if [ "$next" = "flagged" ]; then
|
||||
next="$i"
|
||||
break
|
||||
elif [ "$i" = "$current" ]; then
|
||||
next="flagged"
|
||||
fi
|
||||
done
|
||||
|
||||
# Disable all
|
||||
sed -i -e "s/^tmux_right=/#tmux_right=/" "$BYOBU_CONFIG_DIR/status"
|
||||
|
||||
# Enable the next one
|
||||
sed -i -e "${next}s/^#tmux_right=/tmux_right=/" "$BYOBU_CONFIG_DIR/status"
|
|
@ -0,0 +1,72 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# dirs: some dirs needed by all library status scripts
|
||||
#
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
PKG="byobu"
|
||||
|
||||
# Some users build and install byobu themselves, rather than from a distro
|
||||
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
|
||||
[ -n "$BYOBU_PREFIX" ] || BYOBU_PREFIX="/usr"
|
||||
|
||||
# Create and export the user configuration directory
|
||||
if [ -d "$BYOBU_CONFIG_DIR" ]; then
|
||||
export BYOBU_CONFIG_DIR="$BYOBU_CONFIG_DIR"
|
||||
elif [ -d "$XDG_CONFIG_HOME" ]; then
|
||||
# Use XDG, as some users insist on such nonsense :-)
|
||||
export BYOBU_CONFIG_DIR="$XDG_CONFIG_HOME/$PKG"
|
||||
elif [ -d "$HOME/.config/$PKG" ]; then
|
||||
# Use XDG config directory, if it exists
|
||||
export BYOBU_CONFIG_DIR="$HOME/.config/$PKG"
|
||||
elif [ -d "$HOME/.local/share/$PKG" ]; then
|
||||
# Use XDG local directory, if it exists
|
||||
export BYOBU_CONFIG_DIR="$HOME/.local/share/$PKG"
|
||||
else
|
||||
# And to default to good old classic config dir location!
|
||||
export BYOBU_CONFIG_DIR="$HOME/.$PKG"
|
||||
fi
|
||||
[ -d "$BYOBU_CONFIG_DIR" ] || mkdir -p "$BYOBU_CONFIG_DIR/bin"
|
||||
|
||||
# Grab the global, then local socket directory
|
||||
[ -r "/etc/$PKG/socketdir" ] && . "/etc/$PKG/socketdir"
|
||||
[ -r "$BYOBU_CONFIG_DIR/socketdir" ] && . "$BYOBU_CONFIG_DIR/socketdir"
|
||||
|
||||
# Create and export the runtime cache directory
|
||||
if [ -w /dev/shm ]; then
|
||||
# Use shm for performance, if possible
|
||||
for i in /dev/shm/$PKG-$USER-*; do
|
||||
if [ -d "$i" ] && [ -O "$i" ]; then
|
||||
export BYOBU_RUN_DIR="$i"
|
||||
break
|
||||
fi
|
||||
done
|
||||
# Still empty, make a new one
|
||||
if [ ! -d "$BYOBU_RUN_DIR" ] || [ ! -O "$BYOBU_RUN_DIR" ]; then
|
||||
export BYOBU_RUN_DIR=$(mktemp -d /dev/shm/$PKG-$USER-XXXXXXXX)
|
||||
fi
|
||||
fi
|
||||
if [ ! -d "$BYOBU_RUN_DIR" ] || [ ! -O "$BYOBU_RUN_DIR" ] || [ ! -w "$BYOBU_RUN_DIR" ]; then
|
||||
# For distros that don't have a /dev/shm, use local disk
|
||||
if [ -d "$XDG_CACHE_HOME" ]; then
|
||||
# Use XDG, as some users insist on such nonsense :-)
|
||||
export BYOBU_RUN_DIR="$XDG_CACHE_HOME/$PKG"
|
||||
else
|
||||
# But if not, we'll use a cache directory
|
||||
export BYOBU_RUN_DIR="$HOME/.cache/$PKG"
|
||||
fi
|
||||
fi
|
|
@ -0,0 +1,82 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# icons: some icon characters for status scripts
|
||||
#
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
PKG="byobu"
|
||||
|
||||
# UTF-8 support in the hardstatus is coming one day in Screen
|
||||
if [ "$BYOBU_BACKEND" = "tmux" ] && [ "$BYOBU_CHARMAP" = "UTF-8" ]; then
|
||||
#ICON_C="℃"
|
||||
#ICON_F="℉"
|
||||
ICON_C="C"
|
||||
ICON_F="F"
|
||||
ICON_RD="◂"
|
||||
ICON_WR="▸"
|
||||
ICON_MAIL="⍌"
|
||||
ICON_UP="▴"
|
||||
ICON_DN="▾"
|
||||
ICON_TRASH="♸"
|
||||
ICON_WIFI=
|
||||
ICON_REBOOT="⟳"
|
||||
ICON_UPDATES="!"
|
||||
ICON_UPGRADE="⚠"
|
||||
ICON_SECURITY="‼"
|
||||
#ICON_KB="㎅"
|
||||
#ICON_MB="㎆"
|
||||
#ICON_GB="㎇"
|
||||
ICON_KB="K"
|
||||
ICON_MB="M"
|
||||
ICON_GB="G"
|
||||
ICON_TB="T"
|
||||
#ICON_KHz="㎑"
|
||||
#ICON_MHz="㎒"
|
||||
#ICON_GHz="㎓"
|
||||
ICON_KHz="KHz"
|
||||
ICON_MHz="MHz"
|
||||
ICON_GHz="GHz"
|
||||
#ICON_MBPS="㏔㎰"
|
||||
ICON_MBPS="Mb"
|
||||
ICON_SESSION="〣"
|
||||
ICON_LIVEPATCHED="🗹 "
|
||||
else
|
||||
# Only use 0-127 ANSI: http://ascii-table.com/ascii.php
|
||||
ICON_C="C"
|
||||
ICON_F="F"
|
||||
ICON_RD="<"
|
||||
ICON_WR=">"
|
||||
ICON_MAIL="[M]"
|
||||
ICON_UP="^"
|
||||
ICON_DN="v"
|
||||
ICON_TRASH="T"
|
||||
ICON_WIFI=
|
||||
ICON_REBOOT="(R)"
|
||||
ICON_UPDATES="!"
|
||||
ICON_UPGRADE="/!\\\\\\"
|
||||
ICON_SECURITY="!!"
|
||||
ICON_KB="KB"
|
||||
ICON_MB="MB"
|
||||
ICON_GB="GB"
|
||||
ICON_TB="TB"
|
||||
ICON_KHz="kHz"
|
||||
ICON_MHz="MHz"
|
||||
ICON_GHz="GHz"
|
||||
ICON_MBPS="Mbps"
|
||||
ICON_SESSION="|"
|
||||
ICON_LIVEPATCHED="[/]"
|
||||
fi
|
|
@ -0,0 +1,91 @@
|
|||
#!/bin/bash
|
||||
# N.B.: Use bash for $RANDOM
|
||||
#
|
||||
# mondrian: randomly generate some Modrian art in tmux
|
||||
#
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
trap "tput reset" EXIT HUP INT QUIT TERM KILL ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM
|
||||
|
||||
# Special mode, argv[1]="color", paint the screen
|
||||
if [ "$1" = "color" ] && [ -n "$2" ]; then
|
||||
i=0
|
||||
out=
|
||||
sleep 0.2
|
||||
count=$(stty size | awk '{print $1*$2}')
|
||||
perl -e "print color 'reset'; printf \"\x1b[48;5;${2}m%${count}s\", \" \";";
|
||||
head -n1
|
||||
tmux kill-window -t mondrian
|
||||
exit 0
|
||||
fi
|
||||
|
||||
get_random_direction() {
|
||||
if [ $((RANDOM % 2)) -eq 0 ]; then
|
||||
echo "-v"
|
||||
else
|
||||
echo "-h"
|
||||
fi
|
||||
}
|
||||
|
||||
get_random_numbers() {
|
||||
local max="$1" R=0 B=0 Y=0
|
||||
R=$((RANDOM % max + 1))
|
||||
B=$((RANDOM % max + 1))
|
||||
Y=$((RANDOM % max + 1))
|
||||
while [ "$B" = "$R" ] || [ "$B" = "$Y" ]; do
|
||||
B=$((RANDOM % max + 1))
|
||||
done
|
||||
while [ "$Y" = "$R" ] || [ "$Y" = "$B" ]; do
|
||||
Y=$((RANDOM % max + 1))
|
||||
done
|
||||
_RET="$R $B $Y"
|
||||
}
|
||||
|
||||
red_color=196
|
||||
yellow_color=226
|
||||
blue_color=57
|
||||
white_color=231
|
||||
|
||||
tmux kill-window -t mondrian
|
||||
tmux new-window -n mondrian "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
|
||||
set-option -g pane-active-border-style bg=colour231 \; \
|
||||
set-option -g pane-active-border-style fg=black \; \
|
||||
set-option -g pane-border-style bg=colour231 \; \
|
||||
set-option -g pane-border-style fg=black \; \
|
||||
split-window $(get_random_direction) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
|
||||
split-window $(get_random_direction) -t $((RANDOM % 2)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
|
||||
split-window $(get_random_direction) -t $((RANDOM % 3)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
|
||||
split-window $(get_random_direction) -t $((RANDOM % 4)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $red_color" \; \
|
||||
split-window $(get_random_direction) -t $((RANDOM % 5)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
|
||||
split-window $(get_random_direction) -t $((RANDOM % 6)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $yellow_color" \; \
|
||||
split-window $(get_random_direction) -t $((RANDOM % 7)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
|
||||
split-window $(get_random_direction) -t $((RANDOM % 8)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $blue_color" \; \
|
||||
split-window $(get_random_direction) -t $((RANDOM % 9)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
|
||||
split-window $(get_random_direction) -t $((RANDOM % 9)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
|
||||
split-window $(get_random_direction) -t $((RANDOM % 10)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
|
||||
split-window $(get_random_direction) -t $((RANDOM % 11)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
|
||||
split-window $(get_random_direction) -t $((RANDOM % 12)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
|
||||
split-window $(get_random_direction) -t $((RANDOM % 13)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
|
||||
split-window $(get_random_direction) -t $((RANDOM % 14)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
|
||||
split-window $(get_random_direction) -t $((RANDOM % 15)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
|
||||
split-window $(get_random_direction) -t $((RANDOM % 16)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
|
||||
split-window $(get_random_direction) -t $((RANDOM % 17)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
|
||||
split-window $(get_random_direction) -t $((RANDOM % 18)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
|
||||
split-window $(get_random_direction) -t $((RANDOM % 19)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
|
||||
split-window $(get_random_direction) -t $((RANDOM % 20)) "$BYOBU_PREFIX/lib/byobu/include/mondrian color $white_color" \; \
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,48 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# notify_osd: perform some string manipulation on notify-osd messages
|
||||
# and then send to the screen message window
|
||||
# Copyright (C) 2010 Canonical Ltd.
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
# with help from Mathias Gug <mathias.gug@canonical.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
$/ = "\n\n";
|
||||
$PKG = "byobu";
|
||||
$sleep = 5;
|
||||
while (<STDIN>) {
|
||||
# Ensure that the notify_osd indicator is enabled
|
||||
my $skip = 0;
|
||||
open(F, "<$ENV{BYOBU_CONFIG_DIR}/status");
|
||||
foreach my $i (<F>) {
|
||||
if ($i =~ /notify_osd=0/) {
|
||||
$skip = 1;
|
||||
}
|
||||
}
|
||||
close(F);
|
||||
if ($skip == 1) {
|
||||
next;
|
||||
}
|
||||
$msg = $_;
|
||||
$msg =~ s/\[[^,]*, //; # strip the leading "[timestamp, "
|
||||
$msg =~ s/\] /: /; # replace the " ] " following the indicator name, with ":"
|
||||
$msg =~ s/\s+/ /g; # collapse multi-whitespace into one
|
||||
$msg =~ s/\s+$//g; # strip trailing whitespace
|
||||
$msg =~ s/^\s+//g; # strip leading whitespace
|
||||
system("/usr/bin/screen", "-X", "-S", "$ARGV[0]", "at", "*", "msgwait", "$sleep");
|
||||
system("/usr/bin/screen", "-X", "-S", "$ARGV[0]", "at", "*", "echo", "[$msg]");
|
||||
sleep($sleep);
|
||||
system("/usr/bin/screen", "-X", "-S", "$ARGV[0]", "at", "*", "msgwait", "0");
|
||||
}
|
|
@ -0,0 +1,209 @@
|
|||
#!/usr/bin/env python3
|
||||
#
|
||||
# select-session.py
|
||||
# Copyright (C) 2010 Canonical Ltd.
|
||||
# Copyright (C) 2012-2014 Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
# Ryan C. Thompson <rct@thompsonclan.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import subprocess
|
||||
try:
|
||||
# For Python3, try and import input from builtins
|
||||
from builtins import input
|
||||
except Exception:
|
||||
# But fall back to using the default input
|
||||
True
|
||||
|
||||
|
||||
PKG = "byobu"
|
||||
SHELL = os.getenv("SHELL", "/bin/bash")
|
||||
HOME = os.getenv("HOME")
|
||||
BYOBU_CONFIG_DIR = os.getenv("BYOBU_CONFIG_DIR", HOME + "/.byobu")
|
||||
BYOBU_BACKEND = os.getenv("BYOBU_BACKEND", "tmux")
|
||||
choice = -1
|
||||
sessions = []
|
||||
text = []
|
||||
reuse_sessions = os.path.exists("%s/.reuse-session" % (BYOBU_CONFIG_DIR))
|
||||
|
||||
BYOBU_UPDATE_ENVVARS = ["DISPLAY", "DBUS_SESSION_BUS_ADDRESS", "SESSION_MANAGER", "GPG_AGENT_INFO", "XDG_SESSION_COOKIE", "XDG_SESSION_PATH", "GNOME_KEYRING_CONTROL", "GNOME_KEYRING_PID", "GPG_AGENT_INFO", "SSH_ASKPASS", "SSH_AUTH_SOCK", "SSH_AGENT_PID", "WINDOWID", "UPSTART_JOB", "UPSTART_EVENTS", "UPSTART_SESSION", "UPSTART_INSTANCE"]
|
||||
|
||||
|
||||
def get_sessions():
|
||||
sessions = []
|
||||
i = 0
|
||||
output = False
|
||||
if BYOBU_BACKEND == "screen":
|
||||
try:
|
||||
output = subprocess.Popen(["screen", "-ls"], stdout=subprocess.PIPE).communicate()[0]
|
||||
except subprocess.CalledProcessError as cpe:
|
||||
# screen -ls seems to always return 1
|
||||
if cpe.returncode != 1:
|
||||
raise
|
||||
else:
|
||||
output = cpe.output
|
||||
if sys.stdout.encoding is None:
|
||||
output = output.decode("UTF-8")
|
||||
else:
|
||||
output = output.decode(sys.stdout.encoding)
|
||||
if output:
|
||||
for s in output.splitlines():
|
||||
s = re.sub(r'\s+', ' ', s)
|
||||
# Ignore hidden sessions (named sessions that start with a "." or a "_")
|
||||
if s and s != " " and (s.find(" ") == 0 and len(s) > 1 and s.count("..") == 0 and s.count("._") == 0):
|
||||
text.append("screen: %s" % s.strip())
|
||||
items = s.split(" ")
|
||||
sessions.append("screen____%s" % items[1])
|
||||
i += 1
|
||||
if BYOBU_BACKEND == "tmux":
|
||||
output = subprocess.Popen(["tmux", "list-sessions"], stdout=subprocess.PIPE).communicate()[0]
|
||||
if sys.stdout.encoding is None:
|
||||
output = output.decode("UTF-8")
|
||||
else:
|
||||
output = output.decode(sys.stdout.encoding)
|
||||
if output:
|
||||
for s in output.splitlines():
|
||||
# Ignore hidden sessions (named sessions that start with a "_")
|
||||
if s and not s.startswith("_") and s.find("-") == -1:
|
||||
text.append("tmux: %s" % s.strip())
|
||||
sessions.append("tmux____%s" % s.split(":")[0])
|
||||
i += 1
|
||||
return sessions
|
||||
|
||||
|
||||
def cull_zombies(session_name):
|
||||
# When using tmux session groups, closing a client will leave
|
||||
# unattached "zombie" sessions that will never be reattached.
|
||||
# Search for and kill any unattached hidden sessions in the same group
|
||||
if BYOBU_BACKEND == "tmux":
|
||||
output = subprocess.Popen(["tmux", "list-sessions"], stdout=subprocess.PIPE).communicate()[0]
|
||||
if sys.stdout.encoding is None:
|
||||
output = output.decode("UTF-8")
|
||||
else:
|
||||
output = output.decode(sys.stdout.encoding)
|
||||
if not output:
|
||||
return
|
||||
|
||||
# Find the master session to extract the group name. We use
|
||||
# the group number to be extra sure the right session is getting
|
||||
# killed. We don't want to accidentally kill the wrong one
|
||||
pattern = "^%s:.+\\((group [^\\)]+)\\).*$" % session_name
|
||||
master = re.search(pattern, output, re.MULTILINE)
|
||||
if not master:
|
||||
return
|
||||
|
||||
# Kill all the matching hidden & unattached sessions
|
||||
pattern = "^_%s-\\d+:.+\\(%s\\)$" % (session_name, master.group(1))
|
||||
for s in re.findall(pattern, output, re.MULTILINE):
|
||||
subprocess.Popen(["tmux", "kill-session", "-t", s.split(":")[0]])
|
||||
|
||||
|
||||
def update_environment(session):
|
||||
backend, session_name = session.split("____", 2)
|
||||
for var in BYOBU_UPDATE_ENVVARS:
|
||||
value = os.getenv(var)
|
||||
if value:
|
||||
if backend == "tmux":
|
||||
cmd = ["tmux", "setenv", "-t", session_name, var, value]
|
||||
else:
|
||||
cmd = ["screen", "-S", session_name, "-X", "setenv", var, value]
|
||||
subprocess.call(cmd, stdout=open(os.devnull, "w"))
|
||||
|
||||
|
||||
def attach_session(session):
|
||||
update_environment(session)
|
||||
backend, session_name = session.split("____", 2)
|
||||
cull_zombies(session_name)
|
||||
# must use the binary, not the wrapper!
|
||||
if backend == "tmux":
|
||||
if reuse_sessions:
|
||||
os.execvp("tmux", ["tmux", "-u", "new-session", "-t", session_name, ";", "set-option", "destroy-unattached"])
|
||||
else:
|
||||
os.execvp("tmux", ["tmux", "-u", "attach", "-t", session_name])
|
||||
else:
|
||||
os.execvp("screen", ["screen", "-AOxRR", session_name])
|
||||
|
||||
|
||||
sessions = get_sessions()
|
||||
|
||||
show_shell = os.path.exists("%s/.always-select" % (BYOBU_CONFIG_DIR))
|
||||
if len(sessions) > 1 or show_shell:
|
||||
sessions.append("NEW")
|
||||
text.append("Create a new Byobu session (%s)" % BYOBU_BACKEND)
|
||||
sessions.append("SHELL")
|
||||
text.append("Run a shell without Byobu (%s)" % SHELL)
|
||||
|
||||
if len(sessions) > 1:
|
||||
sys.stdout.write("\nByobu sessions...\n\n")
|
||||
tries = 0
|
||||
while tries < 3:
|
||||
i = 1
|
||||
for s in text:
|
||||
sys.stdout.write(" %d. %s\n" % (i, s))
|
||||
i += 1
|
||||
try:
|
||||
try:
|
||||
user_input = input("\nChoose 1-%d [1]: " % (i - 1))
|
||||
except Exception:
|
||||
user_input = ""
|
||||
if not user_input or user_input == "":
|
||||
choice = 1
|
||||
break
|
||||
try:
|
||||
choice = int(user_input)
|
||||
except Exception:
|
||||
choice = int(eval(user_input))
|
||||
if choice >= 1 and choice < i:
|
||||
break
|
||||
else:
|
||||
tries += 1
|
||||
choice = -1
|
||||
sys.stderr.write("\nERROR: Invalid input\n")
|
||||
except KeyboardInterrupt:
|
||||
sys.stdout.write("\n")
|
||||
sys.exit(0)
|
||||
except Exception:
|
||||
if choice == "" or choice == -1:
|
||||
choice = 1
|
||||
break
|
||||
tries += 1
|
||||
choice = -1
|
||||
sys.stderr.write("\nERROR: Invalid input\n")
|
||||
elif len(sessions) == 1:
|
||||
# Auto-select the only session
|
||||
choice = 1
|
||||
|
||||
if choice >= 1:
|
||||
if sessions[choice - 1] == "NEW":
|
||||
# Create a new session
|
||||
if BYOBU_BACKEND == "tmux":
|
||||
os.execvp("byobu", ["byobu", "new-session", SHELL])
|
||||
else:
|
||||
os.execvp("byobu", ["byobu", SHELL])
|
||||
elif sessions[choice - 1] == "SHELL":
|
||||
os.execvp(SHELL, [SHELL])
|
||||
else:
|
||||
# Attach to the chosen session; must use the binary, not the wrapper!
|
||||
attach_session(sessions[choice - 1])
|
||||
|
||||
# No valid selection, default to the youngest session, create if necessary
|
||||
if BYOBU_BACKEND == "tmux":
|
||||
os.execvp("tmux", ["tmux"])
|
||||
else:
|
||||
os.execvp("screen", ["screen", "-AOxRR"])
|
|
@ -0,0 +1,367 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# shutil: some shared utilities used by all status scripts
|
||||
#
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
# Scott Moser <smoser@ubuntu.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Define colors
|
||||
color_screen() {
|
||||
ESC="\005"
|
||||
case "$1" in
|
||||
"") return 0 ;;
|
||||
-) printf "$ESC{-}" ;;
|
||||
--) printf "$ESC{-} " ;;
|
||||
esc) printf "$ESC" ;;
|
||||
bold1) printf "$ESC{=b }" || printf "$ESC{= }" ;;
|
||||
bold2) printf "$ESC{+b }" || printf "$ESC{= }" ;;
|
||||
none) printf "$ESC{= }" ;;
|
||||
invert) printf "$ESC{=r }" ;;
|
||||
*)
|
||||
local attr fg bg
|
||||
case $# in
|
||||
2)
|
||||
attr= ; fg=$1 ; bg=$2
|
||||
;;
|
||||
3)
|
||||
attr=$1 ; fg=$2 ; bg=$3
|
||||
;;
|
||||
esac
|
||||
if [ "$MONOCHROME" = "1" ]; then
|
||||
fg=
|
||||
bg=
|
||||
fi
|
||||
printf "$ESC{=$attr $fg$bg}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
color_map() {
|
||||
case "$1" in
|
||||
"k") _RET="black" ;;
|
||||
"r") _RET="red" ;;
|
||||
"g") _RET="green" ;;
|
||||
"y") _RET="yellow" ;;
|
||||
"b") _RET="blue" ;;
|
||||
"m") _RET="magenta" ;;
|
||||
"c") _RET="cyan" ;;
|
||||
"w") _RET="white" ;;
|
||||
"d") _RET="black" ;;
|
||||
"K") _RET="brightblack" ;;
|
||||
"R") _RET="brightred" ;;
|
||||
"G") _RET="brightgreen" ;;
|
||||
"Y") _RET="brightyellow" ;;
|
||||
"B") _RET="brightblue" ;;
|
||||
"M") _RET="brightmagenta" ;;
|
||||
"C") _RET="brightcyan" ;;
|
||||
"W") _RET="brightwhite" ;;
|
||||
*) _RET="$1" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
attr_map() {
|
||||
case "$1" in
|
||||
"d") _RET=,dim ;;
|
||||
"u") _RET=,underscore ;;
|
||||
"b") _RET=,bold ;;
|
||||
"r") _RET=,reverse ;;
|
||||
"s") _RET=,standout ;;
|
||||
"B") _RET=,blinking ;;
|
||||
"h") _RET=,hidden ;;
|
||||
"i") _RET=,italics ;;
|
||||
*) _RET= ;;
|
||||
esac
|
||||
}
|
||||
|
||||
color_tmux() {
|
||||
local back fore attr
|
||||
case "$1" in
|
||||
"") return 0 ;;
|
||||
-) printf "#[default]#[fg=$BYOBU_LIGHT,bg=$BYOBU_DARK]" ;;
|
||||
--) printf "#[default]#[fg=$BYOBU_LIGHT]#[bg=$BYOBU_DARK] " ;;
|
||||
esc) printf "" ;;
|
||||
bold*) printf "#[default]#[fg=bold]" ;;
|
||||
none) printf "#[default]#[fg=$BYOBU_LIGHT,bg=$BYOBU_DARK]" ;;
|
||||
invert) printf "#[default]#[reverse]" ;;
|
||||
*)
|
||||
if [ "$#" = "2" ]; then
|
||||
color_map "$1"; back="$_RET"
|
||||
color_map "$2"; fore="$_RET"
|
||||
else
|
||||
attr_map "$1"; attr="$_RET"
|
||||
color_map "$2"; back="$_RET"
|
||||
color_map "$3"; fore="$_RET"
|
||||
fi
|
||||
[ "$MONOCHROME" = "1" ] && printf "#[default]" || printf "#[default]#[fg=$fore$attr,bg=$back]"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
color() {
|
||||
case "$BYOBU_BACKEND" in
|
||||
tmux)
|
||||
color_tmux "$@"
|
||||
;;
|
||||
screen)
|
||||
color_screen "$@"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# uncommented_lines(char=#)
|
||||
# does the standard input have lines that do not start with 'char'?
|
||||
uncommented_lines() {
|
||||
local line chr="${1:-#}"
|
||||
while read line; do
|
||||
[ "${line#${chr}}" = "${line}" ] && return 0;
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
# newest(file,file,file..)
|
||||
# return the newest file in the list
|
||||
newest() {
|
||||
local c="$1" i
|
||||
for i in "$@"; do [ "$i" -nt "$c" ] && c="$i"; done
|
||||
[ -e "$c" ] && _RET="$c"
|
||||
}
|
||||
|
||||
error() {
|
||||
printf "%s\n" "ERROR: " "$@" 1>&2
|
||||
}
|
||||
|
||||
fail() {
|
||||
[ $# -eq 0 ] || error "$@"; exit 1;
|
||||
}
|
||||
|
||||
find_script() {
|
||||
# Allow for local status scripts
|
||||
if [ -x "$BYOBU_CONFIG_DIR/bin/$1" ]; then
|
||||
_RET="$BYOBU_CONFIG_DIR/bin/$1"
|
||||
elif [ -x "$BYOBU_PREFIX/lib/$PKG/$1" ]; then
|
||||
_RET="$BYOBU_PREFIX/lib/$PKG/$1"
|
||||
elif [ -x "$BYOBU_PREFIX/libexec/$PKG/$1" ]; then
|
||||
_RET="$BYOBU_PREFIX/libexec/$PKG/$1"
|
||||
else
|
||||
_RET="/dev/null"
|
||||
fi
|
||||
}
|
||||
|
||||
# divide 2 integers and return a floating point number
|
||||
# third argument indicates how many digits after the decimal
|
||||
fpdiv() {
|
||||
local a=$1 b=$2 pres=${3:-3}
|
||||
local i=0 mp="10" whole="" part="" chunk="" n=0
|
||||
while i=$(($i+1)) && [ $i -le $pres ]; do
|
||||
mp="${mp}0"
|
||||
chunk="${chunk}?"
|
||||
done
|
||||
|
||||
n=$(((${mp}*${a})/${b}))
|
||||
|
||||
# round up if necessary
|
||||
[ $((($n-5)/10)) = $(($n/10)) ] && n=$(($n+5))
|
||||
|
||||
# drop the last digit, which was only there for rounding
|
||||
n=${n%?}
|
||||
whole=${n%${chunk}}
|
||||
part=${n#${whole}}
|
||||
_RET=${whole:-0}${part:+.${part}}
|
||||
return
|
||||
}
|
||||
|
||||
# rtrim(string,chars)
|
||||
rtrim() {
|
||||
local tab=' ' cr="
|
||||
"
|
||||
local cur="${1}" set="[${2:- ${tab}${cr}}]" n=""
|
||||
while n=${cur%${set}} && [ "$n" != "$cur" ]; do cur=${n}; done
|
||||
_RET=${cur}
|
||||
}
|
||||
|
||||
readfile() {
|
||||
local c="" r="" cr="
|
||||
"
|
||||
OIFS="$IFS"; IFS="";
|
||||
while read c; do
|
||||
r="$r${cr}$c"
|
||||
done
|
||||
IFS=$OIFS
|
||||
_RET=${r}
|
||||
return 0
|
||||
}
|
||||
|
||||
metadata_available() {
|
||||
# This is really ugly. We need a reliable, fast way of determining
|
||||
# if a metadata service is available, that does NOT slow down non-ec2
|
||||
# machines.
|
||||
local x=0 cache="$BYOBU_CONFIG_DIR/.metadata_available"
|
||||
# First, check the cache
|
||||
if [ -s "$cache" ]; then
|
||||
# Metadata is non-empty, so we have metadata available
|
||||
x=1
|
||||
else
|
||||
# Must seed the cache
|
||||
if [ -e /etc/ec2_version ] || [ -e /usr/sbin/update-grub-legacy-ec2 ]; then
|
||||
# This *looks* like a machine with metadata, so background a potentially slow check
|
||||
timeout 1 wget -q -O- --tries=1 http://169.254.169.254 </dev/null >"$cache" 2>/dev/null &
|
||||
sleep 0.02
|
||||
[ -s "$cache" ] && x=1
|
||||
fi
|
||||
fi
|
||||
[ "$x" = "1" ]
|
||||
}
|
||||
|
||||
status_freq() {
|
||||
# Define status frequencies
|
||||
# Use prime number intervals, to decrease collisions, which
|
||||
# yields some less expensive status updates.
|
||||
# ~86000 ~1 day
|
||||
# ~600 ~10 minutes
|
||||
# ~180 ~3 minutes
|
||||
# ~60 ~1 minute
|
||||
case "$1" in
|
||||
apport) _RET=67 ;;
|
||||
arch) _RET=9999991 ;;
|
||||
battery) _RET=61 ;;
|
||||
color) _RET=9999991 ;;
|
||||
cpu_count) _RET=5 ;;
|
||||
cpu_freq) _RET=2 ;;
|
||||
cpu_temp) _RET=19 ;;
|
||||
custom) _RET=5 ;;
|
||||
date) _RET=9999991 ;;
|
||||
disk) _RET=13 ;;
|
||||
disk_io) _RET=3 ;;
|
||||
distro) _RET=9999991 ;;
|
||||
entropy) _RET=5 ;;
|
||||
fan_speed) _RET=23 ;;
|
||||
hostname) _RET=607 ;;
|
||||
ip_address) _RET=127 ;;
|
||||
load_average) _RET=2 ;;
|
||||
logo) _RET=9999991 ;;
|
||||
mail) _RET=5 ;;
|
||||
memory) _RET=13 ;;
|
||||
menu) _RET=9999991 ;;
|
||||
network) _RET=3 ;;
|
||||
notify_osd) _RET=9999991 ;;
|
||||
processes) _RET=7 ;;
|
||||
raid) _RET=59 ;;
|
||||
reboot_required) _RET=5 ;;
|
||||
release) _RET=599 ;;
|
||||
services) _RET=53 ;;
|
||||
session) _RET=9999991 ;;
|
||||
swap) _RET=19 ;;
|
||||
time) _RET=9999991 ;;
|
||||
time_binary) _RET=23 ;;
|
||||
time_utc) _RET=11 ;;
|
||||
trash) _RET=9999991 ;;
|
||||
updates_available) _RET=7 ;;
|
||||
uptime) _RET=29 ;;
|
||||
users) _RET=11 ;;
|
||||
whoami) _RET=86029 ;;
|
||||
wifi_quality) _RET=17 ;;
|
||||
*) _RET=9999991 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
get_now() {
|
||||
if [ -r /proc/uptime ]; then
|
||||
# return the integer part of the first item in /proc/uptime
|
||||
local s c
|
||||
read s c < /proc/uptime
|
||||
_RET=${s%.*}
|
||||
else
|
||||
_RET=$(date +%s);
|
||||
fi
|
||||
}
|
||||
|
||||
get_network_interface() {
|
||||
if [ -n "$MONITORED_NETWORK" ]; then
|
||||
# Manual override
|
||||
_RET="$MONITORED_NETWORK"
|
||||
elif [ -e /proc/net/route ]; then
|
||||
# Linux systems, read route and interface from procfs
|
||||
local Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT
|
||||
while read Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT; do
|
||||
[ "$Mask" = "00000000" ] && break
|
||||
done < /proc/net/route
|
||||
_RET="$Iface"
|
||||
elif eval $BYOBU_TEST route >/dev/null 2>&1; then
|
||||
# Route command on path
|
||||
_RET=$(route get default|grep interface:|awk '{print $2}')
|
||||
elif [ -x "/sbin/route" ]; then
|
||||
# Mac OSX, shell out to the route command
|
||||
_RET=$(/sbin/route get default|grep interface:|awk '{print $2}')
|
||||
fi
|
||||
}
|
||||
|
||||
get_distro() {
|
||||
local distro="${DISTRO}"
|
||||
if [ -n "$DISTRO" ]; then
|
||||
# user defined
|
||||
true
|
||||
elif [ -r "/etc/os-release" ]; then
|
||||
distro=$(. /etc/os-release && echo "$NAME")
|
||||
case "$distro" in
|
||||
Debian*)
|
||||
[ -r /etc/lsb-release ] && distro=$(. /etc/lsb-release && [ -n "$GOOGLE_ID" ] && echo "gLinux" || echo "Debian")
|
||||
;;
|
||||
esac
|
||||
elif [ -r "/etc/issue" ]; then
|
||||
# lsb_release is *really* slow; try to use /etc/issue first
|
||||
local issue
|
||||
IFS="" read issue < /etc/issue
|
||||
case "$issue" in
|
||||
Ubuntu*)
|
||||
distro="Ubuntu";
|
||||
;;
|
||||
Debian*)
|
||||
distro="Debian"
|
||||
;;
|
||||
Red\ Hat\ Enterprise*)
|
||||
distro="RHEL"
|
||||
;;
|
||||
*)
|
||||
# assume first field is what we want
|
||||
distro="${issue%% *}";
|
||||
;;
|
||||
esac
|
||||
elif eval $BYOBU_TEST lsb_release >/dev/null 2>&1; then
|
||||
# If lsb_release is available, use it
|
||||
local r=$(lsb_release -s -d)
|
||||
case "$r" in
|
||||
Ubuntu*)
|
||||
# Use the -d if an Ubuntu LTS
|
||||
distro="Ubuntu"
|
||||
;;
|
||||
*)
|
||||
# But for other distros the description
|
||||
# is too long, so build from -i and -r
|
||||
distro=$(lsb_release -s -i)
|
||||
;;
|
||||
esac
|
||||
elif eval $BYOBU_TEST sw_vers >/dev/null 2>&1; then
|
||||
distro="$(sw_vers -productName)"
|
||||
elif eval $BYOBU_TEST uname >/dev/null 2>&1; then
|
||||
distro="$(uname -s)"
|
||||
else
|
||||
distro="Byobu"
|
||||
fi
|
||||
_RET="$distro"
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,46 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# tmux-detach-all-but-current-client
|
||||
# Copyright (C) 2013-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
a1=
|
||||
a2=
|
||||
tty1=
|
||||
tty2=
|
||||
# List all clients, ordered by most recent activity descending
|
||||
for c in $(tmux list-clients -F "#{client_activity}___#{client_tty}" | sort -n -r); do
|
||||
if [ -z "$a1" ]; then
|
||||
a1=${c%%___*}
|
||||
tty1=${c##*___}
|
||||
elif [ -z "$a2" ]; then
|
||||
a2=${c%%___*}
|
||||
tty2=${c##*___}
|
||||
fi
|
||||
if [ -n "$a1" ] && [ -n "$a2" ]; then
|
||||
if [ "$a1" = "$a2" ]; then
|
||||
# Activity timestamps match in top 2 attached clients
|
||||
# Let's not detach anyone here!
|
||||
tmux display-message "Multiple active attached clients detected, refusing to detach" >/dev/null 2>&1
|
||||
elif [ -n "$tty1" ]; then
|
||||
# Detach all but the current client, iterating across each
|
||||
# Tempting to use detach-client -a -t here, but there's a bug
|
||||
# in there, keeping that from working properly
|
||||
tmux detach-client -t "$tty2" >/dev/null 2>&1
|
||||
a2=
|
||||
fi
|
||||
fi
|
||||
done
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# tmux-send-command-to-all-panes
|
||||
# Copyright (C) 2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
w=$(tmux list-windows | grep "\*" | awk -F: '{print $1}')
|
||||
for p in $(tmux list-panes | $BYOBU_SED -e "s/:.*//"); do
|
||||
tmux send-keys -t $w.$p "$@" || true
|
||||
tmux send-keys -t $w.$p Enter || true
|
||||
done
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# tmux-send-command-to-all-windows
|
||||
# Copyright (C) 2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
for w in $(tmux list-windows | $BYOBU_SED -e "s/:.*//"); do
|
||||
tmux send-keys -t :$w "$@"
|
||||
tmux send-keys -t :$w Enter
|
||||
done
|
|
@ -0,0 +1,46 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# toggle-utf8
|
||||
# Copyright (C) 2013-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
PKG="byobu"
|
||||
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
|
||||
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
|
||||
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"
|
||||
[ -r "$BYOBU_CONFIG_DIR/statusrc" ] && . "$BYOBU_CONFIG_DIR/statusrc"
|
||||
|
||||
if [ "$BYOBU_CHARMAP" = "UTF-8" ]; then
|
||||
if grep -qs "^BYOBU_CHARMAP=" $BYOBU_CONFIG_DIR/statusrc 2>/dev/null; then
|
||||
sed -i -e "s/^BYOBU_CHARMAP=.*/BYOBU_CHARMAP=x/" $BYOBU_CONFIG_DIR/statusrc
|
||||
else
|
||||
echo "BYOBU_CHARMAP=x" >> $BYOBU_CONFIG_DIR/statusrc
|
||||
fi
|
||||
export BYOBU_CHARMAP=x
|
||||
else
|
||||
if grep -qs "^BYOBU_CHARMAP=" $BYOBU_CONFIG_DIR/statusrc 2>/dev/null; then
|
||||
sed -i -e "s/^BYOBU_CHARMAP=.*/BYOBU_CHARMAP=UTF-8/" $BYOBU_CONFIG_DIR/statusrc
|
||||
else
|
||||
echo "BYOBU_CHARMAP=UTF-8" >> $BYOBU_CONFIG_DIR/statusrc
|
||||
fi
|
||||
export BYOBU_CHARMAP=UTF-8
|
||||
fi
|
||||
if [ -n "$TMUX" ]; then
|
||||
RC_FILE=$(echo "$SHELL" | $BYOBU_SED "s:.*/::")
|
||||
tmux send-keys " export BYOBU_CHARMAP=$BYOBU_CHARMAP ; . ~/.${RC_FILE}rc" \; send-keys Enter
|
||||
fi
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,91 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# ip_address: report a host's ip address
|
||||
#
|
||||
# Copyright (C) 2008-2011 Canonical Ltd.
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__ip_address_detail() {
|
||||
if [ -x /sbin/ip ]; then
|
||||
/sbin/ip -4 addr list
|
||||
/sbin/ip -6 addr list
|
||||
fi
|
||||
}
|
||||
|
||||
__ip_address() {
|
||||
local interface ipaddr cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/ip_address"
|
||||
# Allow interface overrides in $BYOBU_CONFIG_DIR/statusrc
|
||||
if [ -n "$MONITORED_NETWORK" ]; then
|
||||
interface="$MONITORED_NETWORK"
|
||||
else
|
||||
case "$IPV6" in
|
||||
1|true|yes) interface=$(awk '$10 != "lo" { iface=$10 ; }; END { print iface; }' /proc/net/ipv6_route);;
|
||||
*) get_network_interface; interface="$_RET";;
|
||||
esac
|
||||
fi
|
||||
case "$IPV6" in
|
||||
1|true|yes)
|
||||
if [ "$IP_EXTERNAL" = "1" ]; then
|
||||
# Background an update
|
||||
timeout 1 wget -q -O- http://v6.ipv6-test.com/api/myip.php </dev/null >"$cache" 2>/dev/null &
|
||||
sleep 0.02
|
||||
else
|
||||
# Background an update
|
||||
if [ -x /sbin/ip ]; then
|
||||
LC_ALL=C /sbin/ip -6 addr list dev "$interface" scope global </dev/null >"$cache" 2>/dev/null &
|
||||
elif eval $BYOBU_TEST ifconfig >/dev/null 2>&1; then
|
||||
LC_ALL=c ifconfig "$interface" | grep "inet6 " | awk '{print $2}' | sed -e "s/%.*//" >"$cache" 2>/dev/null &
|
||||
|
||||
fi
|
||||
fi
|
||||
[ -s "$cache" ] && read ipaddr < "$cache"
|
||||
# Print 'None' if we have no global address
|
||||
[ -z "$ipaddr" ] && ipaddr="None"
|
||||
ipaddr=${ipaddr#* inet6 }
|
||||
ipaddr=${ipaddr%%/*}
|
||||
;;
|
||||
*)
|
||||
if [ "$IP_EXTERNAL" = "1" ]; then
|
||||
timeout 1 wget -q -O- http://v4.ipv6-test.com/api/myip.php </dev/null >"$cache" 2>/dev/null &
|
||||
sleep 0.02
|
||||
[ -s "$cache" ] && read ipaddr < "$cache"
|
||||
elif metadata_available; then
|
||||
# We're in EC2, so get our public IP address
|
||||
timeout 0.2 wget -q -O- http://169.254.169.254/latest/meta-data/public-ipv4 </dev/null >"$cache" 2>/dev/null &
|
||||
sleep 0.02
|
||||
[ -s "$cache" ] && read ipaddr < "$cache"
|
||||
else
|
||||
if [ -x /sbin/ip ]; then
|
||||
ipaddr=$(LC_ALL=C /sbin/ip -4 addr list dev "$interface" scope global 2>/dev/null)
|
||||
ipaddr=${ipaddr#* inet }
|
||||
ipaddr=${ipaddr%%/*}
|
||||
elif eval $BYOBU_TEST ifconfig >/dev/null 2>&1; then
|
||||
ipaddr=$(ifconfig "$interface" | grep "inet " | awk '{print $2}')
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if [ -n "$ipaddr" ]; then
|
||||
if [ "$1" = "t" ]; then
|
||||
printf "%s" "$ipaddr"
|
||||
else
|
||||
color b w k; printf "%s" "$ipaddr"; color --
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,36 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# load_average: grab the current load average
|
||||
#
|
||||
# Copyright (C) 2008 Canonical Ltd.
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__load_average_detail() {
|
||||
cat /proc/loadavg
|
||||
}
|
||||
|
||||
__load_average() {
|
||||
if [ -r "/proc/loadavg" ]; then
|
||||
read one five fifteen other < /proc/loadavg
|
||||
else
|
||||
one=$(uptime | sed -e "s/.*://" | awk '{print $1}')
|
||||
fi
|
||||
[ -n "$one" ] || return
|
||||
color Y k; printf "$one"; color --
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,154 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# logo: determine which logo to use
|
||||
#
|
||||
# Copyright (C) 2008 Canonical Ltd.
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__logo_detail() {
|
||||
MARKUP="false"
|
||||
__logo
|
||||
}
|
||||
|
||||
__logo() {
|
||||
local logo=
|
||||
if [ -n "$LOGO" ]; then
|
||||
# Allow users to define their own logo in $BYOBU_CONFIG_DIR/status
|
||||
printf "%s" "$LOGO"
|
||||
return
|
||||
fi
|
||||
local distro="$(printf "%s" "$BYOBU_DISTRO" | $BYOBU_SED 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')"
|
||||
case "$distro" in
|
||||
*ubuntu*)
|
||||
if $MARKUP; then
|
||||
if [ "$BYOBU_BACKEND" = "tmux" ] && [ "$BYOBU_CHARMAP" = "UTF-8" ]; then
|
||||
if [ ! "$VTE_CJK_WIDTH" = "1" ] && [ ! "$VTE_CJK_WIDTH" = "wide" ] ; then
|
||||
# color "colour202" "colour255" ; printf " u "; color -
|
||||
# Ubuntu's logo doesn't display anywhere, except for on Ubuntu itself, which has the Ubuntu font with the logo
|
||||
# which breaks when you ssh into Ubuntu from elsewhere (Windows, Debian, Mac)
|
||||
color "colour202" "colour255" ; printf " u "; color -
|
||||
else
|
||||
color m W; printf " u "; color -
|
||||
fi
|
||||
else
|
||||
color m W; printf " u "; color -
|
||||
fi
|
||||
else
|
||||
printf " u "
|
||||
fi
|
||||
;;
|
||||
*alpine*)
|
||||
logo=" /\\\\\\\\ "
|
||||
$MARKUP && printf "$(color b b W)%s$(color -)" "$logo" || printf "$logo"
|
||||
;;
|
||||
*altlinux*)
|
||||
logo="alt"
|
||||
$MARKUP && printf "$(color Y k)%s$(color -)" "$logo" || printf "$logo"
|
||||
;;
|
||||
*arch*)
|
||||
logo=" A "
|
||||
$MARKUP && printf "$(color b w b)%s$(color -)" "$logo" || printf "$logo"
|
||||
;;
|
||||
*centos*)
|
||||
if [ "$BYOBU_BACKEND" = "tmux" ] && [ "$BYOBU_CHARMAP" = "UTF-8" ]; then
|
||||
logo="※ "
|
||||
$MARKUP && printf "$(color w m)※ $(color -)" || printf "$logo"
|
||||
else
|
||||
$MARKUP && printf "$(color g w)*$(color -)$(color m w)*$(color -)$(color y w)*$(color -)$(color b w)*$(color -)" || printf "$logo"
|
||||
fi
|
||||
;;
|
||||
*debian*)
|
||||
logo=" @ "
|
||||
$MARKUP && printf "$(color w r)%s$(color -)" "$logo" || printf "$logo"
|
||||
;;
|
||||
*fedora*)
|
||||
logo=" f "
|
||||
$MARKUP && printf "$(color b w)%s$(color -)" "$logo" || printf "$logo"
|
||||
;;
|
||||
*foresight*)
|
||||
logo="<@>"
|
||||
$MARKUP && printf "$(color b W g)%s$(color -)" "$logo" || printf "$logo"
|
||||
;;
|
||||
*gentoo*)
|
||||
logo=" > "
|
||||
$MARKUP && printf "$(color b c w)%s$(color -)" "$logo" || printf "$logo"
|
||||
;;
|
||||
*glinux*)
|
||||
logo=" G "
|
||||
# Green: 3cba54=71, Yellow: f4c20d=214, Red: db3236=167, Blue: 4885ed=69
|
||||
$MARKUP && printf "$(color colour0 colour69)██$(color colour0 colour167)■$(color colour0 colour214)■$(color colour0 colour69)▄$(color colour0 colour71)█$(color colour0 colour167)■$(color -)" || printf "$logo"
|
||||
;;
|
||||
*mac*|*darwin*)
|
||||
if [ "$BYOBU_BACKEND" = "tmux" ] && [ "$BYOBU_CHARMAP" = "UTF-8" ]; then
|
||||
# The Apple option character
|
||||
#logo=" ⌘ "
|
||||
# The Apple logo -- only visible from Mac terminals
|
||||
logo=" "
|
||||
else
|
||||
logo=" X "
|
||||
fi
|
||||
$MARKUP && printf "$(color w k)%s$(color -)" "$logo" || printf "$logo"
|
||||
;;
|
||||
*mandriva*)
|
||||
logo=" (* "
|
||||
$MARKUP && printf "$(color b k c) ($(color -)$(color b k y)*$(color -) " || printf "$logo"
|
||||
;;
|
||||
*mint*)
|
||||
logo=" lm "
|
||||
$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"
|
||||
;;
|
||||
*raspbian*)
|
||||
logo=" @ "
|
||||
$MARKUP && printf "$(color colour125 colour15)%s$(color -)" "$logo" || printf "$logo"
|
||||
;;
|
||||
*red*hat*|*rhel*)
|
||||
logo=" RH "
|
||||
$MARKUP && printf "$(color R k)%s$(color -)" "$logo" || printf "$logo"
|
||||
;;
|
||||
*rockhopper*)
|
||||
logo="palm"
|
||||
$MARKUP && printf "$(color k w)%s$(color -)" "$logo" || printf "$logo"
|
||||
;;
|
||||
*slackware*)
|
||||
logo=".S "
|
||||
$MARKUP && printf "$(color u B k)%s$(color -)" "$logo" || printf "$logo"
|
||||
;;
|
||||
*suse*)
|
||||
logo="SUSE"
|
||||
$MARKUP && printf "$(color W g)%s$(color -)" "$logo" || printf "$logo"
|
||||
;;
|
||||
*xandros*)
|
||||
logo=" X "
|
||||
$MARKUP && printf "$(color W r)%s$(color -)" "$logo" || printf "$logo"
|
||||
;;
|
||||
*)
|
||||
if [ "$BYOBU_BACKEND" = "tmux" ] && [ "$BYOBU_CHARMAP" = "UTF-8" ]; then
|
||||
logo="〣"
|
||||
else
|
||||
logo="[B]"
|
||||
fi
|
||||
$MARKUP && printf "$(color b k W)%s$(color -)" "$logo" || printf " $logo "
|
||||
;;
|
||||
esac
|
||||
printf " "
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,39 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# mail: notify the user if they have system mail
|
||||
#
|
||||
# Copyright (C) 2009 Canonical Ltd.
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
MAILFILE="/var/spool/mail/$USER"
|
||||
|
||||
__mail_detail() {
|
||||
[ ! -d "$MAILFILE" ] && [ -s "$MAILFILE" ] && ls -alF "$MAILFILE" 2>&1
|
||||
[ -d "$MAILFILE/new" ] && ls -AlF "$MAILFILE/new" 2>&1
|
||||
}
|
||||
|
||||
__mail() {
|
||||
if [ -f "$MAILFILE" ] && [ -s "$MAILFILE" ]; then
|
||||
color b; printf "%s" "$ICON_MAIL"; color --
|
||||
elif [ -d "$MAILFILE/new" ] && "$(ls -A "$MAILFILE/new" 2>/dev/null)"; then
|
||||
color b; printf "%s" "$ICON_MAIL"; color --
|
||||
else
|
||||
rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/mail"*
|
||||
fi
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,57 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
__memory_detail() {
|
||||
if [ "$(uname)" = "OpenBSD" -o "$(uname)" = "FreeBSD" ]; then
|
||||
# OpenBSD / FreeBSD
|
||||
top -b -d 1
|
||||
else
|
||||
# Linux
|
||||
free
|
||||
fi
|
||||
}
|
||||
|
||||
__memory() {
|
||||
local total="" free="" unit_total="" unit_free=""
|
||||
local total_mb=0 free_mb=0 used_mb=0
|
||||
|
||||
case "$(uname)" in
|
||||
Linux)
|
||||
while read -r name value _; do
|
||||
case "$name" in
|
||||
MemTotal:*) total=$((value/1024));;
|
||||
MemFree:*) free=$((value/1024));;
|
||||
Buffers:*) free=$((free + value/1024));;
|
||||
Cached:*) free=$((free + value/1024));;
|
||||
esac
|
||||
done < /proc/meminfo
|
||||
used_mb=$((total - free))
|
||||
;;
|
||||
OpenBSD)
|
||||
total=$(($(sysctl -n hw.physmem) / 1024 / 1024))
|
||||
used_mb=$(($(vmstat | tail -1 | awk '{print $4}') / 1024))
|
||||
;;
|
||||
FreeBSD)
|
||||
total=$(($(sysctl -n hw.realmem) / 1024 / 1024))
|
||||
pagesize=$(sysctl -n hw.pagesize)
|
||||
inactive_count=$(sysctl -n vm.stats.vm.v_inactive_count)
|
||||
free_mb=$((inactive_count * pagesize / 1024 / 1024))
|
||||
used_mb=$((total - free_mb))
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ $total -ge 1024 ]; then
|
||||
total=$(printf "%.1f" $(echo "$total / 1024" | bc -l))
|
||||
unit_total="G"
|
||||
else
|
||||
unit_total="M"
|
||||
fi
|
||||
|
||||
if [ $used_mb -ge 1024 ]; then
|
||||
used_mb=$(printf "%.1f" $(echo "$used_mb / 1024" | bc -l))
|
||||
unit_used="G"
|
||||
else
|
||||
unit_used="M"
|
||||
fi
|
||||
|
||||
color b g W; printf "%s%s" "$used_mb" "$unit_used"; color -; color b g W; printf "/%s%s" "$total" "$unit_total"; color --
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# menu: display the menu text
|
||||
#
|
||||
# Copyright (C) 2008 Canonical Ltd.
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__menu_detail() {
|
||||
return
|
||||
}
|
||||
|
||||
__menu() {
|
||||
local bindings esc key text
|
||||
[ -r "$BYOBU_CONFIG_DIR/keybindings" ] && bindings="$BYOBU_CONFIG_DIR/keybindings" || bindings="$BYOBU_CONFIG_DIR/.screenrc"
|
||||
if grep -qs "^source.*screen-escape-keys$" $bindings 2>/dev/null || grep -qs "^source.*f-keys.screen.disable$" $bindings 2>/dev/null || [ "$1" = "--disable-f-keys" ]; then
|
||||
# Get the second to last byte from the "escape" option
|
||||
esc=`grep "^escape" $bindings | tail -c 3 | head -c 1`
|
||||
[ -n "$esc" ] && key="^$esc-@" || key="^a-@"
|
||||
elif grep -qs "^source.*none$" $bindings 2>/dev/null; then
|
||||
key="byobu-config"
|
||||
else
|
||||
key="F9"
|
||||
fi
|
||||
text=$(gettext "Menu" 2>/dev/null) || text="Menu"
|
||||
color k w; printf "%s:<" "$text"; color -; color b k w; printf "%s" "$key"; color k w; printf ">"
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,99 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# network: calculate the network up/down rates
|
||||
#
|
||||
# Copyright (C) 2008 Canonical Ltd.
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__network_detail() {
|
||||
get_network_interface; local interface="$_RET"
|
||||
LC_ALL=C /sbin/ip addr show "$interface" | $BYOBU_SED 's/\s*$//'
|
||||
}
|
||||
|
||||
__network() {
|
||||
get_network_interface; local interface="$_RET"
|
||||
local x1=0 x2=0 tx1=0 i= t= unit= symbol= cache= rate=
|
||||
status_freq network
|
||||
t="$_RET"
|
||||
# By default, we won't bug the user with the display of network traffic
|
||||
# below NETWORK_THRESHOLD in kbps; override in $BYOBU_CONFIG_DIR/status
|
||||
[ -n "$NETWORK_THRESHOLD" ] || NETWORK_THRESHOLD=20
|
||||
for i in up down; do
|
||||
unit="kb"
|
||||
case $i in
|
||||
up) symbol="$ICON_UP" ;;
|
||||
down) symbol="$ICON_DN" ;;
|
||||
esac
|
||||
cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/network.$i"
|
||||
[ -r "$cache" ] && read x1 < "$cache" || tx1=0
|
||||
local iface rbytes rpackets rerrs rdrop rfifo rframe rcompressed rmulticast tbytes tpackets terrs tdrop tfifo tcolls tcarrier tcompressed
|
||||
cat /proc/net/dev > "$cache".dev
|
||||
while read iface rbytes rpackets rerrs rdrop rfifo rframe rcompressed rmulticast tbytes tpackets terrs tdrop tfifo tcolls tcarrier tcompressed; do
|
||||
case "$iface" in
|
||||
${interface}:)
|
||||
[ "$i" = "up" ] && x2=${tbytes} || x2=${rbytes}
|
||||
break;
|
||||
;;
|
||||
${interface}:*)
|
||||
# Interface and tbytes got munged together
|
||||
[ "$i" = "up" ] && x2=${rmulticast##*:} || x2=${iface##*:}
|
||||
break;
|
||||
;;
|
||||
esac
|
||||
done < "$cache".dev
|
||||
printf "%s" "$x2" > "$cache"
|
||||
rate=$((8*($x2 - $x1) / $t / 1024)) # in kbps
|
||||
[ "$rate" -lt 0 ] && rate=0
|
||||
if [ $rate -gt $NETWORK_THRESHOLD ]; then
|
||||
case "$NETWORK_UNITS" in
|
||||
bytes)
|
||||
rate=$(($rate/8))
|
||||
if [ "$rate" -gt 1048576 ]; then
|
||||
fpdiv "$rate" 1048576 1
|
||||
rate=${_RET}
|
||||
unit="GB/s"
|
||||
elif [ "$rate" -gt 1024 ]; then
|
||||
fpdiv "$rate" 1024 1
|
||||
rate=${_RET}
|
||||
unit="MB/s"
|
||||
else
|
||||
unit="kB/s"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
# Default to bps
|
||||
# Why 1000 and not 1024? http://en.wikipedia.org/wiki/Data_rate_units
|
||||
if [ "$rate" -gt 1000000 ]; then
|
||||
fpdiv "$rate" 1000000 1
|
||||
rate=${_RET}
|
||||
unit="Gb"
|
||||
elif [ "$rate" -gt 1000 ]; then
|
||||
fpdiv "$rate" 1000 1
|
||||
rate=${_RET}
|
||||
unit="Mb"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
[ -n "$rate" ] || continue
|
||||
color b m w; printf "%s%s" "$symbol" "$rate"; color -; color m w; printf "%s" "$unit"; color --
|
||||
else
|
||||
rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/network"*
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,37 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# processes: report number of running processes
|
||||
#
|
||||
# Copyright (C) 2008 Canonical Ltd.
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__processes_detail() {
|
||||
ps -ej 2>/dev/null
|
||||
}
|
||||
|
||||
__processes() {
|
||||
local count=
|
||||
if [ -r /proc ]; then
|
||||
count=$(ls -d /proc/[0-9]* 2>/dev/null | wc -l)
|
||||
else
|
||||
count=$(ps -ef | wc -l)
|
||||
fi
|
||||
[ -n "$count" ] || return
|
||||
color b y w; printf "%s" "$count"; color -; color y w; printf "&"; color --
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,50 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# raid: notify raid events, failures and syncing
|
||||
#
|
||||
# Copyright (C) 2010 Canonical Ltd.
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__raid_detail() {
|
||||
[ -r /proc/mdstat ] && cat /proc/mdstat || true
|
||||
}
|
||||
|
||||
__raid() {
|
||||
[ -r /proc/mdstat ] || return
|
||||
while read line; do
|
||||
local p msg
|
||||
# Errors in your raid
|
||||
case "$line" in
|
||||
*\ blocks\ *\[*_*\])
|
||||
[ -z "${msg}" ] && msg="RAID"
|
||||
;;
|
||||
*%*)
|
||||
p="${line%%\%*}${PCT}"; p=${p##* };
|
||||
[ -z "$msg" ] && msg="RAID"
|
||||
msg="$msg,$p"
|
||||
;;
|
||||
esac
|
||||
done < /proc/mdstat
|
||||
if [ -n "$msg" ]; then
|
||||
color B w r; printf "%s" "$msg"; color --
|
||||
elif [ -e "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/raid" ]; then
|
||||
# Clear out cached raid message
|
||||
rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/raid"*
|
||||
fi
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,69 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# reboot_required: determine if a reboot is required
|
||||
#
|
||||
# Copyright (C) 2008 Canonical Ltd.
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
REBOOT_FLAG="/var/run/reboot-required"
|
||||
RELOAD_FLAG="$BYOBU_RUN_DIR/reload-required"
|
||||
POWERNAP_FLAG="/var/run/powernap/powersave"
|
||||
UNATTENDED_UPGRADE_FLAG="/var/run/unattended-upgrades.pid"
|
||||
|
||||
__reboot_required_detail() {
|
||||
[ -e "$REBOOT_FLAG" ] && ls -alF "$REBOOT_FLAG" 2>&1
|
||||
[ -e "$RELOAD_FLAG" ] && ls -alF "$RELOAD_FLAG" 2>&1
|
||||
[ -e "$POWERNAP_FLAG" ] && ls -alF "$POWERNAP_FLAG" 2>&1
|
||||
[ -e "$POWERNAP_FLAG" ] && cat "$POWERNAP_FLAG" 2>&1
|
||||
}
|
||||
|
||||
__reboot_required() {
|
||||
local status="$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/reboot_required"
|
||||
local livepatched=0
|
||||
if [ -e "$UNATTENDED_UPGRADE_FLAG" ]; then
|
||||
color b R W; printf "$ICON_UPGRADE "; color --;
|
||||
fi
|
||||
while read line; do
|
||||
set -- ${line}
|
||||
case "$line" in
|
||||
kpatch_livepatch_*)
|
||||
color k G; printf "$ICON_LIVEPATCHED"; color -;
|
||||
livepatched=1
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done < /proc/modules
|
||||
if [ -e "$REBOOT_FLAG" ]; then
|
||||
if [ "$livepatched" = "1" ]; then
|
||||
color k G; printf "$ICON_REBOOT"; color --;
|
||||
else
|
||||
color b k R; printf "$ICON_REBOOT"; color --;
|
||||
fi
|
||||
fi
|
||||
if [ -e "$RELOAD_FLAG" ]; then
|
||||
color b W; printf "<"; color -; color b b W; printf "F5"; color -; color b W; printf ">"; color -; printf " "
|
||||
elif [ -s "$status" ]; then
|
||||
rm -f "$status"
|
||||
fi
|
||||
if [ -e "$POWERNAP_FLAG" ]; then
|
||||
color b W; printf ".zZ"; color --
|
||||
elif [ -s "$status" ]; then
|
||||
rm -f "$status"
|
||||
fi
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,44 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
__release() {
|
||||
local RELEASE="${RELEASE}"
|
||||
if [ -n "$RELEASE" ]; then
|
||||
true
|
||||
elif [ "$(uname)" = "OpenBSD" ]; then
|
||||
# OpenBSD
|
||||
RELEASE=$(uname -r)
|
||||
elif [ "$(uname)" = "FreeBSD" ]; then
|
||||
# FreeBSD
|
||||
RELEASE=$(freebsd-version | cut -d'-' -f1)
|
||||
elif [ -r "/etc/os-release" ]; then
|
||||
if grep -q -E '^(Arch|Artix|Gentoo|Void)' /etc/os-release; then
|
||||
RELEASE="" # ローリングリリースの場合
|
||||
else
|
||||
RELEASE=$(. /etc/os-release && echo "$VERSION")
|
||||
fi
|
||||
elif [ -r "/etc/issue" ]; then
|
||||
local issue
|
||||
read issue < /etc/issue
|
||||
case "$issue" in
|
||||
Ubuntu*)
|
||||
set -- $issue;
|
||||
RELEASE="$2";
|
||||
;;
|
||||
Debian*)
|
||||
local ver
|
||||
read ver < /etc/debian_version
|
||||
RELEASE="$ver"
|
||||
;;
|
||||
esac
|
||||
elif eval $BYOBU_TEST sw_vers >/dev/null 2>&1; then
|
||||
RELEASE="$(sw_vers -productVersion)"
|
||||
fi
|
||||
if [ -z "$RELEASE" ] && eval $BYOBU_TEST lsb_release >/dev/null 2>&1; then
|
||||
RELEASE=$(lsb_release -s -r)
|
||||
fi
|
||||
if [ -n "$RELEASE_ABBREVIATED" ] && [ $RELEASE_ABBREVIATED -gt 0 ]; then
|
||||
color bold2; printf "%.${RELEASE_ABBREVIATED}s" "$RELEASE"; color --
|
||||
else
|
||||
color bold2; printf "%s" "$RELEASE"; color --
|
||||
fi
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# services: show what services are running on this server (configurable)
|
||||
#
|
||||
# Copyright (C) 2009 Canonical Ltd.
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__services_detail() {
|
||||
return
|
||||
}
|
||||
|
||||
service_running() {
|
||||
if [ -f "/etc/init/$1.conf" ]; then
|
||||
# Use upstart
|
||||
case "$(status $1 2>/dev/null)" in
|
||||
*running*)
|
||||
true
|
||||
;;
|
||||
*)
|
||||
false
|
||||
;;
|
||||
esac
|
||||
elif [ -f "/etc/init.d/$1" ]; then
|
||||
# Fall back to sysvinit
|
||||
/etc/init.d/$1 status >/dev/null 2>&1
|
||||
else
|
||||
false
|
||||
fi
|
||||
}
|
||||
|
||||
__services() {
|
||||
local services="$SERVICES"
|
||||
# Users can define a list of services to monitor in $BYOBU_CONFIG_DIR/status
|
||||
if [ -z "$services" ]; then
|
||||
if [ -f "/etc/eucalyptus/eucalyptus.conf" ]; then
|
||||
# If the user has not defined any services, but this system is a
|
||||
# UEC system, default to the list of Ubuntu Enterprise Cloud Services
|
||||
services="eucalyptus-cloud|CLC eucalyptus-walrus|WC eucalyptus-cc|CC eucalyptus-sc|SC eucalyptus-nc|NC"
|
||||
fi
|
||||
fi
|
||||
output=
|
||||
for i in $services; do
|
||||
service=${i%|*}
|
||||
nick=${i#*|}
|
||||
case "$service" in
|
||||
eucalyptus-nc)
|
||||
if service_running $service; then
|
||||
# This is a node controller, determine VM usage
|
||||
. /etc/eucalyptus/eucalyptus.conf
|
||||
count=$(pgrep -c -f /usr/bin/kvm || true)
|
||||
output="$output,NC:$count"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
service_running $service && output="$output,$nick"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
[ -n "$output" ] || return
|
||||
color w c; printf "%s" ${output#,}; color --
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,47 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# session: tmux session name
|
||||
#
|
||||
# Copyright (C) 2013-2014 Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__session_detail() {
|
||||
tmux list-sessions
|
||||
}
|
||||
|
||||
__session() {
|
||||
# Note: This will only work in byobu-tmux
|
||||
case "$BYOBU_BACKEND" in
|
||||
tmux)
|
||||
local count=$(tmux list-sessions 2>/dev/null | grep -v "^_" | wc -l)
|
||||
if [ $count -gt 1 ]; then
|
||||
color u W k; printf "${ICON_SESSION}#S"; color --
|
||||
else
|
||||
echo
|
||||
fi
|
||||
;;
|
||||
screen)
|
||||
local count=$(screen -ls | grep "^\s\+.*)$" | wc -l)
|
||||
if [ $count -gt 1 ]; then
|
||||
color u W k; printf "${ICON_SESSION}%S"; color --
|
||||
else
|
||||
echo
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,62 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# mem_swap: show the current swap available and used
|
||||
#
|
||||
# Copyright (C) 2010 Canonical Ltd.
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__swap_detail() {
|
||||
cat /proc/meminfo
|
||||
}
|
||||
|
||||
__swap() {
|
||||
local stotal="" sfree="" name="" val="" unit="" mem="" f="";
|
||||
while read name val unit; do
|
||||
if [ "$name" = "SwapTotal:" ]; then
|
||||
stotal="$val"
|
||||
elif [ "$name" = "SwapFree:" ]; then
|
||||
sfree="$val"
|
||||
else
|
||||
continue
|
||||
fi
|
||||
[ -n "$stotal" -a -n "$sfree" ] && break;
|
||||
done < /proc/meminfo
|
||||
if [ "${stotal:-0}" = "0" ]; then
|
||||
printf ""
|
||||
rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/swap"
|
||||
else
|
||||
mem=${stotal}
|
||||
f=$(((100*($stotal-$sfree))/$stotal))
|
||||
if [ $mem -ge 1048576 ]; then
|
||||
fpdiv "${mem}" 1048576 1
|
||||
mem=${_RET}
|
||||
unit="$ICON_GB"
|
||||
elif [ $mem -ge 1024 ]; then
|
||||
fpdiv "${mem}" 1024 0
|
||||
mem=${_RET}
|
||||
unit="$ICON_MB"
|
||||
else
|
||||
mem="$mem"
|
||||
unit="$ICON_KB"
|
||||
fi
|
||||
[ -n "$mem" ] || return
|
||||
color b G k; printf "s%s" "$mem"; color -; color G k; printf "%s" "$unit"; color -;
|
||||
color b G k; printf "%s" "$f"; color -; color G k; printf "%s" "$PCT"; color --
|
||||
fi
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,38 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# time: print the time in HH:MM:SS format
|
||||
#
|
||||
# Copyright (C) 2008 Canonical Ltd.
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__time_detail() {
|
||||
date
|
||||
}
|
||||
|
||||
__time() {
|
||||
local secs=1
|
||||
[ -n "$TIME_SECONDS" ] && secs=$TIME_SECONDS
|
||||
case "$BYOBU_BACKEND" in
|
||||
screen)
|
||||
format="\0050c"
|
||||
[ "$secs" != "0" ] && format="$format:\005s"
|
||||
printf $format
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,174 @@
|
|||
#!/bin/bash -e
|
||||
#---------------------------------------------------------------------
|
||||
# Script to display a "binary clock" using unicode characters from the
|
||||
# braille block.
|
||||
#
|
||||
# Designed to work with the wonderful byobu(1) but can be run
|
||||
# stand-alone.
|
||||
#---------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (C) 2011 Canonical Ltd.
|
||||
#
|
||||
# Author: James Hunt <james.hunt@canonical.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
|
||||
script_name=${0##*/}
|
||||
|
||||
# Selected Unicode Braille characters:
|
||||
#
|
||||
# 0x2800, 0x2880, 0x2820, 0x28a0, 0x2810, 0x2890, 0x2830, 0x28b0, 0x2808, 0x2888,
|
||||
# 0x2840, 0x28c0, 0x2860, 0x28e0, 0x2850, 0x28d0, 0x2870, 0x28f0, 0x2848, 0x28c8,
|
||||
# 0x2804, 0x2884, 0x2824, 0x28a4, 0x2814, 0x2894, 0x2834, 0x28b4, 0x280c, 0x288c,
|
||||
# 0x2844, 0x28c4, 0x2864, 0x28e4, 0x2854, 0x28d4, 0x287b, 0x28f4, 0x284c, 0x28cc,
|
||||
# 0x2802, 0x2882, 0x2822, 0x28a2, 0x2812, 0x2892, 0x2832, 0x28b2, 0x280a, 0x288a,
|
||||
# 0x2842, 0x28c2, 0x2862, 0x28e2, 0x2852, 0x28d2, 0x2872, 0x28f2, 0x284a, 0x28ca,
|
||||
# 0x2806, 0x2886
|
||||
#
|
||||
# Index of this array is 0-61 with character returned being
|
||||
# "two column" binary representation of a time segment.
|
||||
#
|
||||
binary=(⠀ ⢀ ⠠ ⢠ ⠐ ⢐ ⠰ ⢰ ⠈ ⢈ \
|
||||
⡀ ⣀ ⡠ ⣠ ⡐ ⣐ ⡰ ⣰ ⡈ ⣈ \
|
||||
⠄ ⢄ ⠤ ⢤ ⠔ ⢔ ⠴ ⢴ ⠌ ⢌ \
|
||||
⡄ ⣄ ⡤ ⣤ ⡔ ⣔ ⡻ ⣴ ⡌ ⣌ \
|
||||
⠂ ⢂ ⠢ ⢢ ⠒ ⢒ ⠲ ⢲ ⠊ ⢊ \
|
||||
⡂ ⣂ ⡢ ⣢ ⡒ ⣒ ⡲ ⣲ ⡊ ⣊ ⠆ ⢆)
|
||||
|
||||
usage()
|
||||
{
|
||||
cat <<EOT
|
||||
Description: A clock that displays the time in binary.
|
||||
|
||||
Usage: $script_name [options]
|
||||
|
||||
|
||||
Options:
|
||||
|
||||
-b : Display binary clock (default)
|
||||
-h : Show this help.
|
||||
-l : Display leading zeros (hex and octal modes only).
|
||||
-m : Show time in 24-hour military format
|
||||
(default: 12-hour format).
|
||||
-n : Suppress newline at end of time.
|
||||
-o : Display time in octal (base 8).
|
||||
-s <sep> : Specify separator between hours and minutes
|
||||
(and seconds if not disabled).
|
||||
-u : Display alphabetics in upper-case (hex mode only).
|
||||
-x : Disable time in hexadecimal (base 16).
|
||||
-z : Disable display of seconds.
|
||||
|
||||
EOT
|
||||
}
|
||||
|
||||
suppress_seconds=n
|
||||
clock_type=binary
|
||||
format=std
|
||||
ending=""
|
||||
uppercase=n
|
||||
leading_zeros=n
|
||||
|
||||
while getopts "bhlmnos:uxz" opt
|
||||
do
|
||||
case "$opt" in
|
||||
b)
|
||||
clock_type=binary
|
||||
;;
|
||||
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
|
||||
l)
|
||||
leading_zeros=y
|
||||
;;
|
||||
|
||||
m)
|
||||
format=mil
|
||||
;;
|
||||
|
||||
n)
|
||||
ending=
|
||||
;;
|
||||
|
||||
o)
|
||||
clock_type=oct
|
||||
;;
|
||||
|
||||
s)
|
||||
sep=$OPTARG
|
||||
;;
|
||||
|
||||
u)
|
||||
uppercase=y
|
||||
;;
|
||||
|
||||
x)
|
||||
clock_type=hex
|
||||
;;
|
||||
|
||||
z)
|
||||
suppress_seconds=y
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -z "$clock_type" ]
|
||||
then
|
||||
printf "%s\n" "ERROR: must specify clock type"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
shift $[$OPTIND-1]
|
||||
|
||||
# get current time, handling 12-hour or 24-hour
|
||||
if [ $format = std ]
|
||||
then
|
||||
hrs_format=%l
|
||||
else
|
||||
hrs_format=%k
|
||||
fi
|
||||
|
||||
time=($(date "+${hrs_format} %M %S"))
|
||||
h=$(printf ${time[0]})
|
||||
m=$(printf ${time[1]})
|
||||
s=$(printf ${time[2]})
|
||||
|
||||
if [ $clock_type = binary ]
|
||||
then
|
||||
[ $suppress_seconds = n ] && seconds="${sep}${binary[10#$s]}"
|
||||
display_time="${binary[10#$h]}${sep}${binary[10#$m]}${seconds}${ending}"
|
||||
else
|
||||
if [ $clock_type = hex ]
|
||||
then
|
||||
conversion=x
|
||||
[ $uppercase = y ] && conversion=X
|
||||
else
|
||||
conversion=o
|
||||
fi
|
||||
precision=
|
||||
[ $leading_zeros = y ] && precision=.2
|
||||
base_format=%2${precision}${conversion}
|
||||
|
||||
hh=$(printf "$base_format" $h)
|
||||
hm=$(printf "$base_format" $m)
|
||||
[ "$suppress_seconds" = n ] && hs="${sep}$(printf "$base_format" $s)"
|
||||
display_time="${hh}${sep}${hm}${hs}${ending}"
|
||||
fi
|
||||
|
||||
color k w
|
||||
printf "%s" "$display_time"
|
||||
color --
|
|
@ -0,0 +1,31 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# time_utc: print UTC time in HH:MM
|
||||
#
|
||||
# Copyright (C) 2010 Canonical Ltd.
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__time_utc_detail() {
|
||||
date -u
|
||||
}
|
||||
|
||||
__time_utc() {
|
||||
d=$(date -u +%H:%M)
|
||||
color invert; printf "%sUTC" "$d"; color --
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,37 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# trash: show icon (and optionally count) if entries in trash.
|
||||
#
|
||||
# Copyright (C) 2011 Canonical Ltd.
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: James Hunt <james.hunt@canonical.com>
|
||||
# Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
TRASH_DIR="$HOME/.local/share/Trash/files"
|
||||
|
||||
__trash_detail() {
|
||||
find "$TRASH_DIR"
|
||||
}
|
||||
|
||||
__trash() {
|
||||
local count
|
||||
[ -d "$TRASH_DIR" ] || return
|
||||
count=$(ls $dir|wc -l)
|
||||
[ "$count" = "0" ] && return
|
||||
printf "%s[%s]" "$ICON_TRASH" "$count"
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,165 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# updates_available: calculate and cache the number of updates available
|
||||
#
|
||||
# Copyright (C) 2008 Canonical Ltd.
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
___print_updates() {
|
||||
local u= s=
|
||||
read u s < "$1"
|
||||
if [ -n "$u" ]; then
|
||||
if [ "$u" -gt 0 ]; then
|
||||
color b r W; printf "%d" "$u"; color -; color r W
|
||||
if [ -n "$s" ] && [ "$s" -gt 0 ]; then
|
||||
printf "$ICON_SECURITY"
|
||||
else
|
||||
printf "$ICON_UPDATES"
|
||||
fi
|
||||
color --
|
||||
elif [ "$u" = "0" ] && [ -e "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/updates_available" ]; then
|
||||
# Clear out byobu's status cache
|
||||
rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/updates_available"*
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
___update_cache() {
|
||||
local mycache=$1 flock="$1.lock"
|
||||
# Now we actually have to do hard computational work to calculate updates.
|
||||
# Let's try to be "nice" about it:
|
||||
renice 10 $$ >/dev/null 2>&1 || true
|
||||
ionice -c3 -p $$ >/dev/null 2>&1 || true
|
||||
# These are very computationally intensive processes.
|
||||
# Background this work, have it write to the cache files,
|
||||
# and let the next cache check pick up the results.
|
||||
# Ensure that no more than one of these run at a given time
|
||||
if [ -x /usr/lib/update-notifier/apt-check ]; then
|
||||
# If apt-check binary exists, use it
|
||||
flock -xn "$flock" sh -c "(/usr/lib/update-notifier/apt-check 2>&1 | awk '-F;' 'END { print \$1, \$2 }' >\"${mycache}-x\" 2>/dev/null ; mv \"${mycache}-x\" \"$mycache\")" &
|
||||
elif eval $BYOBU_TEST apt-get >/dev/null; then
|
||||
# If apt-get exists, use it
|
||||
flock -xn "$flock" apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst >$mycache 2>/dev/null &
|
||||
elif eval $BYOBU_TEST pkcon >/dev/null; then
|
||||
# use packagekit to show list of packages
|
||||
LC_ALL=C flock -xn "$flock" pkcon get-updates -p | awk '/^Results:$/ { start=NR }; /^Security/ { security++ }; END { if (!/There are no updates available at this time./) { print NR-start, security }}' > "$mycache" 2>/dev/null &
|
||||
elif eval $BYOBU_TEST zypper >/dev/null; then
|
||||
# If zypper exists, use it
|
||||
flock -xn "$flock" zypper --no-refresh lu --best-effort | grep -c 'v |' >$mycache 2>/dev/null &
|
||||
elif eval $BYOBU_TEST yum >/dev/null; then
|
||||
# If yum exists, use it
|
||||
# TODO: We need a better way of counting updates available from a RH expert
|
||||
flock -xn "$flock" yum list updates -q | grep -vc "Updated Packages" >$mycache 2>/dev/null &
|
||||
elif eval $BYOBU_TEST pacman >/dev/null; then
|
||||
# If pacman (Archlinux) exists, use it
|
||||
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
|
||||
# If homebrew (Mac OSX) exists, use it, also background if flock exists
|
||||
if eval $BYOBU_TEST flock >/dev/null; then
|
||||
flock -xn "$flock" brew outdated | wc -l >$mycache 2>/dev/null &
|
||||
else
|
||||
brew outdated | wc -l >$mycache &
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
___update_needed() {
|
||||
# Checks if we need to update the cache.
|
||||
# TODO: add more distro
|
||||
local mycache=$1
|
||||
# The cache doesn't exist: create it
|
||||
[ ! -e "$mycache" ] && return 0
|
||||
if eval $BYOBU_TEST apt-get >/dev/null; then
|
||||
# Debian/ubuntu
|
||||
d0=$(($(stat -c %Y $mycache 2>/dev/null)-5))
|
||||
d1=$(stat -c %Y /var/lib/apt)
|
||||
d2=$(stat -c %Y /var/lib/apt/lists)
|
||||
d3=$(stat -c %Y /var/log/dpkg.log)
|
||||
now=$(date +%s)
|
||||
delta=$(($now-$d0))
|
||||
if [ $d0 -lt 0 ] || [ $d0 -lt $d1 ] || [ $d0 -lt $d2 ] || [ $d0 -lt $d3 ] || [ 3605 -lt $delta ] ; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
elif [ -e "/var/lib/PackageKit/transactions.db" ]; then
|
||||
[ "/var/lib/PackageKit/transactions.db" -nt "$mycache" ]
|
||||
return $?
|
||||
elif eval $BYOBU_TEST pacman >/dev/null; then
|
||||
# Archlinux
|
||||
local db
|
||||
for db in /var/lib/pacman/sync/*.db; do
|
||||
[ "$db" -nt "$mycache" ] && return 0
|
||||
done
|
||||
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
|
||||
# Mac OSX
|
||||
# check if any new versions have been installed since
|
||||
# we last cached. this may not recognize formulae
|
||||
# installed with HEAD
|
||||
for f in $(brew --prefix)/Cellar/*; do
|
||||
[ "$f" -nt "$mycache" ] && return 0
|
||||
done
|
||||
# nothing new has been installed, so check wether the
|
||||
# formulae database was updated
|
||||
[ "$(brew --prefix)/Library/Formula" -nt "$mycache" ]
|
||||
return $?
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
__updates_available_detail() {
|
||||
if eval $BYOBU_TEST apt-get >/dev/null; then
|
||||
local detail=`apt-get -s -o Debug::NoLocking=true upgrade`
|
||||
if [ "$1" = "--detail" ]; then
|
||||
printf "$detail"
|
||||
else
|
||||
local short=`printf "%s" "$detail" | grep -c ^Inst`
|
||||
printf "$short"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
__updates_available() {
|
||||
local mycache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/updates-available"
|
||||
# If mycache is present, use it
|
||||
[ -r $mycache ] && ___print_updates "$mycache"
|
||||
# If we really need to do so (mycache doesn't exist, or the package database has changed),
|
||||
# background an update now
|
||||
___update_needed "$mycache" && ___update_cache "$mycache"
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,56 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# uptime: condensed uptime of the machine
|
||||
#
|
||||
# Copyright (C) 2009 Raphaël Pinson.
|
||||
# Copyright (C) 2009 Canonical Ltd.
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Raphaël Pinson <raphink@ubuntu.com>
|
||||
# Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__uptime_detail() {
|
||||
uptime
|
||||
}
|
||||
|
||||
__uptime() {
|
||||
local u= idle= str=
|
||||
if [ -r /proc/uptime ]; then
|
||||
read u idle < /proc/uptime
|
||||
u=${u%.*}
|
||||
elif [ -x /usr/sbin/sysctl ]; then
|
||||
# MacOS support
|
||||
u=$(/usr/sbin/sysctl -n kern.boottime | cut -f4 -d' ' | cut -d',' -f1)
|
||||
u=$(($(date +%s) - $u))
|
||||
fi
|
||||
if [ "$u" ]; then
|
||||
if [ "$u" -gt 86400 ]; then
|
||||
str="$(($u / 86400))d$((($u % 86400) / 3600))h"
|
||||
elif [ "$u" -gt 3600 ]; then
|
||||
str="$(($u / 3600))h$((($u % 3600) / 60))m"
|
||||
elif [ "$u" -gt 60 ]; then
|
||||
str="$(($u / 60))m"
|
||||
else
|
||||
str="${u}s"
|
||||
fi
|
||||
else
|
||||
# Last ditch hack
|
||||
str=$(uptime | sed -e "s/.* up *//" -e "s/ *days, */d/" -e "s/:/h/" -e "s/,.*/m/")
|
||||
fi
|
||||
[ -n "$str" ] || return
|
||||
color w b; printf "%s" "${str}"; color --
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,44 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# users: print the number of remote users on the machine
|
||||
#
|
||||
# Copyright (C) 2009 Raphaël Pinson.
|
||||
# Copyright (C) 2009 Canonical Ltd.
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Raphaël Pinson <raphink@ubuntu.com>
|
||||
# Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__users_detail() {
|
||||
ps -ef 2>/dev/null | grep "sshd:.*@" | grep -v grep
|
||||
}
|
||||
|
||||
__users() {
|
||||
local count=0
|
||||
if [ "$USERS_DISTINCT" = "1" ]; then
|
||||
count=$(pgrep -fl 'sshd:.*@' | cut -f3 -d\ | cut -f1 -d@ | sort -u | wc -l)
|
||||
else
|
||||
# Note: we'd like to use pgrep -c, however, this isn't available in
|
||||
# busybox and some distro's pgrep (and it doesn't exit non-zero).
|
||||
count=$(pgrep -f "^sshd:.*@|^/usr/sbin/sshd -i" | wc -l) || return
|
||||
fi
|
||||
if [ $count -gt 0 ]; then
|
||||
color b w r; printf "%d" "$count"; color -; color w r; printf "##"; color --
|
||||
else
|
||||
rm -f "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/users"*
|
||||
fi
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,46 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# whoami: report current logged in user
|
||||
#
|
||||
# Copyright (C) 2008 Canonical Ltd.
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# 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() {
|
||||
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() {
|
||||
local user=$(___get_user)
|
||||
[ -n "$user" ] || return
|
||||
color bold2; printf "%s@" "$user"; color -
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,82 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# wifi_quality: display wifi signal quality
|
||||
#
|
||||
# Copyright (C) 2008 Canonical Ltd.
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# 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() {
|
||||
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() {
|
||||
local out bitrate quality
|
||||
if 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"
|
||||
elif eval $BYOBU_TEST iw >/dev/null 2>&1; then
|
||||
local dev
|
||||
for dev in $(___get_dev_list); do
|
||||
# iw is expected to output lines like:
|
||||
# signal: -50 dBm
|
||||
# rx bitrate: 216.0 MBit/s MCS 13 40MHz
|
||||
# signal to quality: https://superuser.com/a/1360447
|
||||
out=`iw dev "$dev" link 2>/dev/null |
|
||||
awk '$0 ~ /^\s*signal:/ { a = 100 * ($2 + 110) / 70;
|
||||
printf "quality=%.0f\n", (a > 100) ? 100 : ((a < 0) ? 0 : a); }
|
||||
$0 ~ /^\s*rx bitrate:/ { printf "bitrate=%s\n", $3; }
|
||||
'`
|
||||
eval "$out"
|
||||
[ -z "$bitrate" ] || [ -z "$quality" ] || break
|
||||
done
|
||||
fi
|
||||
[ -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"*
|
||||
fi
|
||||
}
|
||||
|
||||
# vi: syntax=sh ts=4 noexpandtab
|
|
@ -0,0 +1,9 @@
|
|||
[Desktop Entry]
|
||||
Name=Byobu Terminal
|
||||
Comment=Advanced Command Line and Text Window Manager
|
||||
Icon=byobu
|
||||
Exec=gnome-terminal --app-id us.kirkland.terminals.byobu --class=us.kirkland.terminals.byobu -e byobu
|
||||
Type=Application
|
||||
Categories=GNOME;GTK;System;Utility;TerminalEmulator;
|
||||
StartupWMClass=us.kirkland.terminals.byobu
|
||||
X-GNOME-Gettext-Domain=byobu
|
|
@ -0,0 +1,9 @@
|
|||
[Desktop Entry]
|
||||
Name=Byobu Terminal
|
||||
Comment=Advanced Command Line and Text Window Manager
|
||||
Icon=byobu
|
||||
Exec=env TERM=xterm-256color byobu
|
||||
Terminal=true
|
||||
Type=Application
|
||||
Categories=GNOME;GTK;Utility;
|
||||
X-GNOME-Gettext-Domain=byobu
|
|
@ -0,0 +1,2 @@
|
|||
source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.screen.disable
|
||||
source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.screen
|
|
@ -0,0 +1 @@
|
|||
source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.screen
|
|
@ -0,0 +1,92 @@
|
|||
###############################################################################
|
||||
# Byobu f-key keybindings
|
||||
# This configuration profile is intended to provide a useful
|
||||
# keybindings using the keyboard's f-keys
|
||||
#
|
||||
# Copyright (C) 2008-2014 Dustin Kirkland <kirkland@byobu.org>
|
||||
# Nick Barcet <nick.barcet@canonical.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
###############################################################################
|
||||
|
||||
# Byobu's escape key is ASCII Dec:94, Hex:5E, Oct:136, Char: ctrl-^ -- ctrl-caret
|
||||
# which is bound to F12
|
||||
escape ^^^^
|
||||
register x "^^" # | Goes with the F12 definition
|
||||
|
||||
# F-keys seem to work well in both gnome-terminal and tty consoles
|
||||
bindkey -k k1 $BYOBU_BACKEND -t config 0 byobu-config # F1 | Configuration (along with F9)
|
||||
# | since F1 = Help in gnome-terminal
|
||||
bindkey "^[O1;2P" $BYOBU_BACKEND -t help 0 $BYOBU_PAGER $BYOBU_PREFIX/share/doc/byobu/help.screen.txt # shift-F1 | help
|
||||
bindkey -k k2 $BYOBU_BACKEND # F2 | Create new window
|
||||
bindkey "^[O1;5Q" eval 'split -v' 'focus down' 'next' 'focus up' 'layout save byobu' 'layout autosave' 'screen' # ctrl-F2 | vertical split
|
||||
bindkey "^[O1;2Q" eval 'split' 'focus down' 'next' 'focus up' 'layout save byobu' 'layout autosave' 'screen' # shift-F2 | horizontal split
|
||||
# No ctrl-shift-F2 (new session) in Screen
|
||||
bindkey -k k3 eval 'prev' 'fit' # F3 | Previous Window
|
||||
bindkey -k k4 eval 'next' 'fit' # F4 | Next Window
|
||||
bindkey "^[[1;3D" eval 'prev' 'fit' # alt-left | Previous Window
|
||||
bindkey "^[[1;3C" eval 'next' 'fit' # alt-right | Next Window
|
||||
# No alt-up (previous session) in Screen
|
||||
# No alt-down (next session) in Screen
|
||||
bindkey "^[O1;2R" focus up # shift-F3 | focus up
|
||||
bindkey "^[O1;2S" focus down # shift-F4 | focus down
|
||||
bindkey "^[[1;2A" focus up # shift-up | focus up
|
||||
bindkey "^[[1;2B" focus down # shift-up | focus down
|
||||
bindkey "^[[1;2D" focus up # shift-left | focus up
|
||||
bindkey "^[[1;2C" focus down # shift-right | focus down
|
||||
# No ctrl-shift-F3 (move pane) in Screen
|
||||
# No ctrl-shift-F4 (move pane) in Screen
|
||||
bindkey "^[[1;4A" resize +1 # shift-alt-up | resize +1
|
||||
bindkey "^[[1;4B" resize -1 # shift-alt-down | resize -1
|
||||
bindkey "^[[1;4D" resize -1 # shift-alt-left | resize -1
|
||||
bindkey "^[[1;4C" resize +1 # shift-alt-right | resize +1
|
||||
register r ":source $BYOBU_CONFIG_DIR/profile^M" # | Goes with F5 definition
|
||||
bindkey -k k5 eval 'process x' 'process r' # F5 | Reload profile
|
||||
bindkey "^[[15;5~" eval 'process x' 'process r' 'stuff ". $BYOBU_PREFIX/bin/byobu-reconnect-sockets^M"' # ctrl-F5 | reconnect gpg/ssh/x sockets
|
||||
bindkey "^[[15;6~" $BYOBU_BACKEND -t color 0 byobu-select-profile # ctrl-shift-F5 | choose a background color
|
||||
bindkey "^[[15;2~" only # shift-F5 | kill all splits
|
||||
bindkey "^[[31~" only # shift-F5 | kill all splits
|
||||
bindkey -k k6 detach # F6 | Detach from this session
|
||||
bindkey "^[[17;2~" eval 'exec touch $BYOBU_RUN_DIR/no-logout' 'detach' # shift-F6 | detach, but don't logout
|
||||
bindkey "^[[32~" eval 'exec touch $BYOBU_RUN_DIR/no-logout' 'detach' # shift-F6 | detach, but don't logout
|
||||
bindkey "^[[17;5~" remove # ctrl-F6 | kill this split
|
||||
# ctrl-F6 | sadly, does not work in tty :-(
|
||||
bindkey -k k7 copy # F7 | Enter copy/scrollback mode
|
||||
register p "^[[5~"
|
||||
bindkey "^[[5;3~" eval 'msgwait 0' 'msgminwait 0' 'copy' 'process p' 'msgwait 1' 'echo "Byobu scrollback mode (alt-pgup / alt-pgdown)"' # alt-pageup | scrollback
|
||||
register n "^[[6~"
|
||||
bindkey "^[[6;3~" eval 'msgwait 0' 'msgminwait 0' 'copy' 'process n' 'msgwait 1' 'echo "Byobu scrollback mode (alt-pgup / alt-pgdown)"' # alt-pagedn | scrollback
|
||||
register t "A^[OH^k^h" # | Goes with the F8 definition
|
||||
bindkey -k k8 eval 'process x' 'process t' # F8 | Re-title a window
|
||||
register u ":sessionname " # | Goes with the Ctrl-F8 definition
|
||||
bindkey "^[[19;5~" eval 'process x' 'process u' # Ctrl-F8 | Re-title a session
|
||||
# No alt-shift-F8 (restore layout) in Screen
|
||||
# No ctrl-shift-F8 (save layout) in Screen
|
||||
bindkey -k k9 $BYOBU_BACKEND -t config 0 byobu-config # F9 | Configuration
|
||||
register s "[g G$>^h" # Goes with Shift-F7 and F12 ~ definition
|
||||
bindkey "^[[18;2~" eval 'process x' 'process s' 'exec $BYOBU_SED_INLINE -e "/./,/^$/!d" $BYOBU_RUN_DIR/printscreen' '$BYOBU_BACKEND -t PRINTSCREEN $BYOBU_EDITOR $BYOBU_RUN_DIR/printscreen' # Shift-F7 | write the buffer to file, open in a new window
|
||||
# F10 | 'toolbar' in gnome-terminal
|
||||
# F11 | 'Full Screen' in gnome-terminal
|
||||
# No alt-F11 (break pane) in Screen
|
||||
# No ctrl-F11 (join pane) in Screen
|
||||
# No shift-F11 (join pane) in Screen
|
||||
bindkey -k F2 process x # F12 | Byobu's escape key
|
||||
bind $ $BYOBU_BACKEND -t status 0 byobu-status-detail # F12 $ | show detailed status
|
||||
bind @ $BYOBU_BACKEND -t config 0 byobu-config # F12 @ | Configuration
|
||||
bind R process r # F12 R | Reload profile
|
||||
bind ~ eval 'process x' 'process s' 'exec $BYOBU_SED_INLINE -e "/./,/^$/!d" $BYOBU_RUN_DIR/printscreen' '$BYOBU_BACKEND -t PRINTSCREEN $BYOBU_EDITOR $BYOBU_RUN_DIR/printscreen' # F12 ~ | write the buffer to file, open in a new window
|
||||
|
||||
register d ":source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.screen.disable^M"
|
||||
bind ! eval 'process x' 'process d' 'backtick 111 9999999 9999999 byobu-status menu --disable-f-keys' # F12 ! | toggle on/off f-keys
|
||||
|
||||
bindkey "^A" $BYOBU_BACKEND -t ctrl-a byobu-ctrl-a
|
|
@ -0,0 +1,82 @@
|
|||
###############################################################################
|
||||
# Disable Byobu's f-key keybindings, define a set using Screen's escape
|
||||
# sequence.
|
||||
#
|
||||
# Copyright (C) 2009-2014 Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
###############################################################################
|
||||
|
||||
# This file disables the f-key bindings, but retains the
|
||||
# keybindings that use Screen's built-in escape sequence
|
||||
|
||||
# Default Screen escape
|
||||
escape ^Aa
|
||||
register x "^A"
|
||||
|
||||
# Use the following sequences for byobu functionality
|
||||
# SEQUENCE ACTION F-Key equivalent
|
||||
# ctrl-a-c Create a new window F2
|
||||
# ctrl-a-p Previous window F3
|
||||
# ctrl-a-n Next window F4
|
||||
# ctrl-a-R Reload profile F5
|
||||
register r ":source $BYOBU_CONFIG_DIR/profile^M"
|
||||
bind R eval 'process x' 'process r'
|
||||
# ctrl-a-d Detach from this session F6
|
||||
# ctrl-a-[ Enter copy/scrollback mode F7
|
||||
# ctrl-a-A Re-title a window F8
|
||||
# ctrl-a-@ Configuration F9
|
||||
bind @ $BYOBU_BACKEND -t config 0 byobu-config
|
||||
# ctrl-a-$ Show detailed status
|
||||
bind $ $BYOBU_BACKEND -t status 0 byobu-status-detail
|
||||
# ctrl-a-! Toggle f-key keybindings on
|
||||
register e ":source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.screen^M"
|
||||
bind ! eval 'process x' 'process e' 'backtick 111 9999999 9999999 byobu-status menu'
|
||||
|
||||
# Disable the f-key bindings
|
||||
bindkey -k k1
|
||||
bindkey "^[O1;2P"
|
||||
bindkey -k k2
|
||||
bindkey "^[O1;5Q"
|
||||
bindkey "^[O1;2Q"
|
||||
bindkey -k k3
|
||||
bindkey -k k4
|
||||
bindkey "^[[1;3D"
|
||||
bindkey "^[[1;3C"
|
||||
bindkey "^[O1;2R"
|
||||
bindkey "^[O1;2S"
|
||||
bindkey "^[[1;2A"
|
||||
bindkey "^[[1;2B"
|
||||
bindkey "^[[1;2D"
|
||||
bindkey "^[[1;2C"
|
||||
bindkey "^[[1;4A"
|
||||
bindkey "^[[1;4B"
|
||||
bindkey "^[[1;4D"
|
||||
bindkey "^[[1;4C"
|
||||
bindkey -k k5
|
||||
bindkey "^[[15;5~"
|
||||
bindkey "^[[15;6~"
|
||||
bindkey "^[[15;2~"
|
||||
bindkey "^[[31~"
|
||||
bindkey -k k6
|
||||
bindkey "^[[17;2~"
|
||||
bindkey "^[[32~"
|
||||
bindkey "^[[17;5~"
|
||||
bindkey -k k7
|
||||
bindkey "^[[18;2~"
|
||||
bindkey "^[[5;3~"
|
||||
bindkey "^[[6;3~"
|
||||
bindkey -k k8
|
||||
bindkey "^[[19;5~"
|
||||
bindkey -k k9
|
||||
bindkey -k F2
|
|
@ -0,0 +1,85 @@
|
|||
###############################################################################
|
||||
# byobu's tmux f-key keybindings
|
||||
#
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
###############################################################################
|
||||
|
||||
# Add F12 to the prefix list
|
||||
set -g prefix F12
|
||||
|
||||
# Clear the slate
|
||||
source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.tmux.disable
|
||||
|
||||
# Byobu's Keybindings
|
||||
# Documented in: $BYOBU_PREFIX/share/doc/byobu/help.tmux.txt
|
||||
bind-key -n F1 new-window -n config byobu-config
|
||||
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 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 C-S-F2 new-session \; rename-window "-"
|
||||
bind-key -n F3 previous-window
|
||||
bind-key -n F4 next-window
|
||||
bind-key -n M-Left previous-window
|
||||
bind-key -n M-Right next-window
|
||||
bind-key -n M-Up switch-client -p
|
||||
bind-key -n M-Down switch-client -n
|
||||
bind-key -n S-F3 display-panes \; select-pane -t :.-
|
||||
bind-key -n S-F4 display-panes \; select-pane -t :.+
|
||||
bind-key -n S-Up display-panes \; select-pane -U
|
||||
bind-key -n S-Down display-panes \; select-pane -D
|
||||
bind-key -n S-Left display-panes \; select-pane -L
|
||||
bind-key -n S-Right display-panes \; select-pane -R
|
||||
bind-key -n C-F3 display-panes \; swap-pane -s :. -t :.- \; select-pane -t :.-
|
||||
bind-key -n C-F4 display-panes \; swap-pane -s :. -t :.+ \; select-pane -t :.+
|
||||
bind-key -n C-S-F3 swap-window -t :-1 -d
|
||||
bind-key -n C-S-F4 swap-window -t :+1 -d
|
||||
bind-key -n M-S-Up resize-pane -U
|
||||
bind-key -n M-S-Down resize-pane -D
|
||||
bind-key -n M-S-Left resize-pane -L
|
||||
bind-key -n M-S-Right resize-pane -R
|
||||
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 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-S-F5 new-window -d "byobu-select-profile -r"
|
||||
bind-key -n F6 detach
|
||||
bind-key -n M-F6 run-shell '$BYOBU_PREFIX/lib/byobu/include/tmux-detach-all-but-current-client'
|
||||
bind-key -n S-F6 run-shell 'exec touch $BYOBU_RUN_DIR/no-logout' \; detach
|
||||
bind-key -n C-F6 kill-pane
|
||||
bind-key -n F7 copy-mode
|
||||
bind-key -n S-F7 capture-pane -S -32768 \; save-buffer "$BYOBU_RUN_DIR/printscreen" \; delete-buffer \; new-window -n "PRINTSCREEN" "$BYOBU_EDITOR $BYOBU_RUN_DIR/printscreen"
|
||||
bind-key -n M-NPage copy-mode \; send-keys NPage
|
||||
bind-key -n M-PPage copy-mode \; send-keys PPage
|
||||
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 S-F8 next-layout
|
||||
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 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 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-F11 break-pane
|
||||
bind-key -n C-F11 join-pane -h -s :. -t :-1
|
||||
bind-key -n S-F11 resize-pane -Z
|
||||
bind-key -n S-F12 source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.tmux.disable \; display-message "Byobu F-keys: DISABLED"
|
||||
bind-key -n C-S-F12 new-window $BYOBU_PREFIX/lib/byobu/include/mondrian
|
||||
bind-key -n M-F12 source $BYOBU_PREFIX/share/byobu/keybindings/mouse.tmux.enable
|
||||
bind-key -n M-IC paste-buffer
|
||||
|
||||
bind-key -n C-a new-window -n "ctrl-a" "byobu-ctrl-a"
|
|
@ -0,0 +1,85 @@
|
|||
###############################################################################
|
||||
# disable byobu's tmux f-key keybindings
|
||||
#
|
||||
# Copyright (C) 2011-2014 Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
###############################################################################
|
||||
|
||||
# Undo Byobu's Keybindings
|
||||
unbind-key -n F1
|
||||
unbind-key -n S-F1
|
||||
unbind-key -n F2
|
||||
unbind-key -n C-F2
|
||||
unbind-key -n S-F2
|
||||
unbind-key -n C-S-F2
|
||||
unbind-key -n F3
|
||||
unbind-key -n F4
|
||||
unbind-key -n C-Up
|
||||
unbind-key -n C-Down
|
||||
unbind-key -n C-Left
|
||||
unbind-key -n C-Right
|
||||
unbind-key -n C-S-Left
|
||||
unbind-key -n C-S-Right
|
||||
unbind-key -n C-S-Up
|
||||
unbind-key -n C-S-Down
|
||||
unbind-key -n S-F3
|
||||
unbind-key -n S-F4
|
||||
unbind-key -n S-Up
|
||||
unbind-key -n S-Down
|
||||
unbind-key -n S-Left
|
||||
unbind-key -n S-Right
|
||||
unbind-key -n C-F3
|
||||
unbind-key -n C-F4
|
||||
unbind-key -n C-S-F3
|
||||
unbind-key -n C-S-F4
|
||||
unbind-key -n M-Up
|
||||
unbind-key -n M-Down
|
||||
unbind-key -n M-Left
|
||||
unbind-key -n M-Right
|
||||
unbind-key -n S-M-Up
|
||||
unbind-key -n S-M-Down
|
||||
unbind-key -n S-M-Left
|
||||
unbind-key -n S-M-Right
|
||||
unbind-key -n F5
|
||||
unbind-key -n M-F5
|
||||
unbind-key -n S-F5
|
||||
unbind-key -n C-F5
|
||||
unbind-key -n C-S-F5
|
||||
unbind-key -n F6
|
||||
unbind-key -n M-F6
|
||||
unbind-key -n S-F6
|
||||
unbind-key -n C-F6
|
||||
unbind-key -n F7
|
||||
unbind-key -n S-F7
|
||||
unbind-key -n M-NPage
|
||||
unbind-key -n M-PPage
|
||||
unbind-key -n F8
|
||||
unbind-key -n C-F8
|
||||
unbind-key -n C-S-F8
|
||||
unbind-key -n M-S-F8
|
||||
unbind-key -n S-F8
|
||||
unbind-key -n F9
|
||||
unbind-key -n M-F9
|
||||
unbind-key -n S-F9
|
||||
unbind-key -n C-F9
|
||||
unbind-key -n M-F11
|
||||
unbind-key -n C-F11
|
||||
unbind-key -n S-F11
|
||||
bind-key -n S-F12 source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.tmux \; source $HOME/.byobu/keybindings.tmux \; display-message "Byobu F-keys: ENABLED"
|
||||
unbind-key -n M-F12
|
||||
unbind-key -n C-S-F12
|
||||
unbind-key -n M-IC
|
||||
unbind-key -n C-a
|
|
@ -0,0 +1,9 @@
|
|||
# New, as of tmux 2.1
|
||||
set -g mouse on
|
||||
set -g mouse-utf8 on
|
||||
# Old, before tmux 2.1
|
||||
set -g mouse-resize-pane on
|
||||
set -g mouse-select-pane on
|
||||
set -g mouse-select-window on
|
||||
set -g mode-mouse on
|
||||
bind-key -n M-F12 source $BYOBU_PREFIX/share/byobu/keybindings/mouse.tmux.enable \; display-message "Mouse: OFF"
|
|
@ -0,0 +1,9 @@
|
|||
# New, as of tmux 2.1
|
||||
set -g mouse off
|
||||
set -g mouse-utf8 off
|
||||
# Old, before tmux 2.1
|
||||
set -g mouse-resize-pane off
|
||||
set -g mouse-select-pane off
|
||||
set -g mouse-select-window off
|
||||
set -g mode-mouse off
|
||||
bind-key -n M-F12 source $BYOBU_PREFIX/share/byobu/keybindings/mouse.tmux.disable \; display-message "Mouse: ON"
|
|
@ -0,0 +1 @@
|
|||
# This is intended to be a completely empty set of keybindings
|
|
@ -0,0 +1,103 @@
|
|||
# tmux-screen-keys.conf
|
||||
#
|
||||
# By Nicholas Marriott. Public domain.
|
||||
# Updated by Dustin Kirkland.
|
||||
#
|
||||
# This configuration file binds many of the common GNU screen key bindings to
|
||||
# appropriate tmux key bindings. Note that for some key bindings there is no
|
||||
# tmux analogue and also that this set omits binding some commands available in
|
||||
# tmux but not in screen.
|
||||
#
|
||||
# Note this is only a selection of key bindings and they are in addition to the
|
||||
# normal tmux key bindings. This is intended as an example not as to be used
|
||||
# as-is.
|
||||
|
||||
# Set the prefix to ^A.
|
||||
unbind C-b
|
||||
set -g prefix ^A
|
||||
bind a send-prefix
|
||||
|
||||
# Bind appropriate commands similar to screen.
|
||||
# lockscreen ^X x
|
||||
unbind ^X
|
||||
bind ^X lock-server
|
||||
unbind x
|
||||
bind x lock-server
|
||||
|
||||
# screen ^C c
|
||||
unbind ^C
|
||||
bind ^C new-window -c "#{pane_current_path}"
|
||||
unbind c
|
||||
bind c new-window -c "#{pane_current_path}"
|
||||
|
||||
# detach ^D d
|
||||
unbind ^D
|
||||
bind ^D detach
|
||||
|
||||
# displays *
|
||||
unbind *
|
||||
bind * list-clients
|
||||
|
||||
# next ^@ ^N sp n
|
||||
unbind ^@
|
||||
bind ^@ next-window
|
||||
unbind ^N
|
||||
bind ^N next-window
|
||||
unbind " "
|
||||
bind " " next-window
|
||||
unbind n
|
||||
bind n next-window
|
||||
|
||||
# title A
|
||||
unbind A
|
||||
bind A command-prompt "rename-window %%"
|
||||
|
||||
# other ^A
|
||||
unbind ^A
|
||||
bind ^A last-window
|
||||
|
||||
# prev ^H ^P p ^?
|
||||
unbind ^H
|
||||
bind ^H previous-window
|
||||
unbind ^P
|
||||
bind ^P previous-window
|
||||
unbind p
|
||||
bind p previous-window
|
||||
unbind BSpace
|
||||
bind BSpace previous-window
|
||||
|
||||
# windows ^W w
|
||||
unbind ^W
|
||||
bind ^W list-windows
|
||||
unbind w
|
||||
bind w list-windows
|
||||
|
||||
# quit \
|
||||
unbind '\'
|
||||
bind '\' confirm-before "kill-server"
|
||||
|
||||
# kill K k
|
||||
unbind K
|
||||
bind K confirm-before "kill-window"
|
||||
unbind k
|
||||
bind k confirm-before "kill-window"
|
||||
|
||||
# redisplay ^L l
|
||||
unbind ^L
|
||||
bind ^L refresh-client
|
||||
unbind l
|
||||
bind l refresh-client
|
||||
|
||||
# split -v |
|
||||
unbind |
|
||||
bind | split-window -c "#{pane_current_path}"
|
||||
|
||||
# :kB: focus up
|
||||
unbind Tab
|
||||
bind Tab select-pane -t:.+
|
||||
unbind BTab
|
||||
bind BTab select-pane -t:.-
|
||||
|
||||
# " windowlist -b
|
||||
unbind '"'
|
||||
bind '"' choose-window
|
|
@ -0,0 +1,394 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="300"
|
||||
height="300"
|
||||
id="svg6345"
|
||||
version="1.1"
|
||||
inkscape:version="0.91 r13725"
|
||||
sodipodi:docname="byobu_dev.svg">
|
||||
<defs
|
||||
id="defs6347">
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="0 : 384 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_z="1024 : 384 : 1"
|
||||
inkscape:persp3d-origin="512 : 256 : 1"
|
||||
id="perspective6353" />
|
||||
<inkscape:perspective
|
||||
id="perspective6363"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective6353-9"
|
||||
inkscape:persp3d-origin="512 : 256 : 1"
|
||||
inkscape:vp_z="1024 : 384 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 384 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
id="perspective6363-5" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="2.0000001"
|
||||
inkscape:cx="153.52848"
|
||||
inkscape:cy="87.089627"
|
||||
inkscape:current-layer="layer5"
|
||||
inkscape:document-units="px"
|
||||
showgrid="false"
|
||||
inkscape:window-width="2490"
|
||||
inkscape:window-height="1401"
|
||||
inkscape:window-x="70"
|
||||
inkscape:window-y="39"
|
||||
inkscape:window-maximized="1" />
|
||||
<metadata
|
||||
id="metadata6350">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer5"
|
||||
inkscape:label="icon"
|
||||
style="display:inline">
|
||||
<path
|
||||
style="display:inline;fill:#f9dfb5;fill-opacity:1;stroke:none;stroke-width:6.46818447;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 202.8386,11.42789 84.70126,7.10605 -4.12095,264.13156 -79.84287,6.17163 z"
|
||||
id="path4188-0"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccccc" />
|
||||
<path
|
||||
style="display:inline;fill:#ffe0c9;fill-opacity:1;stroke:none;stroke-width:6.46799994;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 108.61566,275.50806 0.51115,-250.6133 92.66051,-13.41778 0.96231,277.50414 z"
|
||||
id="path4700-1"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccccc" />
|
||||
<path
|
||||
style="display:inline;fill:#ffcca3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:6.46799994;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 12.3103,15.17486 94.9796,9.88249 -0.90408,250.33701 -91.32217,10.53727 z"
|
||||
id="path4702-9"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccccc" />
|
||||
<path
|
||||
style="display:inline;fill:#008000;fill-opacity:1;stroke:#4b3b30;stroke-width:1.10000002;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 241.08789,42.742188 -52.53125,45.310546 -19.66797,-1.292968 0.65235,26.425784 -17.53711,9.53515 6.88671,26.60742 -14.14843,16.97657 -29.00196,-26.68164 -0.54687,-15.08594 L 145.12695,97 142.9375,94.619141 116.06445,119.3418 126.30078,79.455078 120.66211,78.007812 111.38086,114.17188 68.167969,91.125 41.994141,92.271484 46.171875,73.595703 43.015625,72.890625 37.916016,95.6875 l 29.509765,-1.292969 43.128909,23.001949 -1.26563,4.93164 0.23828,6.59766 -26.091793,10.04883 -32.601563,-25.79492 -12.52539,-1.92188 -0.685547,4.47657 11.339844,1.73828 33.689453,26.65625 27.048826,-10.41797 0.3086,8.55078 34.28515,31.54297 15.38867,32.56054 -35.59961,16.30079 -23.97656,-20.01368 -66.078123,4.13672 0.306641,4.89258 64.128906,-4.01367 24.849606,20.74219 38.46289,-17.61328 2.60547,5.51171 7.72657,3.69141 -32.98829,23.30469 1.86719,2.64062 34.46484,-24.34765 23.99805,11.46484 56.0625,47.33008 3.75586,-4.44727 -56.02539,-47.30078 49.32813,-24.39453 -2.29493,-4.63867 -52.74218,26.08398 -4.6543,-2.22461 40.99414,-34.81445 -3.34961,-3.94336 -42.76172,36.31445 -19.00195,-9.07812 -19.68945,-41.66016 -0.51758,-0.47656 29.04687,-34.85938 58.20899,-39.10937 19.7832,-2.935547 0.4707,0 0,-5.175781 -0.85351,0 -21.31641,3.164062 -59.79297,40.175786 -11.64258,13.97265 -5.18554,-20.03515 27.61523,-15.01368 -2.16211,-3.97851 -9.99218,5.43359 -0.5254,-21.23242 17.45704,1.148438 53.53515,-46.175782 -2.11328,-2.449218 z"
|
||||
id="path3236"
|
||||
inkscape:connector-curvature="0" />
|
||||
<g
|
||||
id="g4681"
|
||||
style="display:inline;fill:none">
|
||||
<path
|
||||
sodipodi:nodetypes="ccccc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path4188"
|
||||
d="m 202.8386,479.42789 84.70126,7.10605 -4.12095,264.13156 -79.84287,6.17163 z"
|
||||
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:6.46818447;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
transform="translate(0,-468)" />
|
||||
<path
|
||||
sodipodi:nodetypes="ccccc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path4700"
|
||||
d="m 108.61565,743.50806 0.51116,-250.6133 92.66051,-13.41778 0.96231,277.50414 z"
|
||||
style="fill:none;fill-opacity:0.19607843;stroke:#000000;stroke-width:6.46799994;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
transform="translate(0,-468)" />
|
||||
<path
|
||||
sodipodi:nodetypes="ccccc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path4702"
|
||||
d="m 12.310294,15.17486 94.979596,9.88249 -0.90408,250.33701 -91.322163,10.53727 z"
|
||||
style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:6.46799994;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
</g>
|
||||
<ellipse
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6289"
|
||||
transform="matrix(0.67434588,0,0,0.62041473,-11268.735,-5.43424)"
|
||||
cx="16760.033"
|
||||
cy="129.27118"
|
||||
rx="9.8305082"
|
||||
ry="13.271187" />
|
||||
<ellipse
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6291"
|
||||
transform="matrix(0.58443311,0,0,0.39706542,-9776.2887,29.64718)"
|
||||
cx="16805.254"
|
||||
cy="191.20338"
|
||||
rx="14.745763"
|
||||
ry="12.288136" />
|
||||
<ellipse
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6293"
|
||||
transform="matrix(0.67434588,0,0,0.62041473,-11263.432,-12.14312)"
|
||||
cx="16762.492"
|
||||
cy="220.69492"
|
||||
rx="12.288136"
|
||||
ry="10.322034" />
|
||||
<ellipse
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6295"
|
||||
transform="matrix(0.67434588,0,0,0.62041473,-11299.228,-128.63387)"
|
||||
cx="16818.033"
|
||||
cy="308.67798"
|
||||
rx="8.8474579"
|
||||
ry="6.8813558" />
|
||||
<ellipse
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6297"
|
||||
transform="matrix(0.67434588,0,0,0.62041473,-11319.779,-93.86962)"
|
||||
cx="16831.305"
|
||||
cy="331.28815"
|
||||
rx="6.3898306"
|
||||
ry="9.8305082" />
|
||||
<ellipse
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6329"
|
||||
transform="matrix(0.67434588,0,0,0.62041473,-11291.274,-20.6817)"
|
||||
cx="16825.898"
|
||||
cy="146.96609"
|
||||
rx="11.79661"
|
||||
ry="7.3728814" />
|
||||
<ellipse
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6279"
|
||||
transform="matrix(0.67434588,0,0,0.62041473,-11282.656,-91.43002)"
|
||||
cx="16954.186"
|
||||
cy="287.54236"
|
||||
rx="8.3559322"
|
||||
ry="9.3389826" />
|
||||
<ellipse
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6283"
|
||||
transform="matrix(0.67434588,0,0,0.62041473,-11257.465,-30.44009)"
|
||||
cx="16918.305"
|
||||
cy="211.35593"
|
||||
rx="8.8474579"
|
||||
ry="7.8644066" />
|
||||
<ellipse
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6287"
|
||||
transform="matrix(0.33717295,0,0,0.74449769,-5576.2721,-29.09832)"
|
||||
cx="16891.764"
|
||||
cy="131.72882"
|
||||
rx="12.779661"
|
||||
ry="9.8305082" />
|
||||
<ellipse
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6317"
|
||||
transform="matrix(0.67434588,0,0,0.62041473,-11196.478,-128.63387)"
|
||||
cx="16798.865"
|
||||
cy="333.74576"
|
||||
rx="6.3898306"
|
||||
ry="7.3728814" />
|
||||
<ellipse
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6323"
|
||||
transform="matrix(0.77068099,0,0,0.50408697,-12786.624,-104.50473)"
|
||||
cx="16764.457"
|
||||
cy="341.11865"
|
||||
rx="10.322034"
|
||||
ry="7.8644066" />
|
||||
<ellipse
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6325"
|
||||
transform="matrix(0.67434588,0,0,0.62041473,-11250.836,-87.16073)"
|
||||
cx="16888.814"
|
||||
cy="284.10168"
|
||||
rx="6.8813558"
|
||||
ry="7.8644066" />
|
||||
<ellipse
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6269"
|
||||
transform="matrix(0.67434588,0,0,0.62041473,-11296.577,-109.727)"
|
||||
cx="17029.881"
|
||||
cy="360.77966"
|
||||
rx="5.4067798"
|
||||
ry="3.9322033" />
|
||||
<ellipse
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6281"
|
||||
transform="matrix(0.67434588,0,0,0.62041473,-11230.286,-62.15485)"
|
||||
cx="16923.711"
|
||||
cy="260.01694"
|
||||
rx="7.3728814"
|
||||
ry="9.3389826" />
|
||||
<circle
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6299"
|
||||
transform="matrix(0.67434588,0,0,0.62041473,-11144.768,-131.07347)"
|
||||
cx="16810.66"
|
||||
cy="382.89832"
|
||||
r="6.3898306" />
|
||||
<ellipse
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6257"
|
||||
transform="matrix(0.67434588,0,0,0.62041473,-11262.769,-12.75303)"
|
||||
cx="17060.848"
|
||||
cy="110.10169"
|
||||
rx="6.8813558"
|
||||
ry="8.8474579" />
|
||||
<ellipse
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6259"
|
||||
transform="matrix(0.67434588,0,0,0.62041473,-11253.488,-21.90151)"
|
||||
cx="17020.051"
|
||||
cy="110.10169"
|
||||
rx="10.322034"
|
||||
ry="9.8305082" />
|
||||
<ellipse
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6277"
|
||||
transform="matrix(0.67434588,0,0,0.62041473,-11166.645,-173.76641)"
|
||||
cx="16913.881"
|
||||
cy="338.66101"
|
||||
rx="9.3389826"
|
||||
ry="7.3728814" />
|
||||
<ellipse
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6251"
|
||||
transform="matrix(0.67434588,0,0,0.62041473,-11257.465,0.05486)"
|
||||
cx="17087.881"
|
||||
cy="140.57626"
|
||||
rx="9.3389826"
|
||||
ry="9.8305082" />
|
||||
<ellipse
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6253"
|
||||
transform="matrix(0.67434588,0,0,0.62041473,-11244.206,-1.77482)"
|
||||
cx="17057.898"
|
||||
cy="167.61017"
|
||||
rx="6.8813558"
|
||||
ry="8.3559322" />
|
||||
<ellipse
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6255"
|
||||
transform="matrix(0.67434588,0,0,0.62041473,-11241.555,-12.75303)"
|
||||
cx="17034.305"
|
||||
cy="147.45763"
|
||||
rx="11.79661"
|
||||
ry="10.81356" />
|
||||
<ellipse
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6261"
|
||||
transform="matrix(0.67434588,0,0,0.62041473,-11246.196,36.64882)"
|
||||
cx="17021.033"
|
||||
cy="256.57626"
|
||||
rx="5.4067798"
|
||||
ry="4.9152541" />
|
||||
<ellipse
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6263"
|
||||
transform="matrix(0.67434588,0,0,0.62041473,-11246.196,2.49447)"
|
||||
cx="17026.932"
|
||||
cy="282.62711"
|
||||
rx="10.322034"
|
||||
ry="9.3389826" />
|
||||
<ellipse
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6265"
|
||||
transform="matrix(0.67434588,0,0,0.62041473,-11271.388,-7.87383)"
|
||||
cx="17041.186"
|
||||
cy="307.2034"
|
||||
rx="9.8305082"
|
||||
ry="10.322034" />
|
||||
<ellipse
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6267"
|
||||
transform="matrix(0.67434588,0,0,0.62041473,-11253.488,-1.77482)"
|
||||
cx="17076.576"
|
||||
cy="335.71185"
|
||||
rx="11.79661"
|
||||
ry="8.3559322" />
|
||||
<ellipse
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6271"
|
||||
transform="matrix(0.67434588,0,0,0.62041473,-11243.543,-5.43424)"
|
||||
cx="17042.66"
|
||||
cy="354.88135"
|
||||
rx="8.3559322"
|
||||
ry="6.8813558" />
|
||||
<ellipse
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6327"
|
||||
transform="matrix(0.67434588,0,0,0.62041473,-11262.104,9.20335)"
|
||||
cx="17077.068"
|
||||
cy="290"
|
||||
rx="11.305085"
|
||||
ry="14.745763" />
|
||||
<circle
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6273"
|
||||
transform="matrix(0.67434588,0,0,0.62041473,-11260.778,-20.0718)"
|
||||
cx="16896.186"
|
||||
cy="414.35593"
|
||||
r="9.3389826" />
|
||||
<ellipse
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6275"
|
||||
transform="matrix(0.67434588,0,0,0.62041473,-11284.646,39.69831)"
|
||||
cx="16954.186"
|
||||
cy="339.15256"
|
||||
rx="5.4067798"
|
||||
ry="9.8305082" />
|
||||
<ellipse
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6331"
|
||||
transform="matrix(0.67434588,0,0,0.62041473,-11285.97,-4.82431)"
|
||||
cx="16937.967"
|
||||
cy="414.35593"
|
||||
rx="7.8644066"
|
||||
ry="6.3898306" />
|
||||
<ellipse
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6311"
|
||||
transform="matrix(0.67434588,0,0,0.62041473,-11321.105,-27.39059)"
|
||||
cx="16826.881"
|
||||
cy="393.71185"
|
||||
rx="8.8474579"
|
||||
ry="8.3559322" />
|
||||
<ellipse
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6313"
|
||||
transform="matrix(0.32933172,0,0,0.41360982,-5480.0571,59.62168)"
|
||||
cx="16772.322"
|
||||
cy="385.35593"
|
||||
rx="21.135593"
|
||||
ry="11.79661" />
|
||||
<ellipse
|
||||
style="display:inline;fill:#aa0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path6315"
|
||||
transform="matrix(0.67434588,0,0,0.62041473,-11285.307,-17.02232)"
|
||||
cx="16786.576"
|
||||
cy="348.98306"
|
||||
rx="9.8305082"
|
||||
ry="7.8644066" />
|
||||
</g>
|
||||
</svg>
|
変更後 幅: | 高さ: | サイズ: 16 KiB |
|
@ -0,0 +1,24 @@
|
|||
###############################################################################
|
||||
# NONE
|
||||
# This configuration profile is the most basic, plain profile,
|
||||
# (the default one that ships with Screen).
|
||||
# To clarify that this *disables* byobu, let's call this profile
|
||||
# "NONE".
|
||||
#
|
||||
# Copyright (C) 2008 Canonical Ltd.
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
###############################################################################
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
# byobu's bashrc -- colorize the prompt
|
||||
# Copyright (C) 2014 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Ensure that we're in a tmux or screen session
|
||||
case "$TERM" in
|
||||
xterm)
|
||||
# Try to ensure we have 256 colors
|
||||
export TERM="xterm-256color"
|
||||
;;
|
||||
esac
|
||||
if [ -n "$TMUX" ] || [ "${TERMCAP#*screen}" != "${TERMCAP}" ]; then
|
||||
# Ensure that we're in bash, in a byobu environment
|
||||
if [ -n "$BYOBU_BACKEND" ] && [ -n "$BASH" ]; then
|
||||
byobu_prompt_status() { local e=$?; [ $e != 0 ] && echo -e "$e "; }
|
||||
[ -n "$BYOBU_CHARMAP" ] || BYOBU_CHARMAP=$(locale charmap 2>/dev/null || echo)
|
||||
byobu_prompt_symbol() {
|
||||
if [ "$USER" = "root" ]; then
|
||||
printf "%s" "#";
|
||||
else
|
||||
printf "%s" "\$"
|
||||
fi
|
||||
}
|
||||
case "$BYOBU_DISTRO" in
|
||||
"Ubuntu")
|
||||
# Use Ubuntu colors (grey / orange / aubergine)
|
||||
PS1="${debian_chroot:+($debian_chroot)}\[\e[38;5;202m\]\$(byobu_prompt_status)\[\e[38;5;245m\]\u\[\e[00m\]@\[\e[38;5;172m\]\h\[\e[00m\]:\[\e[38;5;5m\]\w\[\e[00m\]\$(byobu_prompt_symbol) "
|
||||
export GREP_COLORS="ms=01;38;5;202:mc=01;31:sl=:cx=:fn=01;38;5;132:ln=32:bn=32:se=00;38;5;242"
|
||||
export LESS_TERMCAP_mb=$(printf '\e[01;31m') # enter blinking mode – red
|
||||
export LESS_TERMCAP_md=$(printf '\e[01;38;5;180m') # enter double-bright mode – bold light orange
|
||||
export LESS_TERMCAP_me=$(printf '\e[0m') # turn off all appearance modes (mb, md, so, us)
|
||||
export LESS_TERMCAP_se=$(printf '\e[0m') # leave standout mode
|
||||
export LESS_TERMCAP_so=$(printf '\e[03;38;5;202m') # enter standout mode – orange background highlight (or italics)
|
||||
export LESS_TERMCAP_ue=$(printf '\e[0m') # leave underline mode
|
||||
export LESS_TERMCAP_us=$(printf '\e[04;38;5;139m') # enter underline mode – underline aubergine
|
||||
# Use Ubuntu themed dircolors
|
||||
if [ -e "${BYOBU_PREFIX}/share/byobu/profiles/dircolors" ]; then
|
||||
dircolors "${BYOBU_PREFIX}/share/byobu/profiles/dircolors" > "$BYOBU_RUN_DIR/dircolors"
|
||||
. "$BYOBU_RUN_DIR/dircolors"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
# Use Googley colors (blue / red / yellow / blue / green / red )
|
||||
PS1="${debian_chroot:+($debian_chroot)}\[\e[31m\]\$(byobu_prompt_status)\[\e[38;5;69m\]\u\[\e[38;5;214m\]@\[\e[38;5;167m\]\h\[\e[38;5;214m\]:\[\e[38;5;71m\]\w\[\e[38;5;214m\]\$(byobu_prompt_symbol)\[\e[00m\] "
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
|
@ -0,0 +1,27 @@
|
|||
###############################################################################
|
||||
# Load:
|
||||
# * the stock byobu profile
|
||||
# * any windows
|
||||
# * and the local byoburc (instead of .screenrc)
|
||||
# Used at startup but not profile refresh
|
||||
#
|
||||
# Copyright (C) 2009-2011 Canonical Ltd.
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
###############################################################################
|
||||
|
||||
source $BYOBU_CONFIG_DIR/profile
|
||||
source $BYOBU_WINDOWS
|
||||
source $BYOBU_CONFIG_DIR/.screenrc
|
変更されたファイルが多すぎるため、一部のファイルは表示されません さらに表示
読み込み中…
新しいイシューから参照