SwarmUI icon indicating copy to clipboard operation
SwarmUI copied to clipboard

Hotkey Shortcuts for Delete/Star/etc. Image Actions

Open laurentopia opened this issue 1 year ago • 1 comments

Feature Idea

the image browser already has <- and -> so all that's missing is delete, to do some clean up.

Other

No response

laurentopia avatar Oct 08 '24 23:10 laurentopia

Thoughts on impl here:

The first thing to build:

  • Should be a generalized hotkey system first, not specific to these features per se
  • Should be user-configurable easily. At least a user settings text box where a user can type delete for the delete key or ctrl+d or whatever for that, and on settings load it parses and registers the hotkeys
  • should replace the impl of ctrl+enter global generate trigger hotkey
  • should be a JS class, HotkeyHandler or something, probably under the user settings js file
  • probably that class has a registrable map of like... register("settingname", () -> { action(); }); that gets populated by other JS (and potentially by extensions) and then handler actually builds the event handlers a few ticks after the main genpage load event (extra delay just to preempt issues with handling order)
  • take care around how hotkeys behave when eg you're typing in a textbox. Ctrl+Enter should still generate, but Delete should not delete your image if you're deleting text. I'm not sure the optimal solution here - maybe only prefixed (ctrl/alt/?) keys are textbox-irrelevant?

And then, separately, as a followup job:

  • impl specific to image actions
  • maybe see about sub-rendering keybinds on the menu? At least a title addition of eg Hotkey: delete or whatever, but maybe also on the dropdown view of things it uses the gray side rendering (see eg how in <lora: list it can render SDXL on the side)
  • when impling image actions, take care about splitting the menus that are the same between current image view and image history/etc

Additionally:

  • a proper direct event registration may also require a refactor of CurrentImageHandler to make these functions more accessible, iirc they are currently handled via inside-a-func unique per image registrations, rather than CurrentImageHandler having a global callable func, but any hotkey registration needs to be a global callable
  • that refactor is a nontrivial job and if it's needed is a maintainer-only task, the other bits are open to PRs though I think

mcmonkey4eva avatar Nov 25 '25 02:11 mcmonkey4eva