wakatime / sublime-wakatime

Sublime Text 2 & 3 plugin for automatic time tracking and metrics generated from your programming activity.
https://wakatime.com/sublime-text
BSD 3-Clause "New" or "Revised" License
526 stars 47 forks source link

Periodic popup of command-line window on Windows 10 #91

Closed JosephusPaye closed 5 years ago

JosephusPaye commented 5 years ago

Hello 👋,

I have an issue similar to https://github.com/wakatime/sublime-wakatime/issues/12, WakaTime shows an popup window on init, and also periodically whenever it sends a heartbeat.

This is really disruptive to work and makes the plugin essentially unusable.

Digging into the source and past issues, I set python_binary in settings to pythonw.exe, as per #8. However, the issue remained.

Searching online, I found this: https://stackoverflow.com/a/1016651, and made the following temporary changes to WakaTime.py, which fixed the issue.

Line 28 (imports):

from subprocess import Popen, STDOUT, PIPE, STARTUPINFO, STARTF_USESHOWWINDOW

Line 320 in find_python_in_folder():

startupinfo = None
if os.name == 'nt':
    startupinfo = STARTUPINFO()
    startupinfo.dwFlags |= STARTF_USESHOWWINDOW
process = Popen([path, '--version'], stdout=PIPE, stderr=STDOUT, startupinfo=startupinfo)

And similarly at Line 554 in send_heartbeats(), where Popen() is called.

So, a combination of pythonw, instead of python for the binary and setting STARTF_USESHOWWINDOW on startupinfo when calling Popen() fixes the problem.

Thanks for your time.

JosephusPaye commented 5 years ago

Versions:

alanhamlett commented 5 years ago

Thanks for finding this and providing a solution! It's fixed with b39eefb4f570b0e0ec16942b7341689cc01d57ae and released in v8.2.0 just released.

JosephusPaye commented 5 years ago

Thanks!