Skip to content
This repository has been archived by the owner on Feb 25, 2023. It is now read-only.

Switch matching profiles #389

Closed
wants to merge 12 commits into from

Conversation

siikamiika
Copy link
Collaborator

@siikamiika siikamiika commented Mar 5, 2020

The first few commits are refactoring and framework building, and c7d0df4 is the actual feature.

The pattern used in f59e760 helps with #368. It took me a while to completely (maybe) undestand how the popup proxy framework works, and did some misguided work on siikamiika@875b04b. While most of it is useless, I think the "selective flooding algorithm" can be reused for iframes #29 #364.

I'd appreciate some ideas about displaying the dropdown menu or profile selection. It can be quite ugly depending on the operating system and theme.

Fixes #388

Possible workaround for #320, #378, #379

Comment on lines 242 to 290
if (!contextHasResults) {
yield {index: profileCurrent, profile: profiles[profileCurrent]};
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be useful to yield all profiles but also indicate which is the currently selected profile in case the user has not specified any conditions or none of them match the current context

Copy link
Collaborator Author

@siikamiika siikamiika Mar 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in eacae54

@siikamiika
Copy link
Collaborator Author

There are potentially some issues preparing PopupProxy before accessing its ID from Frontend, but I consider that out of scope of this feature.

@siikamiika

This comment has been minimized.

@siikamiika
Copy link
Collaborator Author

7b7db89 could have actually been done on master first and rebased on this, but it doesn't change anything in practice except one property access so let's include it here while we're at it.

@toasted-nutbread
Copy link
Collaborator

So you're right, this is something that will need a UI/UX pass before fully implementing, since there have been issues before with users disliking some UI layout settings (#349).

I have created #402 to have a separate discussion on UI design changes. Changing the existing UI design should be considered outside the scope of this PR.

@siikamiika siikamiika force-pushed the switch-matching-profiles branch from 7b7db89 to 196d7a6 Compare March 8, 2020 12:54
@siikamiika
Copy link
Collaborator Author

Ok, I think I'll go with the current design and the profile name to the floating header, making it only visible when there are more profiles than one. After that I'll add some hotkeys to switch between them.

@siikamiika
Copy link
Collaborator Author

It should now be usable with a reasonable amount of active profiles without changing the current layout too much.

@siikamiika
Copy link
Collaborator Author

Sorry for going back and forth with the commits, I can try to squash related ones at some point

@siikamiika siikamiika force-pushed the switch-matching-profiles branch from 2294726 to 45f6ea4 Compare March 9, 2020 02:11
getOptionsContext() {
throw new Error('Override me');
return {
index: this.profileSwitcher.globalProfileIndex
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be safer if instead of the index a unique ID was used. It could be either autoincrement from the DB or a randomly generated number. Not sure if same applies to backend/options because the index comes from there.

Comment on lines 271 to 293
onProfileChanged(profileIndex) {
super.onProfileChanged(profileIndex);
const query = this.query.value;
if (query) {
this.setQuery(query);
this.onSearchQueryUpdated(query, false);
}
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be called from prepare before QueryParser has been prepared. It throws an error about missing template handler. Will have to look for a workaround, for example using a prepared flag.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

quick way to switch between profiles
2 participants