-
-
Notifications
You must be signed in to change notification settings - Fork 146
feat: added "count-as-active" setting to always count some apps/titles as active #375
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
Merged
ErikBjare
merged 7 commits into
ActivityWatch:master
from
ShootingKing-AM:feat-never-treat-as-afk
Oct 17, 2022
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f2cd0db
feat: Never treat apps or titles as afk
ShootingKing-AM f8c91f8
prettify code
ShootingKing-AM 1432a16
fix: queries unit test
ShootingKing-AM 63755e0
perf: remove unnecessary stringify and update unit test
ShootingKing-AM a1b27b8
refactor: simplify var name
ShootingKing-AM 4a9de96
added suggested modifications
ShootingKing-AM c71e434
fix: validation and misc improvements/fixes for always-count-as-active
ErikBjare File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| <template lang="pug"> | ||
| div | ||
| div.d-sm-flex.justify-content-between | ||
| div | ||
| h5.mb-2.mb-sm-0 Always count as active pattern | ||
|
|
||
| small | ||
| | Apps or titles matching this regular expression will never be counted as AFK. | ||
| | | ||
| | Can be used to count time as active, despite no input (like meetings, or games with controllers). An empty string disables it. | ||
| | | ||
| | Example expression: | ||
| code(style="background-color: rgba(200, 200, 200, 0.3); padding: 2px; border-radius: 2px;") | ||
| | Zoom Meeting|Google Meet|Microsoft Teams | ||
| div | ||
| b-form-input(size="sm" v-model="always_active_pattern") | ||
| small.text-right | ||
| div(v-if="enabled" style="color: #0A0") Enabled | ||
| div(v-else, style="color: gray") Disabled | ||
| div(v-if="enabled && broad_pattern" style="color: #A00") Pattern too broad | ||
|
|
||
| </template> | ||
|
|
||
| <script> | ||
| import { useSettingsStore } from '~/stores/settings'; | ||
|
|
||
| export default { | ||
| name: 'ActivePatternSettings', | ||
| data() { | ||
| return { | ||
| settingsStore: useSettingsStore(), | ||
| }; | ||
| }, | ||
| computed: { | ||
| enabled: function () { | ||
| return this.settingsStore.always_active_pattern != ''; | ||
| }, | ||
| broad_pattern: function () { | ||
| // Check if the pattern matches random strings that we don't expect it to | ||
| // like the alphabet | ||
| const pattern = this.settingsStore.always_active_pattern; | ||
| if (pattern == '') { | ||
| return false; | ||
| } | ||
| const re = new RegExp(pattern); | ||
| const alphabet = 'abcdefghijklmnopqrstuvwxyz'; | ||
| const numbers = '0123456789'; | ||
| return re.test( | ||
| 'THIS STRING SHOULD PROBABLY NOT MATCH: ' + alphabet + alphabet.toUpperCase() + numbers | ||
| ); | ||
| }, | ||
| always_active_pattern: { | ||
| get() { | ||
| return this.settingsStore.always_active_pattern; | ||
| }, | ||
| set(value) { | ||
| if (value.trim().length != 0 || this.settingsStore.always_active_pattern.length != 0) { | ||
| console.log('Setting always_active_pattern to ' + value); | ||
| this.settingsStore.update({ always_active_pattern: value }); | ||
| } | ||
| }, | ||
| }, | ||
| }, | ||
| }; | ||
| </script> |
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
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.