mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-22 22:34:23 -07:00
usr/bin/byobu: add support for different window sets, LP: #517796
This commit is contained in:
parent
9da3a6cca6
commit
a71fa39e26
4 changed files with 31 additions and 19 deletions
3
debian/changelog
vendored
3
debian/changelog
vendored
|
@ -2,8 +2,7 @@ byobu (2.74) unreleased; urgency=low
|
||||||
|
|
||||||
* usr/lib/byobu/disk_io: fix regex to support RAID devices, LP: #572855
|
* usr/lib/byobu/disk_io: fix regex to support RAID devices, LP: #572855
|
||||||
* debian/postinst: make debconf question failsafe, LP: #569041
|
* debian/postinst: make debconf question failsafe, LP: #569041
|
||||||
* bin/byobu, bin/byobu-janitor, share/byobu/profiles/byoburc: add support
|
* usr/bin/byobu: add support for different window sets, LP: #517796
|
||||||
for different window sets, LP: #517796
|
|
||||||
|
|
||||||
-- Dustin Kirkland <kirkland@ubuntu.com> Wed, 28 Apr 2010 23:11:14 -0500
|
-- Dustin Kirkland <kirkland@ubuntu.com> Wed, 28 Apr 2010 23:11:14 -0500
|
||||||
|
|
||||||
|
|
|
@ -20,15 +20,27 @@
|
||||||
PKG="byobu"
|
PKG="byobu"
|
||||||
VERSION=2.74
|
VERSION=2.74
|
||||||
|
|
||||||
# Add a version argument for debugging purposes
|
while [ ! -z "$1" ]; do
|
||||||
if [ "$#" = "1" ] && [ "$1" = "-v" ]; then
|
case "$1" in
|
||||||
|
-v|--version)
|
||||||
echo "$PKG version $VERSION"
|
echo "$PKG version $VERSION"
|
||||||
screen -v
|
screen -v
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
;;
|
||||||
|
--windows)
|
||||||
|
if [ -r "$2" ]; then
|
||||||
|
WINDOWS=$(cat "$2")
|
||||||
|
fi
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
ARGS="$ARGS $1"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
# Check if we're being autolaunched, and this user explicitly does not want it.
|
# Check if we're being autolaunched, and this user explicitly does not want it.
|
||||||
if [ "$0" = "/etc/profile.d/$PKG.sh" ] && [ -r "$HOME/.$PKG/disable-autolaunch" ]; then
|
if [ "$0" = "/etc/profile.d/Z98-$PKG.sh" ] && [ -r "$HOME/.$PKG/disable-autolaunch" ]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -38,8 +50,15 @@ byobu-janitor --force
|
||||||
# Set window title until https://bugs.launchpad.net/bugs/338722 is fixed in screen
|
# Set window title until https://bugs.launchpad.net/bugs/338722 is fixed in screen
|
||||||
printf "\033]0;${USER}@$(hostname) - ${PKG}\007"
|
printf "\033]0;${USER}@$(hostname) - ${PKG}\007"
|
||||||
|
|
||||||
# Launch motd+shell, unless the user has default windows set to launch
|
# Configure default windows
|
||||||
grep -qs "^[^#]" "$HOME/.$PKG/windows" && DEFAULT_WINDOW= || DEFAULT_WINDOW="motd+shell"
|
DEFAULT_WINDOW=
|
||||||
|
if [ -n "$WINDOWS" ];
|
||||||
|
mv -f "$HOME/.byobu/windows" "$HOME/.byobu/.windows-swap"
|
||||||
|
cleanup='mv -f "$HOME/.byobu/.windows-swap" "$HOME/.byobu/windows"'
|
||||||
|
printf "%s\n%s\n" "$WINDOWS\n" "$cleanup" > "$HOME/.byobu/windows"
|
||||||
|
elif ! grep -qs "^[^#]" "$HOME/.$PKG/windows"; then
|
||||||
|
DEFAULT_WINDOW="-t shell motd+shell"
|
||||||
|
fi
|
||||||
|
|
||||||
# Check if our terminfo supports 256 colors
|
# Check if our terminfo supports 256 colors
|
||||||
[ -x /usr/bin/tput ] && [ $(/usr/bin/tput colors 2>/dev/null || echo 0) -eq 256 ] && SCREEN_TERM="-T screen-256color"
|
[ -x /usr/bin/tput ] && [ $(/usr/bin/tput colors 2>/dev/null || echo 0) -eq 256 ] && SCREEN_TERM="-T screen-256color"
|
||||||
|
@ -58,13 +77,9 @@ if [ "$#" = "0" ]; then
|
||||||
else
|
else
|
||||||
NO_SOCKETS="^No Sockets found in "
|
NO_SOCKETS="^No Sockets found in "
|
||||||
fi
|
fi
|
||||||
if [ -s "$BYOBU_WINDOWS" ]; then
|
if echo "$out" | LANG=C grep -qsi "$NO_SOCKETS"; then
|
||||||
# Launch with custom window set
|
|
||||||
cat "$BYOBU_WINDOWS" > "$HOME/.$PKG/.windows-tmp"
|
|
||||||
exec screen $SCREEN_TERM -c "/usr/share/$PKG/profiles/byoburc"
|
|
||||||
elif echo "$out" | LANG=C grep -qsi "$NO_SOCKETS"; then
|
|
||||||
# Start new session
|
# Start new session
|
||||||
exec screen $SCREEN_TERM -c "/usr/share/$PKG/profiles/byoburc" -t shell $DEFAULT_WINDOW
|
exec screen $SCREEN_TERM -c "/usr/share/$PKG/profiles/byoburc" $DEFAULT_WINDOW
|
||||||
else
|
else
|
||||||
# Select and attach to an existing session
|
# Select and attach to an existing session
|
||||||
exec byobu-select-session
|
exec byobu-select-session
|
||||||
|
|
|
@ -23,7 +23,6 @@ PKG="byobu"
|
||||||
[ -r "/etc/$PKG/socketdir" ] && . "/etc/$PKG/socketdir" || SOCKETDIR="/var/run/screen"
|
[ -r "/etc/$PKG/socketdir" ] && . "/etc/$PKG/socketdir" || SOCKETDIR="/var/run/screen"
|
||||||
RUN="$SOCKETDIR/S-$USER"
|
RUN="$SOCKETDIR/S-$USER"
|
||||||
FLAG="$RUN/$PKG.reload-required"
|
FLAG="$RUN/$PKG.reload-required"
|
||||||
echo > "$HOME/.$PKG/.windows-tmp"
|
|
||||||
|
|
||||||
# Exit immediately, if we're not forced, and there is no reload flag
|
# Exit immediately, if we're not forced, and there is no reload flag
|
||||||
if [ "$1" != "--force" ] && [ ! -e "$FLAG" ]; then
|
if [ "$1" != "--force" ] && [ ! -e "$FLAG" ]; then
|
||||||
|
|
|
@ -21,5 +21,4 @@
|
||||||
|
|
||||||
source $HOME/.byobu/profile
|
source $HOME/.byobu/profile
|
||||||
source $HOME/.byobu/windows
|
source $HOME/.byobu/windows
|
||||||
source $HOME/.byobu/.windows-tmp
|
|
||||||
source $HOME/.screenrc
|
source $HOME/.screenrc
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue