Sample Header Ad - 728x90

Open a new window in tmux only if no window is opened in the given path, otherwise attach to it

0 votes
1 answer
447 views
Currently I have my terminal (alacritty) run tmux new -A -s 0 at start to start a new session 0, or attach to it if it already exists. One problem is, I sometimes use open in directory from file manager (Dolphin). In that case, I am just reconnected to the older session and not in the desired directory. What I want to achieve is to open a new window in the session 0 with my desired path as working directory if no such window exists in the given session. Otherwise, I want to switch to that existing window. If that is not possible, I'm happy with just creating a new window every time. Maybe it can be detected if a process is running in the current active window, and if not, using cd to switch the directory? If anyone has any ideas on how to achieve this, it will be greatly appreciated.
Asked by Sntn (123 rep)
Mar 12, 2024, 08:09 AM
Last activity: Mar 13, 2024, 07:34 AM