tmux-sessionx icon indicating copy to clipboard operation
tmux-sessionx copied to clipboard

sessions invisible after kill-session from switcher

Open pandalanax opened this issue 1 year ago • 8 comments

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

pandalanax avatar Apr 05 '24 06:04 pandalanax

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

omerxx avatar Apr 05 '24 08:04 omerxx

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

pandalanax avatar Apr 05 '24 11:04 pandalanax

@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.

0x2f0 avatar May 12 '24 10:05 0x2f0

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

0x2f0 avatar May 17 '24 16:05 0x2f0

@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'

omerxx avatar May 18 '24 21:05 omerxx

I will once I am free.

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

0x2f0 avatar May 19 '24 03:05 0x2f0

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

omerxx avatar May 19 '24 08:05 omerxx

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.

0x2f0 avatar May 19 '24 12:05 0x2f0