omerxx / tmux-sessionx

A Tmux session manager, with preview, fuzzy finding, and MORE
GNU General Public License v3.0
556 stars 51 forks source link

sessions invisible after kill-session from switcher #72

Open pandalanax opened 3 months ago

pandalanax commented 3 months ago

Deleting a session makes other sessions invisible. Example: I have four sessions running. image

Now deleting test2 session leads to this: image

Reopening the session view is listing all sessions again:

image

Tmux Version: 3.3a tmux-sessionx running on e6d0215 nixOS 23.11

omerxx commented 3 months ago

Yep, what's happening here is you killing the current session "test2", tmux puts you on the next one on the list "test1" and sessionx reverting to its default of filtering out the current session from the list.

Note to self: KILL_SESSION invokes reload_sessions.sh where the code should take user configuration into consideration

pandalanax commented 3 months ago

mh, in the screenshots my current session is "nix". But if i am in "test2" and kill it, the behavior you described is correct. I have set-option -g detach-on-destroy off set in my tmux.conf

sarojregmi200 commented 1 month ago

@omerxx, I got what you said. And was thinking about opening an issue regarding this problem.

set -g @sessionx-filter-current 'false'

Works as configured, and when any one of the session is deleted it removes the session but ignores the above configuration and hides the session that is currently active.

Thanks for the note above as it cleared me where to look for the problem.

if [[ $(echo "$SESSIONS" | wc -l) -gt 1 ]]; then
    echo "$SESSIONS" | grep -v "$CURRENT_SESSION"
else
    echo "$SESSIONS"
fi

Here the configuration check is missing, I would love to look at it. I think this issue has been open for long.

sarojregmi200 commented 1 month ago

@omerxx Just a gentle reminder. What are your thoughts on this? I think you missed the above mention.

omerxx commented 1 month ago

@sarojregmi200 Sorry for the delay, pushed a branch held in a PR (#98), this should solve the issue. Would you like to quickly test it by installing the plugin from that branch?

set -g @plugin 'omerxx/tmux-sessionx#72-kill-and-filter'
sarojregmi200 commented 1 month ago

I will once I am free.

And would like to see your approach, I have already patched my cloned version.

omerxx commented 1 month ago

I will once I am free.

And would like to see your approach, I have already patched my cloned version.

@sarojregmi200 It's just the same statement used on the main .sh file. Since fzf's execute requires an executable to run, I had to separate reload-sessions.sh form the main plugin, creating a duplication. A more elegant approach would be another utils file that I could source on both cases but for now this should be enough

sarojregmi200 commented 1 month ago

Yeah! I was also thinking the same looking at the changed files. And am yet to test it but I think there are some more configurations that should be duplicated to ensure user's customization takes effect. Let me confirm my guess and report it here.