Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opt-Out of Duplicate Sessions #156

Open
joshmedeski opened this issue Sep 4, 2024 · 3 comments
Open

Opt-Out of Duplicate Sessions #156

joshmedeski opened this issue Sep 4, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@joshmedeski
Copy link
Owner

joshmedeski commented Sep 4, 2024

What would you like sesh to do?

As a user, I want to be able to hide duplicate session names, so I can reduce the amount of sessions listed and more accurately get to the item that I want.

  • Hide custom config with the same name as an active tmux session
  • Hide zoxide result is the same directory as an active tmux session and/or config with a matching directory (or same session name)

Config

Possibly could be configured, names are just a placeholder.

[[list_options]]
hide_matching_config = true
hide_matching_zoxide = true

And/or it could be flags on the list command:

sesh list --hide-matching-config --hide-matching-zoxide

Conversely, the opposite flags could be used to overwrite the config:

sesh list --show-matching-config --show-matching-zoxide
@joshmedeski joshmedeski added the enhancement New feature or request label Sep 4, 2024
@joshmedeski joshmedeski self-assigned this Sep 4, 2024
@joshmedeski joshmedeski moved this to Backlog in OSS Development Sep 4, 2024
@seflue
Copy link

seflue commented Jan 3, 2025

I made an attempt of removing the duplicates from the combined list in a draft PR #205.

@joshmedeski What do you think? I first created it as a draft PR, because the refactorings I made could drive some discussions.

A question I have: Why would a user want to see entries for preconfigured session or zoxide pathes in the combined result, when a session is already open? Without the -i flag, there is no visible difference, which makes the occurence of duplicates more awkward.

In my PR I omitted any CLI flags completely, but my feeling is, if there is actually a use case for showing the duplicates, it is more of an edge case and I would rather add a switch for opting out of deduplication then showing the duplicates by default.

@joshmedeski
Copy link
Owner Author

The reason it was removed in the rewrite to GoLang was simplicity. Having to loop through each list and determine what duplicates might exist and skip them or remove them was a lot of conditional logic and additional lookups.

I'm down for reintroducing this but I'd prefer we find a responsible way of separating that logic from the core packages (tmux, zoxide, configs, etc...)

@seflue
Copy link

seflue commented Jan 3, 2025

The reason it was removed in the rewrite to GoLang was simplicity. Having to loop through each list and determine what duplicates might exist and skip them or remove them was a lot of conditional logic and additional lookups.

To make this easier, I introduced the lo package in my PR.

I'm down for reintroducing this but I'd prefer we find a responsible way of separating that logic from the core packages (tmux, zoxide, configs, etc...)

It only makes sense in the list which combines all sources. From a users perspective it's actually pretty simple: The source of already running tmux sessions has the highest preference. Every other source should be filtered for entries, which would produce a new session with the same name as one of the already running tmux sessions. Those entries should be removed from the combined list.

And that's exactly what I implemented in PR #205.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Backlog
Development

No branches or pull requests

2 participants