lablink_client_service.monitoring.samplers.active_window¶
lablink_client_service.monitoring.samplers.active_window
¶
Active-window sampler.
Polls xdotool getactivewindow getwindowname and buckets the title (which
we never store) into one of four buckets. Returns "other" when xdotool is
absent, the call fails, or no subject pattern is configured — degraded
behaviour, not a crash.
Attributes¶
BROWSER_PATS = ('firefox', 'chrome', 'chromium')
module-attribute
¶
TERMINAL_PATS = ('xterm', 'terminal', 'files', 'thunar')
module-attribute
¶
logger = logging.getLogger(__name__)
module-attribute
¶
Functions:¶
sample(subject_patterns)
¶
Return the bucket name for the currently focused window.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subject_patterns
|
Iterable[str]
|
lower-cased substrings that, when contained in the title, mark it as the tutorial app (e.g. ["sleap"], ["deeplabcut"]). An empty iterable disables subject matching entirely. |
required |
Returns:
| Type | Description |
|---|---|
str
|
One of "subject" / "terminal" / "browser" / "other". |