From 68f7ad2755b67558989400577bcb8d45a0de1d12 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Tue, 27 Dec 2022 11:58:17 -0600 Subject: [PATCH 1/3] feat(shell): Detect TMUX if exists --- src/tmuxp/cli/shell.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/tmuxp/cli/shell.py b/src/tmuxp/cli/shell.py index 9be9b863083..7ea117cbf20 100644 --- a/src/tmuxp/cli/shell.py +++ b/src/tmuxp/cli/shell.py @@ -1,5 +1,6 @@ import argparse import os +import pathlib import typing as t from libtmux.server import Server @@ -140,6 +141,17 @@ def command_shell( - :attr:`libtmux.Server.attached_sessions`, :attr:`libtmux.Session.attached_window`, :attr:`libtmux.Window.attached_pane` """ + # If inside a server, detect socket_path + env_tmux = os.getenv("TMUX") + if env_tmux is not None and isinstance(env_tmux, str): + env_socket_path = pathlib.Path(env_tmux.split(",")[0]) + if ( + env_socket_path.exists() + and args.socket_path is None + and args.socket_name is None + ): + args.socket_path = str(env_socket_path) + server = Server(socket_name=args.socket_name, socket_path=args.socket_path) server.raise_if_dead() From 6cfa40a690477ef4840511ed732715391f2aeb12 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Tue, 27 Dec 2022 12:04:38 -0600 Subject: [PATCH 2/3] docs(CHANGES): Note tmuxp shell improvement --- CHANGES | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES b/CHANGES index 81a590d7fa0..db47a983940 100644 --- a/CHANGES +++ b/CHANGES @@ -19,6 +19,8 @@ $ pipx install --suffix=@next 'tmuxp' --pip-args '\--pre' --force +- `tmuxp shell` now detects current `server` via `TMUX` (#854) + ## tmuxp 1.21.0 (2022-12-27) *Maintenance only, no bug fixes or features* From b2dc31f75ba5adafa5576824075886a678ed2eeb Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Tue, 27 Dec 2022 12:06:27 -0600 Subject: [PATCH 3/3] Tag v1.22.0 (tmuxp shell improvement from #854) --- CHANGES | 15 ++++++++++----- pyproject.toml | 2 +- src/tmuxp/__about__.py | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CHANGES b/CHANGES index db47a983940..17dd29f5da1 100644 --- a/CHANGES +++ b/CHANGES @@ -15,15 +15,19 @@ $ pipx install --suffix=@next 'tmuxp' --pip-args '\--pre' --force // Usage: tmuxp@next load yoursession ``` -## tmuxp 1.22.x (unreleased) +## tmuxp 1.23.x (unreleased) -- `tmuxp shell` now detects current `server` via `TMUX` (#854) +## tmuxp 1.22.0 (2022-12-27) + +### Improvement + +- `tmuxp shell`: now detects current `server` via `TMUX` (#854) ## tmuxp 1.21.0 (2022-12-27) -*Maintenance only, no bug fixes or features* +_Maintenance only, no bug fixes or features_ - libtmux 0.17.2 -> 0.18.0 @@ -35,7 +39,7 @@ $ pipx install --suffix=@next 'tmuxp' --pip-args '\--pre' --force ## tmuxp 1.20.2 (2022-12-27) -*Internal update only* +_Internal update only_ - libtmux 0.17.1 -> 0.17.2 @@ -43,7 +47,7 @@ $ pipx install --suffix=@next 'tmuxp' --pip-args '\--pre' --force ## tmuxp 1.20.1 (2022-12-27) -*Internal update only* +_Internal update only_ - libtmux 0.17.0 -> ~0.17.1 @@ -114,6 +118,7 @@ $ pipx install --suffix=@next 'tmuxp' --pip-args '\--pre' --force - Support for environmental variables - Remove reliance on `distutils.version.LooseVersion` for `libtmux._compat.LegacyVersion` + - Fix distutil warnings by using libtmux 0.16.0's `LegacyVersion` (#727) ## tmuxp 1.18.2 (2022-11-06) diff --git a/pyproject.toml b/pyproject.toml index cc9a8aff3f9..259aaf741ff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "tmuxp" -version = "1.21.0" +version = "1.22.0" description = "tmux session manager" license = "MIT" authors = ["Tony Narlock "] diff --git a/src/tmuxp/__about__.py b/src/tmuxp/__about__.py index 5834a2ba278..358a6c871be 100644 --- a/src/tmuxp/__about__.py +++ b/src/tmuxp/__about__.py @@ -1,6 +1,6 @@ __title__ = "tmuxp" __package_name__ = "tmuxp" -__version__ = "1.21.0" +__version__ = "1.22.0" __description__ = "tmux session manager" __email__ = "tony@git-pull.com" __author__ = "Tony Narlock"