refactor: enhance TimerPage layout and functionality; update theme and tokens for improved design consistency
- Refactored TimerPage component to improve layout and user experience. - Updated theme configuration to utilize design tokens for better maintainability. - Introduced new tokens for colors and typography to align with design principles. - Simplified state management and improved timer functionality. - Enhanced accessibility and responsiveness of UI elements.
This commit is contained in:
84 files changed
+4501
-2682
No files matched your search
@@ -5,9 +5,11 @@ the cmdline, matches against the configured names, and either terminates the
|
||||
process (SIGTERM, then SIGKILL if it ignores us) or just reports it, depending
|
||||
on the setting.
|
||||
|
||||
Matching is deliberately forgiving — `steam` should catch `steamwebhelper`, and
|
||||
`telegram` should catch `Telegram` — but it never matches ourselves, PID 1, or
|
||||
anything outside the current user's processes.
|
||||
Matching is deliberately forgiving — `steam` catches `steamwebhelper`, and
|
||||
`telegram` catches `Telegram` — and an entry containing `*` or `?` is treated as
|
||||
a glob (`steam*`, `*discord*`, `telegram-?`), matched against both the process
|
||||
name and its command line. It never matches ourselves, PID 1, or anything
|
||||
outside the current user's processes.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -16,6 +18,7 @@ import logging
|
||||
import os
|
||||
import signal
|
||||
import time
|
||||
from fnmatch import fnmatch
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
@@ -24,6 +27,21 @@ log = logging.getLogger(__name__)
|
||||
_SELF_MARKERS = ("kadence", "python3 -m kadence_desktop")
|
||||
|
||||
|
||||
def matches(pattern: str, name: str, cmdline: str) -> bool:
|
||||
"""Whether one block-list entry matches a process.
|
||||
|
||||
A mask is anchored to the process *name* (so `steam*` does not match every
|
||||
command that merely mentions steam) but also tried against the whole command
|
||||
line, which is how `*discord*` catches an Electron app launched by path.
|
||||
"""
|
||||
pattern = pattern.strip().lower()
|
||||
if not pattern:
|
||||
return False
|
||||
if any(char in pattern for char in "*?["):
|
||||
return fnmatch(name, pattern) or fnmatch(cmdline, pattern)
|
||||
return pattern in name or pattern in cmdline
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
class RunningApp:
|
||||
pid: int
|
||||
@@ -65,11 +83,11 @@ def scan(patterns: list[str]) -> list[RunningApp]:
|
||||
if not comm:
|
||||
continue
|
||||
cmdline = _read(entry / "cmdline").replace("\x00", " ").strip()
|
||||
haystack = f"{comm} {cmdline}".lower()
|
||||
if any(marker in haystack for marker in _SELF_MARKERS):
|
||||
name, command = comm.lower(), cmdline.lower()
|
||||
if any(marker in f"{name} {command}" for marker in _SELF_MARKERS):
|
||||
continue
|
||||
|
||||
match = next((pattern for pattern in wanted if pattern in haystack), None)
|
||||
match = next((pattern for pattern in wanted if matches(pattern, name, command)), None)
|
||||
if match:
|
||||
found.append(RunningApp(pid=pid, name=comm, cmdline=cmdline[:200], matched=match))
|
||||
return found
|
||||
|
||||
Reference in new issue
Block a user