extensions icon indicating copy to clipboard operation
extensions copied to clipboard

Update restart-system-processes extension

Open hrueger opened this issue 1 year ago • 4 comments

Description

fixes #15148

Screencast

Checklist

ToDo

  • [x] Move Sudo option to preferences
  • [x] Use nested lists instead of dropdown form
  • [x] Order list by most recent used
  • [x] Add Changelog
  • [x] Add me as contributor (was removed while publishing somehow)
  • [ ] Update Screenshots

hrueger avatar Oct 30 '24 10:10 hrueger

Thank you for your contribution! :tada:

🔔 @XInTheDark you might want to have a look.

You can use this guide to learn how to check out the Pull Request locally in order to test it.

You can expect an initial review within five business days.

raycastbot avatar Oct 30 '24 10:10 raycastbot

@XInTheDark This is what I came up with. Feel free to take a look and let me know what you think.

There's one more feature that a friend of mine just mentioned: We could add restarted processes from the advanced mode to the top list, maybe in a separate section called "commonly restarted" or something. It could be an optional feature that would have to be enabled in the preferences first, and would be disabled by default. Then, those items could have a remove-action to remove them from the list. What do you think? I'm unsure - I like the idea but I don't want to make this extension too complex.

Anyway, do you still have the pretty background? If yes, I'd kindly ask you to update the screenshots. Thanks!

hrueger avatar Oct 30 '24 17:10 hrueger

@hrueger Amazing update - just tested it and it works well! I really like the new design :)

A small detail: the list doesn't re-render immediately after an item is restarted; it's only reordered the next time the command is launched. The list also reorders when an item is selected then canceled, which is probably unnecessary. I'll put this in the code review in a bit

Regarding the feature suggestion, it's probably unnecessary for now - advanced mode is mainly just a shortcut for users who would otherwise type the command manually in terminal.

I'll generate the screenshots now, and link it here - I don't have write access to this PR I think :)

XInTheDark avatar Oct 31 '24 11:10 XInTheDark

here are the screenshots uploaded to github

XInTheDark avatar Oct 31 '24 11:10 XInTheDark

Thanks for the review, should all be fixed now 👍

Edit: never mind, I still have to fix the list not updating immediately

hrueger avatar Oct 31 '24 14:10 hrueger

A small detail: the list doesn't re-render immediately after an item is restarted; it's only reordered the next time the command is launched

I tried to implement this, however, I was not be able to make it work. I moved the fetch and state update logic to a small helper:

  const [orderedProcesses, setOrderedProcesses] = useState<Process[]>([]);
  const fetchProcesses = async () => {
    const processes = await orderItems(commonProcesses);
    setOrderedProcesses(processes);
  };

  useEffect(() => {
    fetchProcesses();
  }, []);

and I tried calling this after performAction in the onAction prop value or in the performAction itself. However, it seems like that must happen before the main window is closed, but we only change the order after closing the main window. So there's kind of a deadlock there 😅 I think we could only close the main window later, but I prefer the current user experience and would rather skip updating the list immediately. What do you think?

hrueger avatar Nov 01 '24 08:11 hrueger

Ah sure, in that case I think we can just leave it as it is - not a big deal either way :)

XInTheDark avatar Nov 01 '24 08:11 XInTheDark

Published to the Raycast Store: https://raycast.com/muzhen_gaming/restart-system-processes

github-actions[bot] avatar Nov 05 '24 22:11 github-actions[bot]

:tada: :tada: :tada:

We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag.

raycastbot avatar Nov 05 '24 22:11 raycastbot