Skip to content

xdg-terminal-exec: Rewrite

Vladimir-csp requested to merge github/fork/fluvf/deduplicate into master

Created by: fluvf

As the title says, this is not finished. This also became more comprehensive than I hoped. Opened early as I'd like some input on the changes, before cleaning this up

I still plan to go over the comments, debug messages and variable / function names, but the logic should be complete. The tests complete (I tried to make extra sure this time), and execution got faster. I know this is a nightmare to review, I'll try to break the changes into self contained commits later, if I can do it without having to add too much temp code.

Some bigger changes to try and reduce the amount of redundant work done by the script

A few notes i left in the comments that i want to bring up here:

  • All config files are read straight away now
    • i think this should be fine in any real world systems
    • any hypothetical performance losses are, in my opinion, outweighed by the simpler and easier to maintain code that this approach enables
    • the code got a lot faster elsewhere to compensate
  • I don't think find gives any guarantees about the printing order of found files
    • This should be noted in the README at least, maybe even a sort should be added?

Some background: This started because i tried using xdg-terminal-exec on an old laptop, with a slow disk, where execution could take up to two seconds, with near empty config and folders. When investigating, I also noticed duplicate code and redundant logic throughout the script, which i tried to reduce Now all folders and files are only searched once, and most of the subshells and external commands have been replaced by in-shell equivalents

Please ask / let me know if I missed something

Merge request reports

Loading