fix(manager): detect .bat and .cmd executables and strip extensions on Windows#126
Merged
ErikBjare merged 3 commits intoActivityWatch:masterfrom Mar 16, 2026
Conversation
Contributor
Greptile SummaryThis PR fixes Windows module discovery by recognizing
The new Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Discover modules in directory] --> B{Is file?}
B -->|No| C[Skip or recurse into subdirectory]
B -->|Yes| D{is_executable?}
D -->|No| E[Log warning: not executable]
D -->|Yes| F[_filename_to_name]
F --> G{Windows?}
G -->|Yes| H{Extension?}
H -->|.exe| I[Strip .exe]
H -->|.bat| J[Strip .bat]
H -->|.cmd| K[Strip .cmd]
H -->|Other| L[Return filename as-is]
G -->|No| L
I --> M[Create Module with clean name]
J --> M
K --> M
L --> M
M --> N[Add to modules list]
Last reviewed commit: db7c37e |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes/completes #81.
Changes
is_executable()— adds.batand.cmdas recognised executable extensions on Windows (original commit from fix: detect .bat and .cmd executables on Windows #81)._filename_to_name()— also strips.bat/.cmdextensions so discovered modules get the right names (aw-servernotaw-server.cmd). Without this, autostart matching, module exclusion, and start-by-name lookups would all break. This was the remaining bug flagged by Greptile in fix: detect .bat and .cmd executables on Windows #81.Why a new PR
The branch on the ActivityWatch org (
dev/detect-bat-cmd-windows-exes) is Erik's and I don't have push access, so the fix is on my fork instead. Supersedes #81.Testing
Manual verification that
_filename_to_namenow returns the correct name for all three Windows launcher extensions: