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

Detect supported apps like Teams and Outlook #9

Open
dhufnagel opened this issue Aug 20, 2024 · 19 comments
Open

Detect supported apps like Teams and Outlook #9

dhufnagel opened this issue Aug 20, 2024 · 19 comments
Labels
bug Something isn't working

Comments

@dhufnagel
Copy link

I would suggest not to try to list all installed applications and filter them by the "supported" apps list. Instead, I would just show all supported applications in the list.

This is because the current way to retrieve the installed apps is not working reliably on my side and only gets installed apps with an uninstall entry in the registry. This does not capture Apps like the new Teams oder Outlook.

If the complete list is used instead and the app is determined based on the execName of the windowInfo, it is much simpler and more reliable. I tested it myself and will provide the code in a fork shortly. But I was not able to do a final build of the windows version, so I will first try and fix this.

@alanhamlett
Copy link
Member

I prefer fixing the installed app detection instead of listing all supported apps, since it's confusing when you see apps you don't know or don't have installed listed.

@dhufnagel
Copy link
Author

I searched for a reasonable method to receive all apps including the ones through the MS App Store but was not able to find one. Maybe you have mor luck. But I also like the Idea to be able to add custom apps which are not in the "supported" apps list. If I like to track how much time I spent on an internal business app, I would just like to pick the app and add it to the watched list.
This is not an argument against detecting installed apps, but against filterering them according to "supported" apps.

@dhufnagel
Copy link
Author

There may be also apps which are not installed and do not have a registry entry, so I do not know, how one will detect them through automatic "search".
Maybe just add all apps which are detected through the watchers change event to a list?

@alanhamlett alanhamlett changed the title Windows version suggestion Detect supported apps like Teams and Outlook Aug 20, 2024
@alanhamlett alanhamlett added the bug Something isn't working label Aug 20, 2024
@alanhamlett
Copy link
Member

We'll add more ways to detect apps instead of just the registry, to detect MS App Store apps. Then we'll allow adding any custom app by selecting the exe binary from a file dialog, or by typing the app's name into a text input.

@dhufnagel
Copy link
Author

dhufnagel commented Aug 20, 2024

So if you stay with your approach, let me say that this isn't working on my side either:
https://github.com/wakatime/desktop-wakatime/blob/39c9eef97050741750ccdfb7e96ee52018864aa0/electron/helpers/installed-apps/windows.ts#L104_L107
I get exceptions from winreg, that the QUERY fails. The key is in my registry, but it seems that the application is not allowed to access it, even in admin mode. This however works:
https://github.com/wakatime/desktop-wakatime/blob/39c9eef97050741750ccdfb7e96ee52018864aa0/electron/helpers/installed-apps/windows.ts#L100_L103

I use a windows 11 with node 21.1.0 and npm 10.5.0. (The build and package isn't working either, but this should be another Issue i guess).

@iam-rohid
Copy link
Contributor

iam-rohid commented Aug 20, 2024

I searched for a reasonable method to receive all apps including the ones through the MS App Store but was not able to find one. Maybe you have mor luck. But I also like the Idea to be able to add custom apps which are not in the "supported" apps list. If I like to track how much time I spent on an internal business app, I would just like to pick the app and add it to the watched list. This is not an argument against detecting installed apps, but against filterering them according to "supported" apps.

Listing all supported apps won't be a good UX. I've tried many different ways to get the apps installed through MS Store but couldn't find one. Windows app locations are a mess. We can add an option to add custom apps by providing a button that will open up a file explorer to locate the app's location. But then we might not have any control over that app as we don't know how should we extract the title, URL, category, or other properties from that custom app.

@iam-rohid
Copy link
Contributor

Also, If you use an app that is not on the list you can always file an issue and then we can add that to the list easily.

@dhufnagel
Copy link
Author

Well, i think wakatime will mostly be used by developers, so the UX of having all supported apps directly shown in a list without filtering installed apps on windows won'´t be to big of a deal, i guess.

The ability to add custom apps would be great and it may even be enough to know that you spent time in the app, without extracting more information from the title. Lets say you have internal tools and do not want them to be publicly available in a github repo ;-)

@iam-rohid
Copy link
Contributor

After adding the option to locate apps manually, I think there is no need to show all the supported apps without filtering by installed apps. As, showing all the supported apps still won't list the apps from MS Store or your local apps.

So having the current list and a new button to locate unsupported apps will be enough to cover all cases. What do you think?

@dhufnagel
Copy link
Author

Here is my proof of concept using the supported apps in the list:
main...dhufnagel:desktop-wakatime:poc-windows-show-apps

I had to change the detection of the app using the window.info.execName as i do not have the full path.

I don't know if it is possible to select all apps in a file picker, as I don't know if we get the right path or exe name for apps like Teams or Outlook.

@alanhamlett
Copy link
Member

alanhamlett commented Aug 20, 2024

Instead of a file dialog or text input for selecting custom apps to monitor, can we show a list of all running apps and allow selecting from one of those?

Then they just have to have the custom app running and it can be selected for monitoring.

@dhufnagel
Copy link
Author

This could be a good starting point. My first idea was to add apps as soon as they are detected by the watcher when they become active. For a quick start it was easier for me to just take the known apps.

But this also leads to other questions. Should apps be detected once or periodically? Is the list persistent and if so, should it be possible to delete Apps?

@iam-rohid
Copy link
Contributor

Instead of a file dialog or text input for selecting custom apps to monitor, can we show a list of all running apps and allow selecting from one of those?

Then they just have to have the custom app running and it can be selected for monitoring.

Yes, the window detection package has an option to list all the running apps.

@iam-rohid
Copy link
Contributor

We can show another list below the supported app list which will be the currently running apps list. Users can then enable or disable tracking from that list. This will be a great workaround.

@dhufnagel
Copy link
Author

The current lib offers the openWindows() function, but this only lists applications currently opened, not background applications.

@alanhamlett
Copy link
Member

this only lists applications currently opened, not background applications.

That's fine, we can't track focus/activity on background apps anyway. If the app has a window open then it can be tracked and will show up?

@alanhamlett
Copy link
Member

I just implemented this (showing running apps in Monitored Apps menu) for the Mac Desktop app:

wakatime/macos-wakatime#296

@iam-rohid
Copy link
Contributor

I have created a PR where all open windows will be listed which are not in the supported apps list and the app will be able to monitor them. #15
Screenshot 2024-08-22 at 9 02 41 PM

@dhufnagel
Copy link
Author

Thanks for the change. I think this is great!

But I still get the error log for the search of installed apps on windows regarding the registry key:

(node:3532) UnhandledPromiseRejectionWarning: ProcessUncleanExitError: QUERY command exited with code 1:
FEHLER: Der angegebene Registrierungsschl´┐¢ssel bzw. Wert wurde nicht gefunden.
at mkErrorMsg (C:\development\wakatime\desktop-wakatime\dist-electron\main-2DOuXK8K.js:15433:10)
at ChildProcess. (C:\development\wakatime\desktop-wakatime\dist-electron\main-2DOuXK8K.js:15550:11)
at ChildProcess.emit (node:events:514:28)
at maybeClose (node:internal/child_process:1105:16)
at Socket. (node:internal/child_process:457:11)
at Socket.emit (node:events:514:28)
at Pipe. (node:net:337:12)
(Use electron --trace-warnings ... to show where the warning was created)
(node:3532) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

So my istalled app list will alwys be empty.

Next point on the wishlist is to be able to set a category to the open apps 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants