feat(root): implement dynamic todo list refresh and UI enhancements
This change adds a mechanism to refresh the todo list dynamically when the underlying service updates, improving UI responsiveness and user experience. It also updates documentation and removes deprecated files. - New Features: - Added `_refresh_todos` method to rebuild the todo list when `get_todo_service().todos` changes. - Introduced `TodoListCapture` class for mouse capture handling of the todo list window. - Enhancements: - Updated README with corrected image paths, installation tips, and manual installation commands. - Introduced `start.py` to launch the application or lock mode. - Removed deprecated `config.json` and `debug_memory.py`. - Bug Fixes: - Fixed lock screen screenshot path in README.
This commit is contained in:
267 files changed
+24582
-394
No files matched your search
@@ -0,0 +1,102 @@
|
||||
"""
|
||||
Hyprland Game Mode Toggle Script
|
||||
|
||||
This script toggles game mode in Hyprland by disabling/enabling animations
|
||||
and other visual effects for better performance during gaming.
|
||||
|
||||
Uses a marker file in /tmp to track state.
|
||||
"""
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
from datetime import datetime
|
||||
from typing import Literal
|
||||
|
||||
from utils.functions import read_json_file, write_json_file
|
||||
|
||||
STATE_FILE = "/tmp/hyprland_gamemode"
|
||||
|
||||
|
||||
def run_hyprctl(command: str) -> str:
|
||||
"""Run a hyprctl command and return the output (raises on error)."""
|
||||
result = subprocess.run(
|
||||
["hyprctl"] + command.split(), capture_output=True, text=True, check=True
|
||||
)
|
||||
return result.stdout.strip()
|
||||
|
||||
|
||||
def check_gamemode() -> Literal["t", "f"]:
|
||||
"""Check if game mode is active."""
|
||||
state = read_json_file(STATE_FILE)
|
||||
return "t" if state and state.get("enabled") else "f"
|
||||
|
||||
|
||||
def enable_gamemode():
|
||||
"""Enable game mode by disabling visual effects."""
|
||||
batch_commands = [
|
||||
"keyword animations:enabled 0",
|
||||
"keyword decoration:shadow:enabled 0",
|
||||
"keyword decoration:blur:enabled 0",
|
||||
"keyword general:gaps_in 0",
|
||||
"keyword general:gaps_out 0",
|
||||
"keyword general:border_size 1",
|
||||
"keyword decoration:rounding 0",
|
||||
]
|
||||
run_hyprctl(f'--batch "{"; ".join(batch_commands)}"')
|
||||
|
||||
state = {
|
||||
"enabled": True,
|
||||
"last_toggled": datetime.now().isoformat(timespec="seconds"),
|
||||
}
|
||||
write_json_file(state, STATE_FILE)
|
||||
print("Game mode enabled - visual effects disabled for better performance")
|
||||
|
||||
|
||||
def disable_gamemode():
|
||||
"""Disable game mode by reloading Hyprland configuration."""
|
||||
run_hyprctl("reload")
|
||||
|
||||
state = {
|
||||
"enabled": False,
|
||||
"last_toggled": datetime.now().isoformat(timespec="seconds"),
|
||||
}
|
||||
write_json_file(state, STATE_FILE)
|
||||
print("Game mode disabled - visual effects restored")
|
||||
|
||||
|
||||
def toggle_gamemode():
|
||||
"""Toggle game mode state using JSON file."""
|
||||
state = read_json_file(STATE_FILE) or {}
|
||||
if state.get("enabled"):
|
||||
disable_gamemode()
|
||||
else:
|
||||
enable_gamemode()
|
||||
|
||||
|
||||
def print_usage():
|
||||
print("Usage:")
|
||||
print(" gamemode check - Check if game mode is active (t/f)")
|
||||
print(" gamemode toggle - Toggle game mode")
|
||||
|
||||
|
||||
def main():
|
||||
if len(sys.argv) < 2:
|
||||
toggle_gamemode()
|
||||
return
|
||||
|
||||
command = sys.argv[1].lower()
|
||||
|
||||
if command == "check":
|
||||
print(check_gamemode())
|
||||
elif command == "toggle":
|
||||
toggle_gamemode()
|
||||
elif command in ["help", "-h", "--help"]:
|
||||
print_usage()
|
||||
else:
|
||||
print(f"Unknown command: {command}", file=sys.stderr)
|
||||
print_usage()
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in new issue
Block a user