mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-21 14:03:18 -07:00
bin/byobu-launcher, bin/byobu-select-session,
share/man/man1/byobu-select-session.1: add a dynamic prompt if automatically launching byobu on a server where multiple sessions exist, LP: #368963
This commit is contained in:
parent
ed589b4eb9
commit
954c3ef565
4 changed files with 84 additions and 2 deletions
4
debian/changelog
vendored
4
debian/changelog
vendored
|
@ -19,6 +19,10 @@ byobu (2.47) unreleased; urgency=low
|
|||
- usr/share/byobu/tests/byobu-time-notifications: relocate, rename, and
|
||||
install the notification timing tests, add a copyright header
|
||||
- AUTHORS, ChangeLog, NEWS: added
|
||||
* bin/byobu-launcher, bin/byobu-select-session,
|
||||
share/man/man1/byobu-select-session.1: add a dynamic prompt if
|
||||
automatically launching byobu on a server where multiple sessions
|
||||
exist, LP: #368963
|
||||
|
||||
[ Jason Cohen ]
|
||||
* usr/bin/byobu: check if our terminfo supports 256 colors, LP: #409353
|
||||
|
|
|
@ -37,6 +37,5 @@ else
|
|||
rm -f "$RUN/$PKG.ssh-agent"
|
||||
ln -sf "$SSH_AUTH_SOCK" "$RUN/$PKG.ssh-agent"
|
||||
fi
|
||||
# Re-attach to existing session
|
||||
exec screen -xRR
|
||||
exec byobu-select-session
|
||||
fi
|
||||
|
|
59
usr/bin/byobu-select-session
Executable file
59
usr/bin/byobu-select-session
Executable file
|
@ -0,0 +1,59 @@
|
|||
#! /usr/bin/env python
|
||||
#
|
||||
# byobu-select-session
|
||||
# Copyright (C) 2010 Canonical Ltd.
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@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/>.
|
||||
|
||||
|
||||
import commands, os, sys
|
||||
|
||||
sessions = []
|
||||
choice = ""
|
||||
sessions.append(0)
|
||||
i = 0
|
||||
output = commands.getoutput('byobu -ls | sed "s/\s\+/ /g" | grep "^\s"')
|
||||
if output:
|
||||
for s in output.split("\n"):
|
||||
items = s.split(" ")
|
||||
sessions.append(items[1])
|
||||
i += 1
|
||||
|
||||
if i > 1:
|
||||
sys.stdout.write("\nByobu sessions...\n\n")
|
||||
tries = 0
|
||||
while tries < 3:
|
||||
i = 1
|
||||
for s in output.split("\n"):
|
||||
sys.stdout.write(" %d. %s\n" % (i, s))
|
||||
i += 1
|
||||
try:
|
||||
choice = input("\nChoose [1-%d]: " % (i-1))
|
||||
if choice < 1 or choice >= i:
|
||||
choice = ""
|
||||
except:
|
||||
tries += 1
|
||||
choice = ""
|
||||
if choice:
|
||||
break
|
||||
else:
|
||||
sys.stderr.write("\nERROR: Invalid input\n");
|
||||
|
||||
if choice:
|
||||
# Attach to the chosen session
|
||||
os.execv("/usr/bin/byobu", ["", "-x", sessions[choice]])
|
||||
else:
|
||||
# No valid selection, default to the youngest session
|
||||
os.execv("/usr/bin/byobu", ["", "-xRR"])
|
20
usr/share/man/man1/byobu-select-session.1
Normal file
20
usr/share/man/man1/byobu-select-session.1
Normal file
|
@ -0,0 +1,20 @@
|
|||
.TH byobu\-select\-session 1 "12 Jan 2010" byobu "byobu"
|
||||
.SH NAME
|
||||
byobu\-select\-session \- select and connect to a byobu session
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBbyobu\-select\-profile\fP is an application that lists the available screen sessions running on the system, and prompts the user to select one. If an invalid selection is chosen 3 times in a row, the user is connected to the youngest session. If only one session exists, the user is connected to that session. If no sessions exist, a new session is created.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.PD 0
|
||||
.TP
|
||||
\fBbyobu\fP(1), \fBscreen\fP(1)
|
||||
|
||||
.TP
|
||||
\fIhttp://launchpad.net/byobu\fP
|
||||
.PD
|
||||
|
||||
.SH AUTHOR
|
||||
This manpage and the utility were written by Dustin Kirkland <kirkland@canonical.com> for Ubuntu systems (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 3 published by the Free Software Foundation.
|
||||
|
||||
On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL.
|
Loading…
Add table
Add a link
Reference in a new issue