mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-22 22:34:23 -07:00
* usr/bin/byobu, usr/bin/byobu-config, usr/bin/byobu-ctrl-a,
usr/bin/byobu-disable, usr/bin/byobu-launcher, usr/bin/byobu-quiet, usr/bin/byobu-reconnect-sockets, usr/bin/byobu-select-profile, usr/bin/byobu-select-session, usr/lib/byobu/.constants: - use a BYOBU_BACKEND environment variable, to support both screen and tmux
This commit is contained in:
parent
441d694f1f
commit
ce1be801c8
11 changed files with 85 additions and 80 deletions
6
debian/changelog
vendored
6
debian/changelog
vendored
|
@ -2,6 +2,12 @@ byobu (4.18) unreleased; urgency=low
|
||||||
|
|
||||||
* usr/bin/byobu, usr/bin/byobu-status:
|
* usr/bin/byobu, usr/bin/byobu-status:
|
||||||
- remove some redundancies
|
- remove some redundancies
|
||||||
|
* usr/bin/byobu, usr/bin/byobu-config, usr/bin/byobu-ctrl-a,
|
||||||
|
usr/bin/byobu-disable, usr/bin/byobu-launcher, usr/bin/byobu-quiet,
|
||||||
|
usr/bin/byobu-reconnect-sockets, usr/bin/byobu-select-profile,
|
||||||
|
usr/bin/byobu-select-session, usr/lib/byobu/.constants:
|
||||||
|
- use a BYOBU_BACKEND environment variable, to support both screen
|
||||||
|
and tmux
|
||||||
|
|
||||||
-- Dustin Kirkland <kirkland@ubuntu.com> Wed, 29 Jun 2011 02:26:28 +0000
|
-- Dustin Kirkland <kirkland@ubuntu.com> Wed, 29 Jun 2011 02:26:28 +0000
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
#
|
#
|
||||||
# byobu - screen wrapper script
|
# byobu - wrapper script
|
||||||
# Copyright (C) 2008-2009 Canonical Ltd.
|
# Copyright (C) 2008-2009 Canonical Ltd.
|
||||||
#
|
#
|
||||||
# Authors: Dustin Kirkland <kirkland@ubuntu.com>
|
# Authors: Dustin Kirkland <kirkland@ubuntu.com>
|
||||||
|
@ -28,7 +28,7 @@ if [ "$#" = "1" ]; then
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-v|--version)
|
-v|--version)
|
||||||
echo "$PKG version $VERSION"
|
echo "$PKG version $VERSION"
|
||||||
exec screen -v
|
exec $BYOBU_BACKEND -v
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -74,7 +74,7 @@ if [ -S "$SSH_AUTH_SOCK" ] && [ ! -h "$SSH_AUTH_SOCK" ]; then
|
||||||
ln -sf "$SSH_AUTH_SOCK" "$BYOBU_CONFIG_DIR/.ssh-agent"
|
ln -sf "$SSH_AUTH_SOCK" "$BYOBU_CONFIG_DIR/.ssh-agent"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Some users want to maintain a separate ~/.byoburc from ~/.screenrc,
|
# Some users want to maintain separate configurations
|
||||||
# if they use both screen and byobu on the same system
|
# if they use both screen and byobu on the same system
|
||||||
if [ -r "$HOME/.byoburc" ]; then
|
if [ -r "$HOME/.byoburc" ]; then
|
||||||
PROFILE="-c $BYOBU_PREFIX/share/$PKG/profiles/byoburc"
|
PROFILE="-c $BYOBU_PREFIX/share/$PKG/profiles/byoburc"
|
||||||
|
@ -82,16 +82,16 @@ else
|
||||||
PROFILE="-c $BYOBU_PREFIX/share/$PKG/profiles/screenrc"
|
PROFILE="-c $BYOBU_PREFIX/share/$PKG/profiles/screenrc"
|
||||||
fi
|
fi
|
||||||
NAME="-S $PKG"
|
NAME="-S $PKG"
|
||||||
# Zero out $NAME if user has specified a screen session name
|
# Zero out $NAME if user has specified a session name
|
||||||
for i in "$@"; do
|
for i in "$@"; do
|
||||||
case $i in -r|-*S|-ls|-list) NAME= ;; esac
|
case $i in -r|-*S|-ls|-list) NAME= ;; esac
|
||||||
done
|
done
|
||||||
# Now let's execute screen!
|
# Now let's execute the backend!
|
||||||
if [ "$#" = "0" ]; then
|
if [ "$#" = "0" ]; then
|
||||||
out=$(screen -wipe 2>/dev/null) || true
|
out=$($BYOBU_BACKEND -wipe 2>/dev/null) || true
|
||||||
if [ "$CUSTOM_WINDOW_SET" = "1" ]; then
|
if [ "$CUSTOM_WINDOW_SET" = "1" ]; then
|
||||||
# Start new custom window set session
|
# Start new custom window set session
|
||||||
exec screen $SCREEN_TERM $NAME $PROFILE
|
exec $BYOBU_BACKEND $SCREEN_TERM $NAME $PROFILE
|
||||||
else
|
else
|
||||||
case "$out" in
|
case "$out" in
|
||||||
*\(*\)*)
|
*\(*\)*)
|
||||||
|
@ -100,13 +100,13 @@ if [ "$#" = "0" ]; then
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
# Start new default session
|
# Start new default session
|
||||||
exec screen $SCREEN_TERM $NAME $PROFILE $DEFAULT_WINDOW
|
exec $BYOBU_BACKEND $SCREEN_TERM $NAME $PROFILE $DEFAULT_WINDOW
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# Launch with command line args
|
# Launch with command line args
|
||||||
exec screen $SCREEN_TERM $NAME $PROFILE "$@"
|
exec $BYOBU_BACKEND $SCREEN_TERM $NAME $PROFILE "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# vi: syntax=sh ts=4 noexpandtab
|
# vi: syntax=sh ts=4 noexpandtab
|
||||||
|
|
|
@ -30,6 +30,8 @@ PKG="byobu"
|
||||||
HOME=os.getenv("HOME")
|
HOME=os.getenv("HOME")
|
||||||
USER=os.getenv("USER")
|
USER=os.getenv("USER")
|
||||||
BYOBU_CONFIG_DIR=os.getenv("BYOBU_CONFIG_DIR")
|
BYOBU_CONFIG_DIR=os.getenv("BYOBU_CONFIG_DIR")
|
||||||
|
BYOBU_BACKEND=os.getenv("BYOBU_BACKEND")
|
||||||
|
SOCKETDIR=os.getenv("SOCKETDIR")
|
||||||
if os.getenv("BYOBU_PREFIX"):
|
if os.getenv("BYOBU_PREFIX"):
|
||||||
PREFIX = os.getenv("BYOBU_PREFIX")
|
PREFIX = os.getenv("BYOBU_PREFIX")
|
||||||
else:
|
else:
|
||||||
|
@ -41,15 +43,9 @@ if not os.path.exists(SHARE):
|
||||||
if not os.path.exists(DOC):
|
if not os.path.exists(DOC):
|
||||||
DOC = BYOBU_CONFIG_DIR+"/"+DOC
|
DOC = BYOBU_CONFIG_DIR+"/"+DOC
|
||||||
DEF_ESC="A"
|
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 screen session and start a new one."
|
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."
|
||||||
SOCKETDIR="/var/run/screen"
|
|
||||||
if os.path.exists("/etc/%s/socketdir" % PKG):
|
|
||||||
try:
|
|
||||||
execfile(i)
|
|
||||||
except:
|
|
||||||
SOCKETDIR="/var/run/screen"
|
|
||||||
RELOAD_FLAG="%s/reload-required" % (BYOBU_CONFIG_DIR)
|
RELOAD_FLAG="%s/reload-required" % (BYOBU_CONFIG_DIR)
|
||||||
RELOAD_CMD="screen -X at 0 source "+BYOBU_CONFIG_DIR+"/profile"
|
RELOAD_CMD="%s -X at 0 source %s/profile" % (BYOBU_BACKEND, BYOBU_CONFIG_DIR)
|
||||||
ESC = ''
|
ESC = ''
|
||||||
snack.hotkeys[ESC] = ord(ESC)
|
snack.hotkeys[ESC] = ord(ESC)
|
||||||
snack.hotkeys[ord(ESC)] = ESC
|
snack.hotkeys[ord(ESC)] = ESC
|
||||||
|
@ -96,7 +92,7 @@ def terminal_size(): ### decide on *some* terminal size
|
||||||
cr = (25, 80)
|
cr = (25, 80)
|
||||||
return int(cr[1]-5), int(cr[0]-5) # reverse rows, cols
|
return int(cr[1]-5), int(cr[0]-5) # reverse rows, cols
|
||||||
|
|
||||||
def menu(screen, size, isInstalled):
|
def menu(snackScreen, size, isInstalled):
|
||||||
if isInstalled:
|
if isInstalled:
|
||||||
installtext=_("Byobu currently launches at login (toggle off)")
|
installtext=_("Byobu currently launches at login (toggle off)")
|
||||||
else:
|
else:
|
||||||
|
@ -113,9 +109,9 @@ def menu(screen, size, isInstalled):
|
||||||
li.append(_("Create new windows"), 7)
|
li.append(_("Create new windows"), 7)
|
||||||
li.append(_("Manage default windows"), 8)
|
li.append(_("Manage default windows"), 8)
|
||||||
li.append(installtext, 9)
|
li.append(installtext, 9)
|
||||||
bb = ButtonBar(screen, (("Exit", "exit", ESC),), compact=1)
|
bb = ButtonBar(snackScreen, (("Exit", "exit", ESC),), compact=1)
|
||||||
|
|
||||||
g = GridForm(screen, _(" Byobu Configuration Menu"), 1, 2)
|
g = GridForm(snackScreen, _(" Byobu Configuration Menu"), 1, 2)
|
||||||
g.add(li, 0, 0, padding=(4,2,4,2))
|
g.add(li, 0, 0, padding=(4,2,4,2))
|
||||||
g.add(bb, 0, 1, padding=(1,1,0,0))
|
g.add(bb, 0, 1, padding=(1,1,0,0))
|
||||||
|
|
||||||
|
@ -124,18 +120,18 @@ def menu(screen, size, isInstalled):
|
||||||
else:
|
else:
|
||||||
return li.current()
|
return li.current()
|
||||||
|
|
||||||
def messagebox(screen, width, height, title, text, scroll=0, \
|
def messagebox(snackScreen, width, height, title, text, scroll=0, \
|
||||||
buttons=((_("Okay"), "okay"),(_("Cancel"), "cancel", ESC)) ):
|
buttons=((_("Okay"), "okay"),(_("Cancel"), "cancel", ESC)) ):
|
||||||
|
|
||||||
t = Textbox(width, height, text, scroll=scroll )
|
t = Textbox(width, height, text, scroll=scroll )
|
||||||
bb = ButtonBar(screen, buttons, compact = 1)
|
bb = ButtonBar(snackScreen, buttons, compact = 1)
|
||||||
g = GridForm(screen, title, 1, 2)
|
g = GridForm(snackScreen, title, 1, 2)
|
||||||
g.add(t, 0, 0, padding=(0,0,0,0))
|
g.add(t, 0, 0, padding=(0,0,0,0))
|
||||||
g.add(bb, 0, 1, padding=(1,1,0,0))
|
g.add(bb, 0, 1, padding=(1,1,0,0))
|
||||||
|
|
||||||
return bb.buttonPressed(g.runOnce())
|
return bb.buttonPressed(g.runOnce())
|
||||||
|
|
||||||
def help(screen, size, config):
|
def help(snackScreen, size, config):
|
||||||
f=file(DOC+'/help.txt')
|
f=file(DOC+'/help.txt')
|
||||||
text=f.read()
|
text=f.read()
|
||||||
f.close()
|
f.close()
|
||||||
|
@ -144,8 +140,8 @@ def help(screen, size, config):
|
||||||
text=text.replace("_VER_", commands.getoutput("byobu -v | head -n1 | " + SED + " 's/.* //'"), 1)
|
text=text.replace("_VER_", commands.getoutput("byobu -v | head -n1 | " + SED + " 's/.* //'"), 1)
|
||||||
|
|
||||||
t = Textbox(70, 14, text, scroll=0)
|
t = Textbox(70, 14, text, scroll=0)
|
||||||
bb = ButtonBar(screen, ((_("Menu"), "menu", ESC),), compact = 1)
|
bb = ButtonBar(snackScreen, ((_("Menu"), "menu", ESC),), compact = 1)
|
||||||
g = GridForm(screen, _("Byobu Help"), 1, 3)
|
g = GridForm(snackScreen, _("Byobu Help"), 1, 3)
|
||||||
g.add(t, 0, 0, padding=(0,0,0,0))
|
g.add(t, 0, 0, padding=(0,0,0,0))
|
||||||
g.add(bb, 0, 2, padding=(1,1,0,0))
|
g.add(bb, 0, 2, padding=(1,1,0,0))
|
||||||
|
|
||||||
|
@ -153,18 +149,18 @@ def help(screen, size, config):
|
||||||
|
|
||||||
return 100
|
return 100
|
||||||
|
|
||||||
def select_color(screen, size, layer):
|
def select_color(snackScreen, size, layer):
|
||||||
li = Listbox(height = 8, width = 60, scroll = 1, returnExit = 1)
|
li = Listbox(height = 8, width = 60, scroll = 1, returnExit = 1)
|
||||||
|
|
||||||
for choice in commands.getoutput('byobu-select-profile -l').splitlines():
|
for choice in commands.getoutput('byobu-select-profile -l').splitlines():
|
||||||
li.append(choice, choice)
|
li.append(choice, choice)
|
||||||
|
|
||||||
bb = ButtonBar(screen, ((_("Apply"), "apply"), (_("Cancel"), "cancel", ESC)), compact = 1)
|
bb = ButtonBar(snackScreen, ((_("Apply"), "apply"), (_("Cancel"), "cancel", ESC)), compact = 1)
|
||||||
|
|
||||||
if layer == "foreground":
|
if layer == "foreground":
|
||||||
g = GridForm(screen, _("Choose a foreground color:"), 1, 2)
|
g = GridForm(snackScreen, _("Choose a foreground color:"), 1, 2)
|
||||||
else:
|
else:
|
||||||
g = GridForm(screen, _("Choose a background color:"), 1, 2)
|
g = GridForm(snackScreen, _("Choose a background color:"), 1, 2)
|
||||||
|
|
||||||
g.add(li, 0, 0, padding=(4,2,4,2))
|
g.add(li, 0, 0, padding=(4,2,4,2))
|
||||||
g.add(bb, 0, 1, padding=(1,1,0,0))
|
g.add(bb, 0, 1, padding=(1,1,0,0))
|
||||||
|
@ -177,14 +173,14 @@ def select_color(screen, size, layer):
|
||||||
reload_required()
|
reload_required()
|
||||||
return 100
|
return 100
|
||||||
|
|
||||||
def keybindings(screen, size):
|
def keybindings(snackScreen, size):
|
||||||
li = Listbox(height = 6, width = 60, returnExit = 1)
|
li = Listbox(height = 6, width = 60, returnExit = 1)
|
||||||
for choice in commands.getoutput('ls '+SHARE+'/keybindings').splitlines():
|
for choice in commands.getoutput('ls '+SHARE+'/keybindings').splitlines():
|
||||||
if choice != "common" and choice != "none":
|
if choice != "common" and choice != "none":
|
||||||
li.append(choice, choice)
|
li.append(choice, choice)
|
||||||
li.append("none", "none")
|
li.append("none", "none")
|
||||||
bb = ButtonBar(screen, ((_("Apply"), "apply"), (_("Cancel"), "cancel", ESC)), compact = 1)
|
bb = ButtonBar(snackScreen, ((_("Apply"), "apply"), (_("Cancel"), "cancel", ESC)), compact = 1)
|
||||||
g = GridForm(screen, _("Which set of keybindings would you like to use?"), 1, 2)
|
g = GridForm(snackScreen, _("Which set of keybindings would you like to use?"), 1, 2)
|
||||||
g.add(li, 0, 0, padding=(4,2,4,2))
|
g.add(li, 0, 0, padding=(4,2,4,2))
|
||||||
g.add(bb, 0, 1, padding=(1,1,0,0))
|
g.add(bb, 0, 1, padding=(1,1,0,0))
|
||||||
if bb.buttonPressed(g.runOnce()) != "cancel":
|
if bb.buttonPressed(g.runOnce()) != "cancel":
|
||||||
|
@ -195,7 +191,7 @@ def keybindings(screen, size):
|
||||||
def switch_keybindings(set):
|
def switch_keybindings(set):
|
||||||
commands.getoutput(SED + " -i -e 's:^source .*$:source "+SHARE+"/keybindings/"+set+":' "+BYOBU_CONFIG_DIR+"/keybindings")
|
commands.getoutput(SED + " -i -e 's:^source .*$:source "+SHARE+"/keybindings/"+set+":' "+BYOBU_CONFIG_DIR+"/keybindings")
|
||||||
|
|
||||||
def newwindow(screen, size):
|
def newwindow(snackScreen, size):
|
||||||
title=Entry(8, text="shell", returnExit=1)
|
title=Entry(8, text="shell", returnExit=1)
|
||||||
titlel=Label(_("Title: "))
|
titlel=Label(_("Title: "))
|
||||||
command=Entry(20, text="/bin/sh", returnExit=1)
|
command=Entry(20, text="/bin/sh", returnExit=1)
|
||||||
|
@ -219,9 +215,9 @@ def newwindow(screen, size):
|
||||||
|
|
||||||
cb=Checkbox(_("Add to default windows"))
|
cb=Checkbox(_("Add to default windows"))
|
||||||
|
|
||||||
bb = ButtonBar(screen, ((_("Apply"), "apply"), (_("Cancel"), "cancel", ESC)), compact = 1)
|
bb = ButtonBar(snackScreen, ((_("Apply"), "apply"), (_("Cancel"), "cancel", ESC)), compact = 1)
|
||||||
|
|
||||||
g = GridForm(screen, _("Create new window(s):"), 2, 6 )
|
g = GridForm(snackScreen, _("Create new window(s):"), 2, 6 )
|
||||||
g.add(titlel, 0, 0, anchorLeft=1,padding=(4,1,0,1))
|
g.add(titlel, 0, 0, anchorLeft=1,padding=(4,1,0,1))
|
||||||
g.add(title, 1, 0, anchorLeft=1)
|
g.add(title, 1, 0, anchorLeft=1)
|
||||||
g.add(commandl, 0, 1, anchorLeft=1, anchorTop=1,padding=(4,0,0,1))
|
g.add(commandl, 0, 1, anchorLeft=1, anchorTop=1,padding=(4,0,0,1))
|
||||||
|
@ -237,18 +233,18 @@ def newwindow(screen, size):
|
||||||
sel=r.getSelection()
|
sel=r.getSelection()
|
||||||
if sel:
|
if sel:
|
||||||
for s in sel:
|
for s in sel:
|
||||||
win='screen -t %s %s' % (cmd[s][1], cmd[s][2])
|
win='%s -t %s %s' % (BYOBU_BACKEND, cmd[s][1], cmd[s][2])
|
||||||
commands.getoutput(win)
|
commands.getoutput(win)
|
||||||
if cb.value():
|
if cb.value():
|
||||||
appendwindow(win)
|
appendwindow(win)
|
||||||
else:
|
else:
|
||||||
cpath='screen -X setenv newpath %s' % (path.value())
|
cpath='%s -X setenv newpath %s' % (BYOBU_BACKEND, path.value())
|
||||||
win='screen -X eval \'chdir $newpath\' \"screen -t %s %s\"' % (title.value(), command.value())
|
win='%s -X eval \'chdir $newpath\' \"%s -t %s %s\"' % (BYOBU_BACKEND, BYOBU_BACKEND, title.value(), command.value())
|
||||||
commands.getoutput(cpath)
|
commands.getoutput(cpath)
|
||||||
commands.getoutput(win)
|
commands.getoutput(win)
|
||||||
if cb.value():
|
if cb.value():
|
||||||
cpath='chdir %s' % (path.value())
|
cpath='chdir %s' % (path.value())
|
||||||
win='screen -t %s %s' % (title.value(), command.value())
|
win='%s -t %s %s' % (BYOBU_BACKEND, title.value(), command.value())
|
||||||
appendwindow(cpath)
|
appendwindow(cpath)
|
||||||
appendwindow(win)
|
appendwindow(win)
|
||||||
|
|
||||||
|
@ -365,7 +361,7 @@ def writestatus(items):
|
||||||
return None
|
return None
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
def togglestatus(screen, size):
|
def togglestatus(snackScreen, size):
|
||||||
itemlist=readstatus()
|
itemlist=readstatus()
|
||||||
rl=Label("")
|
rl=Label("")
|
||||||
r=CheckboxTree(12, scroll=1)
|
r=CheckboxTree(12, scroll=1)
|
||||||
|
@ -374,8 +370,8 @@ def togglestatus(screen, size):
|
||||||
if item[0] != -1:
|
if item[0] != -1:
|
||||||
r.append(item[1],count,selected=item[0])
|
r.append(item[1],count,selected=item[0])
|
||||||
count=count+1
|
count=count+1
|
||||||
bb = ButtonBar(screen, ((_("Apply"), "apply"), (_("Cancel"), "cancel", ESC)), compact = 1)
|
bb = ButtonBar(snackScreen, ((_("Apply"), "apply"), (_("Cancel"), "cancel", ESC)), compact = 1)
|
||||||
g = GridForm(screen, _("Toggle status notifications:"), 2, 4 )
|
g = GridForm(snackScreen, _("Toggle status notifications:"), 2, 4 )
|
||||||
g.add(rl, 0, 0, anchorLeft=1, anchorTop=1, padding=(4,0,0,1))
|
g.add(rl, 0, 0, anchorLeft=1, anchorTop=1, padding=(4,0,0,1))
|
||||||
g.add(r, 1, 0)
|
g.add(r, 1, 0)
|
||||||
g.add(bb, 1, 1, padding=(4,1,0,0))
|
g.add(bb, 1, 1, padding=(4,1,0,0))
|
||||||
|
@ -404,7 +400,7 @@ def writewindows(winlist):
|
||||||
return None
|
return None
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
def defaultwindows(screen, size):
|
def defaultwindows(snackScreen, size):
|
||||||
winlist=readwindows()
|
winlist=readwindows()
|
||||||
|
|
||||||
rl=Label(_("Windows:"))
|
rl=Label(_("Windows:"))
|
||||||
|
@ -415,9 +411,9 @@ def defaultwindows(screen, size):
|
||||||
r.append(win[1],count,selected=win[0])
|
r.append(win[1],count,selected=win[0])
|
||||||
count=count+1
|
count=count+1
|
||||||
|
|
||||||
bb = ButtonBar(screen, ((_("Apply"), "apply"), (_("Cancel"), "cancel", ESC)), compact = 1)
|
bb = ButtonBar(snackScreen, ((_("Apply"), "apply"), (_("Cancel"), "cancel", ESC)), compact = 1)
|
||||||
|
|
||||||
g = GridForm(screen, _("Select window(s) to create by default:"), 2, 4 )
|
g = GridForm(snackScreen, _("Select window(s) to create by default:"), 2, 4 )
|
||||||
g.add(rl, 0, 0, anchorLeft=1, anchorTop=1, padding=(4,0,0,1))
|
g.add(rl, 0, 0, anchorLeft=1, anchorTop=1, padding=(4,0,0,1))
|
||||||
g.add(r, 1, 0)
|
g.add(r, 1, 0)
|
||||||
g.add(bb, 1, 1, padding=(4,1,0,0))
|
g.add(bb, 1, 1, padding=(4,1,0,0))
|
||||||
|
@ -433,18 +429,18 @@ def defaultwindows(screen, size):
|
||||||
|
|
||||||
return 100
|
return 100
|
||||||
|
|
||||||
def install(screen, size, isInstalled):
|
def install(snackScreen, size, isInstalled):
|
||||||
if isInstalled:
|
if isInstalled:
|
||||||
out = commands.getoutput("byobu-launcher-uninstall")
|
out = commands.getoutput("byobu-launcher-uninstall")
|
||||||
if out == "":
|
if out == "":
|
||||||
out = _("Byobu will not be used next time you login.")
|
out = _("Byobu will not be used next time you login.")
|
||||||
button = messagebox(screen, 60, 2, _("Message"), out, buttons=((_("Menu"), )))
|
button = messagebox(snackScreen, 60, 2, _("Message"), out, buttons=((_("Menu"), )))
|
||||||
return 101
|
return 101
|
||||||
else:
|
else:
|
||||||
out = commands.getoutput("byobu-launcher-install")
|
out = commands.getoutput("byobu-launcher-install")
|
||||||
if out == "":
|
if out == "":
|
||||||
out = _("Byobu will be launched automatically next time you login.")
|
out = _("Byobu will be launched automatically next time you login.")
|
||||||
button = messagebox(screen, 60, 2, "Message", out, buttons=((_("Menu"), )))
|
button = messagebox(snackScreen, 60, 2, "Message", out, buttons=((_("Menu"), )))
|
||||||
return 100
|
return 100
|
||||||
|
|
||||||
def appendtofile(p, s):
|
def appendtofile(p, s):
|
||||||
|
@ -486,12 +482,12 @@ def setesckey(key):
|
||||||
out = commands.getoutput(SED+" -i -e 's/\"^^/\"\^"+l+"/g' "+path)
|
out = commands.getoutput(SED+" -i -e 's/\"^^/\"\^"+l+"/g' "+path)
|
||||||
out = commands.getoutput(SED+" -i -e '/^$/d' "+path)
|
out = commands.getoutput(SED+" -i -e '/^$/d' "+path)
|
||||||
|
|
||||||
def chgesc(screen, size):
|
def chgesc(snackScreen, size):
|
||||||
esc=Entry(2, text=getesckey(), returnExit=1)
|
esc=Entry(2, text=getesckey(), returnExit=1)
|
||||||
escl=Label(_("Escape key: ctrl-"))
|
escl=Label(_("Escape key: ctrl-"))
|
||||||
bb = ButtonBar(screen, ((_("Apply"), "apply"), (_("Cancel"), "cancel", ESC)), compact = 1)
|
bb = ButtonBar(snackScreen, ((_("Apply"), "apply"), (_("Cancel"), "cancel", ESC)), compact = 1)
|
||||||
|
|
||||||
g = GridForm(screen, _("Change escape sequence:"), 2, 4 )
|
g = GridForm(snackScreen, _("Change escape sequence:"), 2, 4 )
|
||||||
g.add(escl, 0, 0, anchorLeft=1, padding=(1,0,0,1))
|
g.add(escl, 0, 0, anchorLeft=1, padding=(1,0,0,1))
|
||||||
g.add(esc, 1, 0, anchorLeft=1)
|
g.add(esc, 1, 0, anchorLeft=1)
|
||||||
g.add(bb, 1, 1)
|
g.add(bb, 1, 1)
|
||||||
|
@ -515,7 +511,7 @@ def chgesc(screen, size):
|
||||||
dummy = "foo"
|
dummy = "foo"
|
||||||
else:
|
else:
|
||||||
loop=0
|
loop=0
|
||||||
screen.popWindow()
|
snackScreen.popWindow()
|
||||||
button = bb.buttonPressed(which)
|
button = bb.buttonPressed(which)
|
||||||
if button != "cancel":
|
if button != "cancel":
|
||||||
setesckey(esc.value())
|
setesckey(esc.value())
|
||||||
|
@ -539,9 +535,9 @@ def main():
|
||||||
"""
|
"""
|
||||||
|
|
||||||
size = terminal_size()
|
size = terminal_size()
|
||||||
screen = SnackScreen()
|
snackScreen = SnackScreen()
|
||||||
screen.drawRootText(1,0,_(' Byobu Configuration Menu'))
|
snackScreen.drawRootText(1,0,_(' Byobu Configuration Menu'))
|
||||||
screen.pushHelpLine(_('<Tab>/<Alt-Tab> between elements | <Enter> selects | <Esc> exits'))
|
snackScreen.pushHelpLine(_('<Tab>/<Alt-Tab> between elements | <Enter> selects | <Esc> exits'))
|
||||||
|
|
||||||
config = SafeConfigParser()
|
config = SafeConfigParser()
|
||||||
|
|
||||||
|
@ -550,28 +546,28 @@ def main():
|
||||||
tag = 100
|
tag = 100
|
||||||
|
|
||||||
while tag > 0 :
|
while tag > 0 :
|
||||||
tag = menu(screen, size, isInstalled)
|
tag = menu(snackScreen, size, isInstalled)
|
||||||
if tag == 1:
|
if tag == 1:
|
||||||
tag = help(screen, size, config)
|
tag = help(snackScreen, size, config)
|
||||||
elif tag == 2:
|
elif tag == 2:
|
||||||
tag = select_color(screen, size, "background")
|
tag = select_color(snackScreen, size, "background")
|
||||||
elif tag == 3:
|
elif tag == 3:
|
||||||
tag = select_color(screen, size, "foreground")
|
tag = select_color(snackScreen, size, "foreground")
|
||||||
elif tag == 4:
|
elif tag == 4:
|
||||||
tag = togglestatus(screen, size)
|
tag = togglestatus(snackScreen, size)
|
||||||
elif tag == 5:
|
elif tag == 5:
|
||||||
tag = keybindings(screen, size)
|
tag = keybindings(snackScreen, size)
|
||||||
elif tag == 6:
|
elif tag == 6:
|
||||||
tag = chgesc(screen, size)
|
tag = chgesc(snackScreen, size)
|
||||||
elif tag == 7:
|
elif tag == 7:
|
||||||
tag = newwindow(screen, size)
|
tag = newwindow(snackScreen, size)
|
||||||
elif tag == 8:
|
elif tag == 8:
|
||||||
tag = defaultwindows(screen, size)
|
tag = defaultwindows(snackScreen, size)
|
||||||
elif tag == 9:
|
elif tag == 9:
|
||||||
tag = install(screen, size, isInstalled)
|
tag = install(snackScreen, size, isInstalled)
|
||||||
isInstalled = autolaunch()
|
isInstalled = autolaunch()
|
||||||
|
|
||||||
screen.finish()
|
snackScreen.finish()
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ while true; do
|
||||||
echo
|
echo
|
||||||
echo "When you press ctrl-a in Byobu, do you want it to operate in:"
|
echo "When you press ctrl-a in Byobu, do you want it to operate in:"
|
||||||
echo " (1) Emacs mode (go to beginning of line)"
|
echo " (1) Emacs mode (go to beginning of line)"
|
||||||
echo " (2) Screen mode (screen's default escape sequence)"
|
echo " (2) Screen mode (GNU Screen's default escape sequence)"
|
||||||
echo
|
echo
|
||||||
echo "Note that:"
|
echo "Note that:"
|
||||||
echo " - F12 also operates as Screen escape in Byobu"
|
echo " - F12 also operates as Screen escape in Byobu"
|
||||||
|
@ -52,12 +52,12 @@ while true; do
|
||||||
echo 'escape "^Aa"' >> "$keybindings"
|
echo 'escape "^Aa"' >> "$keybindings"
|
||||||
echo 'register x "^A"' >> "$keybindings"
|
echo 'register x "^A"' >> "$keybindings"
|
||||||
echo 'bindkey "^A"' >> "$keybindings"
|
echo 'bindkey "^A"' >> "$keybindings"
|
||||||
echo "INFO: ctrl-a will now operate in screen mode"
|
echo "INFO: ctrl-a will now operate in GNU Screen mode"
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
screen -X at 0 source "$BYOBU_CONFIG_DIR/profile"
|
$BYOBU_BACKEND -X at 0 source "$BYOBU_CONFIG_DIR/profile"
|
||||||
echo "To modify this behavior again later, run 'byobu-ctrl-a'"
|
echo "To modify this behavior again later, run 'byobu-ctrl-a'"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ echo
|
||||||
# If we're in a byobu session, let's exit that too
|
# If we're in a byobu session, let's exit that too
|
||||||
case "$STY" in
|
case "$STY" in
|
||||||
*byobu)
|
*byobu)
|
||||||
screen -X at 0 quit
|
$BYOBU_BACKEND -X at 0 quit
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ else
|
||||||
case "$TERM" in
|
case "$TERM" in
|
||||||
*screen*)
|
*screen*)
|
||||||
# Handle nesting
|
# Handle nesting
|
||||||
printf "$(gettext 'To launch in a nested screen session, run: byobu')\n"
|
printf "$(gettext 'To launch in a nested session, run: byobu')\n"
|
||||||
;;
|
;;
|
||||||
dumb)
|
dumb)
|
||||||
# Dumb terminal, don't launch
|
# Dumb terminal, don't launch
|
||||||
|
|
|
@ -33,6 +33,6 @@ else
|
||||||
status="$USER@$(hostname)"
|
status="$USER@$(hostname)"
|
||||||
echo "hardstatus lastline '$status'" >> "$BYOBU_CONFIG_DIR/keybindings"
|
echo "hardstatus lastline '$status'" >> "$BYOBU_CONFIG_DIR/keybindings"
|
||||||
fi
|
fi
|
||||||
screen -X at 0 source "$BYOBU_CONFIG_DIR/profile"
|
$BYOBU_BACKEND -X at 0 source "$BYOBU_CONFIG_DIR/profile"
|
||||||
|
|
||||||
# vi: syntax=sh ts=4 noexpandtab
|
# vi: syntax=sh ts=4 noexpandtab
|
||||||
|
|
|
@ -30,7 +30,6 @@ case "$-" in
|
||||||
# no-op
|
# no-op
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
# screen -X -S "$PKG" at "$USER*" stuff ". $0"; then
|
|
||||||
echo 2>&1
|
echo 2>&1
|
||||||
echo "ERROR: You must source this file, rather than execute it." 2>&1
|
echo "ERROR: You must source this file, rather than execute it." 2>&1
|
||||||
echo " . $0" 2>&1
|
echo " . $0" 2>&1
|
||||||
|
|
|
@ -182,7 +182,7 @@ setcolor() {
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
prompt "background"
|
prompt "background"
|
||||||
prompt "foreground"
|
prompt "foreground"
|
||||||
screen -X at 0 source "$BYOBU_CONFIG_DIR/profile"
|
$BYOBU_BACKEND -X at 0 source "$BYOBU_CONFIG_DIR/profile"
|
||||||
else
|
else
|
||||||
while true; do
|
while true; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
|
|
@ -24,12 +24,13 @@ PKG = "byobu"
|
||||||
SHELL = os.getenv("SHELL", "/bin/bash")
|
SHELL = os.getenv("SHELL", "/bin/bash")
|
||||||
HOME=os.getenv("HOME")
|
HOME=os.getenv("HOME")
|
||||||
BYOBU_CONFIG_DIR=os.getenv("BYOBU_CONFIG_DIR")
|
BYOBU_CONFIG_DIR=os.getenv("BYOBU_CONFIG_DIR")
|
||||||
|
BYOBU_BACKEND=os.getenv("BYOBU_BACKEND")
|
||||||
choice = ""
|
choice = ""
|
||||||
sessions = []
|
sessions = []
|
||||||
text = []
|
text = []
|
||||||
i = 0
|
i = 0
|
||||||
|
|
||||||
output = commands.getoutput('screen -ls ')
|
output = commands.getoutput('%s -ls ', BYOBU_BACKEND)
|
||||||
if output:
|
if output:
|
||||||
for s in output.split("\n"):
|
for s in output.split("\n"):
|
||||||
s = re.sub(r'\s+', ' ', s)
|
s = re.sub(r'\s+', ' ', s)
|
||||||
|
@ -74,8 +75,8 @@ if len(sessions) > 1:
|
||||||
choice = ""
|
choice = ""
|
||||||
sys.stderr.write("\nERROR: Invalid input\n");
|
sys.stderr.write("\nERROR: Invalid input\n");
|
||||||
elif len(sessions) == 1:
|
elif len(sessions) == 1:
|
||||||
# Attach to the chosen session; must use the 'screen' binary
|
# Attach to the chosen session; must use the binary, not the wrapper!
|
||||||
os.execvp("screen", ["", "-AOxRR"])
|
os.execvp(BYOBU_BACKEND, ["", "-AOxRR"])
|
||||||
|
|
||||||
if choice:
|
if choice:
|
||||||
if sessions[choice-1] == "NEW":
|
if sessions[choice-1] == "NEW":
|
||||||
|
@ -84,8 +85,8 @@ if choice:
|
||||||
elif sessions[choice-1] == "SHELL":
|
elif sessions[choice-1] == "SHELL":
|
||||||
os.execvp(SHELL, [SHELL])
|
os.execvp(SHELL, [SHELL])
|
||||||
else:
|
else:
|
||||||
# Attach to the chosen session; must use the 'screen' binary
|
# Attach to the chosen session; must use the binary, not the wrapper!
|
||||||
os.execvp("screen", ["", "-AOxRR", sessions[choice-1]])
|
os.execvp(BYOBU_BACKEND, ["", "-AOxRR", sessions[choice-1]])
|
||||||
|
|
||||||
# No valid selection, default to the youngest session, create if necessary
|
# No valid selection, default to the youngest session, create if necessary
|
||||||
os.execvp("byobu", ["", "-AOxRR"])
|
os.execvp("byobu", ["", "-AOxRR"])
|
||||||
|
|
|
@ -20,6 +20,9 @@
|
||||||
|
|
||||||
PKG="byobu"
|
PKG="byobu"
|
||||||
|
|
||||||
|
# Support two different backends (screen/tmux)
|
||||||
|
[ -z "$BYOBU_BACKEND" ] && export BYOBU_BACKEND="screen" || export BYOBU_BACKEND
|
||||||
|
|
||||||
# Create and set the user configuration directory
|
# Create and set the user configuration directory
|
||||||
if [ -d "$XDG_CONFIG_HOME" ] && mkdir -p "$XDG_CONFIG_HOME/$PKG"; then
|
if [ -d "$XDG_CONFIG_HOME" ] && mkdir -p "$XDG_CONFIG_HOME/$PKG"; then
|
||||||
export BYOBU_CONFIG_DIR="$XDG_CONFIG_HOME/$PKG"
|
export BYOBU_CONFIG_DIR="$XDG_CONFIG_HOME/$PKG"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue