dragon icon indicating copy to clipboard operation
dragon copied to clipboard

Add a option to help with --and-exit

Open DevHyperCoder opened this issue 2 years ago • 2 comments

Hi, I would like to add a new flag (can't find a good name for it) to supplement the --and-exit flag. Currently, if I have multiple files "served" by dragon with the -x option, then dragon doesn't wait till i drag all the files to respective apps. It closes on the first drag_end event.

I would like to add a -X or --individual-exit (name could be improved) that will:

  • Remove "dragged" entry on the drag_end event
  • Once there are no more entires, close dragon

I know the -a option exists but my workflow consists of me having to drag different files to different applications.

I have the code changes ready and can create a PR if the maintainers are interested. Please let me know if you have any questions

Thanks

DevHyperCoder avatar May 30 '22 04:05 DevHyperCoder

This seems pretty reasonable. The goal is essentially that each entry can be dragged out once ("shelf"-style), and the program exits when there are no entries remaining?

I wonder whether this is severable into two parts:

  1. Once-each mode, where an item is removed from the list once dragged out. Perhaps this is -1, --once-each.
  2. Exit on empty, where the program closes once there are no entries left. Perhaps this is -X, --exit-empty. Arguably we could overload the existing -x with this meaning, but I imagine someone may have made a menu system or something out of it for which this would be a breaking change.

The mode you want would then be dragon -1 -X file.... A "shelf" mode, where it starts up and you can drag items in for temporary storage and back out at will, would be dragon -t -k -1 or something.

The shelf may be the only use for -1 without -X, however, so perhaps this is really two separate modes with some shared functionality: drag-and-remove until exhausted (your proposal), and drag-in-and-out-once (shelf). If there are other use cases for -1 or -X in the future it would be nice to have them, but I'm unsure whether there are other use cases or functionality where they make sense.

I know there are some others who watch these issues, so they might have comments on that. If you've already implemented this, however, I guess my question is: how straightforward is it to separate those two aspects? The functionality you describe sounds valuable already.

mwh avatar Jun 05 '22 06:06 mwh

The goal is essentially that each entry can be dragged out once ("shelf"-style), and the program exits when there are no entries remaining?

Exactly that!

Perhaps this is -X, --exit-empty. Arguably we could overload the existing -x with this meaning, but I imagine someone may have made a menu system or something out of it for which this would be a breaking change.

A new flag would be better so as to not break backwards-compatibility

I will make a PR with what I have done already. I don't know much of C, so there might be better ways to do it. If there are, please point them out and I will be more than happy to correct them.

adding a once-each to my existing solution seems to be quite straight forward.

DevHyperCoder avatar Jun 05 '22 06:06 DevHyperCoder