Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Losing focus while renaming files #10

Open
theodumont opened this issue Aug 12, 2020 · 1 comment
Open

Losing focus while renaming files #10

theodumont opened this issue Aug 12, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@theodumont
Copy link
Owner

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.

  • one solution may be to use win32gui, but it is only available on Windows;
  • another one may be to use a workaround using xdotool for Linux, as suggested here. It seems that there is a Windows version, xdotool-for-windows, so it may be a solution that would work for both OS.

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

@theodumont theodumont added the enhancement New feature or request label Aug 12, 2020
@roadelou
Copy link
Contributor

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 💻

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 😄

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants