theodumont / video-logging

An easy-to-use colored command line interface that sorts files.
MIT License
3 stars 3 forks source link

Losing focus while renaming files #10

Open theodumont opened 4 years ago

theodumont commented 4 years ago

When using the rename command with open_while_renaming: True in data.yaml, each time a file is opened, the subprocess takes the focus and one has to ctrl + tab back to the terminal to write the file's new name. It's not a big deal but it slows down the renaming process an can be a bit annoying when dealing with a lot of files.

At the risk of disappointing you all 😉, I do not plan to implement this enhancement for now.

roadelou commented 4 years ago

I don't have a copy of Windows available, but I think this might be because of the start command.

I had inferred that start runs the given command in a new shell, but from what you are saying it might be that it actually runs into a new graphical terminal :computer:

Because internally you are trying to run a file that is not executable, my guess is that the process crashes before the terminal has time for visually appear, and the only artifact of its existence is that the focus has moved to the now defunct window.

I might be wrong though, as I don't have Windows to test it I cannot tell for sure :smile:

Maybe that running the file directly in the subprocess (without the start command) would solve this?

# So changing from this
Popen("start /WAIT $file", shell=True)
# To this
Popen("$file", shell=True)

This may or may not do the trick.