-
-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added "count-as-active" setting to always count some apps/title…
…s as active (#375) Co-authored-by: Erik Bjäreholt <erik@bjareho.lt>
- Loading branch information
1 parent
3361706
commit 40e6f25
Showing
8 changed files
with
101 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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