Menu

#291 Make option to quit yad --dnd after the first drop.

New
nobody
None
Medium
Enhancement
2017-05-20
2017-05-19
No

More than a few times, I wanted a dnd drop site that went away immediately after a single drop. Could yad have such an option? Thanks!

Discussion

  • Christopher Oliver

    Here is a preliminary patch on yad-0.39.0 to achieve this.

     

    Last edit: Christopher Oliver 2017-05-19
  • Victor Ananjevsky

    thank you, commited in r1104. i slightly modify your patch and add a count of drops before exiting. so, in your case option will looks like --exit-on-drop=1

     
    • Christopher Oliver

      On Sat, 20 May 2017 08:28:18 +0000
      "Victor Ananjevsky" v1c0nt@users.sf.net wrote:

      thank you, commited in r1104. i slightly modify your patch and add a count of drops before exiting. so, in your case option will looks like --exit-on-drop=1

      Thank you. While a negative value is nonsensical, should it trigger a specific error? As it stands, it increments the
      counter, but dnd dialog stays up until the counter rolls over. That won't happen in our lifetimes, but it's still unhappy
      for anyone reading the code. If not an error, then maybe make the first conditional:

      if (options.dnd_data.exit_on_drop > 0)
      

      My natural tendency is to write both conditions and the increment as a single condition with short circuit evaluation, but
      you might not like that style.

      Maybe GTK provides a way of range-checking the argument to guarantee it's non-negative, but I'm really not a GTK wizard,
      so I don't know if it does.

      Again, thanks for adding my feature. I'm hacking together a Lua script to launch VST libraries via WINE, and if the user
      clicks on an FXB or FXP file for which the instrument/effect isn't known, I want to raise a filer (ROX-filer in my case) on the
      VSTPATH directory and a DND dialog and have the dialog and filer go away as soon as the user drops a VST icon on the
      dialog window. The --exit-on-drop option was the missing piece; I'm just surprised that I'm the first to want this.

       
      • Victor Ananjevsky

        glib's option parser makes a range check. and i use unsigned int for argument, so any values will always be great or equal to 0

         
  • Christopher Oliver

    It occurs to me that exiting on --edit-on-drop should produce a distinct
    exit value to distinguish it from an abnormal exit. Exit 252 happens
    if you kill the window or hit escape, so there's some ambiguity. Line
    count doesn't work, because any one drop may produce several lines
    of output. I've attached a patch to remedy this.

     

    Last edit: Christopher Oliver 2017-05-24
    • Victor Ananjevsky

      fixed, but default exit code is 0 right now. if you need to change this value - use --response option

       

Log in to post a comment.