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

Running CMD windows silently #212

Closed
aaronmaynard opened this Issue Jul 24, 2018 · 11 comments

Comments

Projects
None yet
5 participants
@aaronmaynard
Copy link

aaronmaynard commented Jul 24, 2018

Runs great, however there are three windows that will stay open on launch.

  • aw-watcher-afk.exe
  • aw-watcher-window.exe
  • aw-server.exe

For those with cluttered task bars, this may become an issue. This windows cannot be closed of course because then the application will fail.

Currently running Windows 10 with Activity Watch v0.8.0b5

@thetemplar

This comment has been minimized.

Copy link

thetemplar commented Aug 22, 2018

I have the same problem, is there a solution?

@ErikBjare

This comment has been minimized.

Copy link
Member

ErikBjare commented Aug 22, 2018

Woah, that's a lot of people that have +1'd!

Unfortunately I don't have a Windows machine available at the moment (my Windows installation broke a few weeks ago 😢), but if anyone wants to try and create a fix I can give some pointers (provided you've been able to build activitywatch on Windows already).

@ErikBjare

This comment has been minimized.

Copy link
Member

ErikBjare commented Aug 22, 2018

I just tried to run v0.8.0b5 in Wine (which worked great, apart from ActivityWatch/aw-watcher-window#35) but to my surprise that didn't open separate console windows.

I tried to download a Windows VM from this link: https://developer.microsoft.com/en-us/windows/downloads/virtual-machines

But, to my utter surprise, the download buttons do nothing. Am I just stupid or do they actually not work? (tried in Chrome and Firefox) Someone please tell me I'm not the only one.

@Otto-AA

This comment has been minimized.

Copy link

Otto-AA commented Aug 22, 2018

The buttons seem not to work, but the links in the source code seem fine:

<button class="c-action-trigger c-glyph glyph-download f-heavyweight x-hidden-focus" role="button" href="//aka.ms/windev_VM_vmware">VMWare</button>&nbsp;&nbsp;
<button class="c-action-trigger c-glyph glyph-download f-heavyweight" role="button" href="//aka.ms/windev_VM_hyperv">Hyper-V</button>&nbsp;&nbsp;
<button class="c-action-trigger c-glyph glyph-download f-heavyweight" role="button" href="//aka.ms/windev_VM_virtualbox">VirtualBox</button>&nbsp;&nbsp;
<button class="c-action-trigger c-glyph glyph-download f-heavyweight" role="button" href="//aka.ms/windev_VM_parallels">Parallels</button>
@aaronmaynard

This comment has been minimized.

Copy link

aaronmaynard commented Aug 26, 2018

Temporary Solution

With Windows there are a few ways to run programs as a background process. This can be done by creating two files.

hiddenServices.vbs

Dim WShell
Set WShell = CreateObject("WScript.Shell")
WShell.Run """" & "aw-server.exe" & """", 0 
WShell.Run """" & "aw-watcher-afk.exe" & """", 0
WShell.Run """" & "aw-watcher-window.exe" & """", 0
'WShell.Run """" & "aw-qt.exe" & """", 0 Children still open
Set WShell = Nothing

Since All modern Windows versions have VBScript support, this is pretty much guaranteed to work.

runAsProcess.bat

wscript "hiddenServices.vbs"

This second file is really optional if you want to start the services hidden from a icon rather than through the command line. Either one you choose, you can also do so during startup. I would recommend through the Task Scheduler; run the batch file at login. The only issue with this is that there is no icon for the service module, so to close ActivityWatch the user needs to use task manager.

Food for thought

Currently aw-qt.exe does not check if the services are running already, though could this be changed to allow users to still utilize the manager? This would not only solve the temporary solutions problem, but also fix something that may need to be done already.

@ErikBjare

This comment has been minimized.

Copy link
Member

ErikBjare commented Aug 27, 2018

I've been looking into how to do this the proper way.

Here's a detailed answer about what can go wrong: https://stackoverflow.com/questions/24455337/pyinstaller-on-windows-with-noconsole-simply-wont-work

Options

@ErikBjare

This comment has been minimized.

Copy link
Member

ErikBjare commented Aug 27, 2018

Okay, so I might have fixed it in ActivityWatch/aw-qt#39. I'm going to do some more testing to make sure it doesn't break stuff and then I'll make a release for v0.8.0b6 which will include the change.

@ErikBjare

This comment has been minimized.

Copy link
Member

ErikBjare commented Aug 27, 2018

Try the v0.8.0b6 release and let me know if it works!

https://github.com/ActivityWatch/activitywatch/releases/tag/v0.8.0b6

@ErikBjare

This comment has been minimized.

Copy link
Member

ErikBjare commented Aug 27, 2018

I've confirmed in my VM that v0.8.0b6 solves the problem! Thank you everyone for you patience 🎉 🎉 🎉

@dclar43

This comment has been minimized.

Copy link

dclar43 commented Aug 27, 2018

Working on my end: Windows 10

@aaronmaynard

This comment has been minimized.

Copy link

aaronmaynard commented Aug 28, 2018

Same, bravo! Win10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment