mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-15 02:50:57 +01:00
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
file length / file-length (push) Waiting to run
gatelock pre-commit / pre-commit (push) Waiting to run
gatelock tests / test (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
palette drift / palette (push) Waiting to run
shared gate tests / gate unit tests (push) Waiting to run
leetcode-guard's study mode has to stop the re-assertion loop and the output-change watcher before it releases the grab, and could only reach them as LockWindow._recovery / _detector -- attributes 0.8.0 folded into the arming bundle, which broke that documented private dependency. They are public read-only properties now, next to `surfaces`. _window no longer re-exports the LockConfig family; it was the one thing keeping it over the 250-line cap, and every importer now takes those names from gatelock._config (or the package) directly. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HHCbkJWXHjtTUaqvnHRAqA
139 lines
3.4 KiB
Python
139 lines
3.4 KiB
Python
# Copyright (c) 2026 Krzysztof Rudnicki
|
|
"""Shared lock-window and HMAC log-integrity backend for blocking-overlay apps.
|
|
|
|
Used by ``screen-locker``, ``diet-guard`` and ``wake-alarm``, which all need
|
|
the same thing: cover every monitor the user can actually see, take the input
|
|
grab, and stay up until their own condition is met.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from gatelock._arbiter import (
|
|
RANK_DIET_GUARD,
|
|
RANK_SCREEN_LOCKER,
|
|
RANK_WAKE_ALARM,
|
|
Arbiter,
|
|
)
|
|
from gatelock._claims import ArbiterVerdict, Claim, default_runtime_dir, grab_strength
|
|
from gatelock._config import GrabPolicy, LockConfig, SpaceStep, TypeRole
|
|
from gatelock._detect import OutputChangeDetector
|
|
from gatelock._escape import (
|
|
EscapeDraft,
|
|
EscapeHistory,
|
|
EscapePolicy,
|
|
EscapeTracker,
|
|
)
|
|
from gatelock._fitcheck import FitResult, measure_fit, report_fit
|
|
from gatelock._guards import assert_not_under_pytest, wait_for_x_server
|
|
from gatelock._hooks import LockWindowHooks
|
|
from gatelock._keyboard import bind_activate, bind_cancel, escape_text_tab_trap
|
|
from gatelock._outputs import (
|
|
Output,
|
|
OutputEnumerator,
|
|
OutputRect,
|
|
OutputScan,
|
|
enumerate_outputs,
|
|
)
|
|
from gatelock._queue import (
|
|
QUEUE_DEADLINE_SECONDS,
|
|
QUEUE_HEARTBEAT_SECONDS,
|
|
QUEUE_POLL_SECONDS,
|
|
QueueResult,
|
|
Timebase,
|
|
stronger_claims,
|
|
wait_for_turn,
|
|
)
|
|
from gatelock._randr import RandrBackend
|
|
from gatelock._recovery import RecoveryLoop, RecoveryReport
|
|
from gatelock._root import GateRoot
|
|
from gatelock._scrollable import ScrollableSurface
|
|
from gatelock._surfaces import (
|
|
SurfaceBuilder,
|
|
SurfaceDelta,
|
|
SurfaceInfo,
|
|
SurfaceSet,
|
|
mirror_text_widgets,
|
|
needs_backdrop_root,
|
|
)
|
|
from gatelock._theme import LockPalette, LockSpacing, LockTypography
|
|
from gatelock._vt import disable_vt_switching, restore_vt_switching
|
|
from gatelock._window import LockWindow
|
|
from gatelock._xrandr import parse_xrandr_query
|
|
from gatelock.widget_group import WidgetGroup
|
|
from gatelock.widgets import (
|
|
DEFAULT_WRAP,
|
|
ButtonStyle,
|
|
ButtonVariant,
|
|
RowStyle,
|
|
heading,
|
|
make_button,
|
|
row,
|
|
)
|
|
|
|
__all__ = [
|
|
"DEFAULT_WRAP",
|
|
"QUEUE_DEADLINE_SECONDS",
|
|
"QUEUE_HEARTBEAT_SECONDS",
|
|
"QUEUE_POLL_SECONDS",
|
|
"RANK_DIET_GUARD",
|
|
"RANK_SCREEN_LOCKER",
|
|
"RANK_WAKE_ALARM",
|
|
"Arbiter",
|
|
"ArbiterVerdict",
|
|
"ButtonStyle",
|
|
"ButtonVariant",
|
|
"Claim",
|
|
"EscapeDraft",
|
|
"EscapeHistory",
|
|
"EscapePolicy",
|
|
"EscapeTracker",
|
|
"FitResult",
|
|
"GateRoot",
|
|
"GrabPolicy",
|
|
"LockConfig",
|
|
"LockPalette",
|
|
"LockSpacing",
|
|
"LockTypography",
|
|
"LockWindow",
|
|
"LockWindowHooks",
|
|
"Output",
|
|
"OutputChangeDetector",
|
|
"OutputEnumerator",
|
|
"OutputRect",
|
|
"OutputScan",
|
|
"QueueResult",
|
|
"RandrBackend",
|
|
"RecoveryLoop",
|
|
"RecoveryReport",
|
|
"RowStyle",
|
|
"ScrollableSurface",
|
|
"SpaceStep",
|
|
"SurfaceBuilder",
|
|
"SurfaceDelta",
|
|
"SurfaceInfo",
|
|
"SurfaceSet",
|
|
"Timebase",
|
|
"TypeRole",
|
|
"WidgetGroup",
|
|
"assert_not_under_pytest",
|
|
"bind_activate",
|
|
"bind_cancel",
|
|
"default_runtime_dir",
|
|
"disable_vt_switching",
|
|
"enumerate_outputs",
|
|
"escape_text_tab_trap",
|
|
"grab_strength",
|
|
"heading",
|
|
"make_button",
|
|
"measure_fit",
|
|
"mirror_text_widgets",
|
|
"needs_backdrop_root",
|
|
"parse_xrandr_query",
|
|
"report_fit",
|
|
"restore_vt_switching",
|
|
"row",
|
|
"stronger_claims",
|
|
"wait_for_turn",
|
|
"wait_for_x_server",
|
|
]
|