mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-23 22:56:16 -07:00
* usr/lib/byobu/include/select-session.py: LP: #1750430
- commit edeae41
fixed the excessive creation of sessions by not
creating different sessions. This commit adjust the behavior in a way
that having .reuse-sessions enabled tmux will properly attach and remove
sessions when dettaching and will also kill the last session available.
- When more than two sessions exist, tmux asks which session to use
This commit is contained in:
parent
75140e25a9
commit
8682c31b0e
1 changed files with 5 additions and 2 deletions
|
@ -80,7 +80,7 @@ def get_sessions():
|
||||||
if output:
|
if output:
|
||||||
for s in output.splitlines():
|
for s in output.splitlines():
|
||||||
# Ignore hidden sessions (named sessions that start with a "_")
|
# Ignore hidden sessions (named sessions that start with a "_")
|
||||||
if s and not s.startswith("_"):
|
if s and not s.startswith("_") and s.find("-") == -1:
|
||||||
text.append("tmux: %s" % s.strip())
|
text.append("tmux: %s" % s.strip())
|
||||||
sessions.append("tmux____%s" % s.split(":")[0])
|
sessions.append("tmux____%s" % s.split(":")[0])
|
||||||
i += 1
|
i += 1
|
||||||
|
@ -132,6 +132,9 @@ def attach_session(session):
|
||||||
cull_zombies(session_name)
|
cull_zombies(session_name)
|
||||||
# must use the binary, not the wrapper!
|
# must use the binary, not the wrapper!
|
||||||
if backend == "tmux":
|
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])
|
os.execvp("tmux", ["tmux", "-u", "attach", "-t", session_name])
|
||||||
else:
|
else:
|
||||||
os.execvp("screen", ["screen", "-AOxRR", session_name])
|
os.execvp("screen", ["screen", "-AOxRR", session_name])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue