alfred-pdf-tools
alfred-pdf-tools copied to clipboard
Setting a default filename when merging
Firstly, thanks for the great workflow!
I find myself often merging pdfs and keeping the first filename for the merged file (e.g. when combining main manuscript and supplemental material in my zotero database)
with this PR, an empty filename keeps the old one when merging, and appends _merged
.
If original files are deleted, it does not append anything.
This will require a change of the "argument required" option in the alfred workflow. (which I did not know how to include in the PR)
Maybe we should also update the subtext to warn that this will happen.
This will require a change of the "argument required" option in the alfred workflow. (which I did not know how to include in the PR)
You just need to commit the changes in info.plist
.
Btw, the next release will be compatible with Alfred 5 only.
@pSpitzner could you resolve the conflicts so I can review your PR?
@pSpitzner could you resolve the conflicts so I can review your PR?
Hi @xilopaint,
I wanted to resolve the conflicts just now and saw that you removed the should_trash
option. This seems to break the use case I described, doesn't it?
I found it okay to overwrite the first file when trashing, but now I think the user would expect a non-destructive operation by default. So just reusing the file name of the first selected file for the output would not be ideal.
Alternatively, we could create a copy of the original file.
@pSpitzner I just made a new release. Could you resolve conflicts again?
I ask you to make any changes you find appropriate so I can review your PR. If you make any changes in the workflow editor remember to commit info.plist
.
Okay, I think that should do the trick. Took me a while to realize that you are using an alfred action for deleting now.
Personally, I find this design weird. You have a boolean argument (should_trash
) that is only used if another argument (out_filename
) is an empty string. If out_filename
is not empty should_trash
doesn't make any difference and is set to false even when the input files are actually moved to Trash. Could you find a better design for this?
I dont see an elegant way to do this on the python level. With the old version, where moving to trash happened in code, this was more transparent.
The constraints are
- check if the filename is set, and generate if not set. Thus we need
out_filename
- check whether we want to trash, which has different effects depending on 1. Thus, we need some way to distinguish the cases. Either we define another, differently named function, or pass a bool - just as you did in the previous versions.
One could probably do this with Alfred alone, by detecting if a filename is set, else setting it to the first argument. Then, later, delete differently depending on a check if output and input name are the same (which would be a good idea in any case).
One could probably do this with Alfred alone, by detecting if a filename is set, else setting it to the first argument. Then, later, delete differently depending on a check if output and input name are the same (which would be a good idea in any case).
Could you try this?
I gave it a shot today:
- removed
--mrg-trsh
all together - set a variable depeneding on cmd-down
- depending on that, sets the output file name
- makes sure not to delete (by printing) the output file name. this now also covers the case where the user manually types the name of an input pdf.
The requested feature has been implemented in the latest version. Sorry for being late.