CLI re-use existing window even if freetube window is in the background (podcast usage)
FreeTube CLI when main window is in the foreground
Pull Request Type
- [ ] Bugfix
- [x] Feature Implementation
- [ ] Documentation
- [ ] Other
Related issue
Description
When invoking the CLI with a new URL, if the current FreeTube window is in the background (out of focus), a new window is created... This pull request bring the window in the foreground which fix the problem.
The main use-case is when you are on a youtube podcast for which you generally don't have the freetube window in the foreground or as picture-in-picture.
Screenshots
Testing
Desktop
- OS: ALL
- OS Version: ALL
- FreeTube version: ALL
Additional context
Could you please explain these changes in more detail, as they don't make much sense to me. mainWindow.focus() is already called by the existing code, so I'm not sure why you are calling it a second time. As we never call mainWindow.hide() it doesn't make much sense to call mainWindow.show().
Could you please explain these changes in more detail, as they don't make much sense to me.
mainWindow.focus()is already called by the existing code, so I'm not sure why you are calling it a second time. As we never callmainWindow.hide()it doesn't make much sense to callmainWindow.show().
when you listen a podcast, you don't have the freetube window in the foreground. on my mac, when the window was in the foreground but not minimized, launching the cli lead to a new window created all the time. invoking mainWindow.show() fixed the issue.
You can verify that easily.
I need testing instructions for at least macOS and one another OS (linux/windows/both) for 0/1/2+ windows
I need testing instructions for at least macOS and one another OS (linux/windows/both) for 0/1/2+ windows
Simply launch the binary with an url arg:
- macOS: /Applications/FreeTube.app/Contents/MacOS/FreeTube <youtube_url>
- windows: I guess the excutable is under Program Files\FreeTube
None of the changes in this PR are necessary on Windows, which is why I am questioning them so much, because you are essentially claiming that macOS itself is calling .hide() on the window, which sounds very hard to believe considering you have provided no proof to back up that claim.
None of the changes in this PR are necessary on Windows, which is why I am questioning them so much, because you are essentially claiming that macOS itself is calling
.hide()on the window, which sounds very hard to believe considering you have provided no proof to back up that claim.
I've change the patch such that it's applied only on mac as you say the behavior is normal on windows. (I've no windows computer indeed)
did you test it on mac?
I am not going to go and buy a Mac just to confirm your unsubstantiated claims that code that looks completely overkill, is necessary. Hopefully Pikachu will be able to confirm if any of these changes are actually necessary, as it seems unlikely that you are going to provide any proof that the changes are necessary.
Just a reminder that this is your pull request that you would like to be merged in, so being unhelpful and not answering the questions you have been asked just means whole process is going to take a lot longer and is much more frustrating for everyone involved.
An example on how to write Testing section: (and please also update your testing section instead of just putting those in replies https://github.com/FreeTubeApp/FreeTube/pull/5783