extensions icon indicating copy to clipboard operation
extensions copied to clipboard

Color Casket: Make Picker command a no-view command

Open fe9lix opened this issue 2 years ago • 6 comments

Description

@slavarazum Fixes the Color Casket Picker command to be a no-view command. Currently the command is set up with an async main function, which the API only supports for no-view commands. (This will generate a warning in future API releases...)

Checklist

fe9lix avatar Oct 27 '22 10:10 fe9lix

Thank you for your contribution! :tada:

🔔 @slavarazum you might want to have a look.

raycastbot avatar Oct 27 '22 10:10 raycastbot

Great improvement @fe9lix! Previously no-view mode did not work with async operations. Looks like now everything is fine.

We still have a problem with the picker call from index command. It has 10s timeout after which the color is not saved and returning to the Raycast window does not work.

I have tried to change this line to:

onAction={async () => await openColorPicker(defaultFormat)}

timeout still exists.

Do we have any ability to create async actions without timeout like with no-view mode?

slavarazum avatar Oct 27 '22 20:10 slavarazum

Hi @slavarazum 👋

Can you check it again, I just want to make sure that I didn't break anything 😊

pernielsentikaer avatar Oct 28 '22 07:10 pernielsentikaer

Hi @pernielsentikaer 🙌 Checked latest change and the behavior has changed from what was originally planned.

Separate Pick Color command just copies a result to clipboard. When you run Pick a Color action from Render Color command it copies a result to clipboard and returns to the command view to show it in the history list.

As I can see the new launchCommand function runs separate Pick Color command without ability of further control from the Render Color command. It would be nice to have the ability to run async operation from list item action with ability to return to previous state with updates.

slavarazum avatar Oct 28 '22 15:10 slavarazum

It would be nice to have the ability to run async operation from list item action with ability to return to previous state with updates.

@slavarazum If I understand it correctly, you could achieve that with the new command launching API by passing a context object between the two commands.

fe9lix avatar Oct 28 '22 16:10 fe9lix

@fe9lix I want to achieve opening color picker from 2 different commands with 2 different behavior. Running one command from another is not suitable to provide different results.

You can try to check the behavior of the Color Casket actual version by running a separate Pick Color command and with the Pick a Color action from Render Color command.

Expected behavior

https://user-images.githubusercontent.com/5820718/198695767-7faba0d7-3ae3-4473-a9b6-5ffd8ab699f9.mp4

10s Timeout bug

https://user-images.githubusercontent.com/5820718/198695924-86525a3e-026a-4339-8cc3-0fe62145977c.mp4

slavarazum avatar Oct 28 '22 17:10 slavarazum

Hi @slavarazum 👋

Could you give it another spin 😊

pernielsentikaer avatar Oct 29 '22 05:10 pernielsentikaer

@pernielsentikaer Made some additions in #3360 New issue with "root window flickering" appeared. Details in description.

slavarazum avatar Oct 29 '22 18:10 slavarazum

So let's merge this one, right @slavarazum (and continue in the other one)

pernielsentikaer avatar Oct 31 '22 09:10 pernielsentikaer

Published to the Raycast Store: https://raycast.com/slava.razum/color-casket

raycastbot avatar Oct 31 '22 13:10 raycastbot

@pernielsentikaer This one only implement picking in default format with "root window flickering" issue and doesn't cover picking in other formats.

In https://github.com/raycast/extensions/pull/3360 behavior with other formats is already implemented. So, let's merge #3360 to ensure same behavior for picking colors in default and other formats.

As a next step we should wait some additions for launchCommand function to fix "root window flickering" for no-view commands.

slavarazum avatar Oct 31 '22 13:10 slavarazum