style: simplify section comments to plain # style in notch.py and keyboard_layout.py
This commit is contained in:
2 files changed
+12
-12
No files matched your search
@@ -47,7 +47,7 @@ class KeyboardLayout(Service):
|
||||
self._connect_hyprland_events()
|
||||
on_config_change(self._on_config_change)
|
||||
|
||||
# ── hyprctl wrapper ────────────────────────────────────────────────────────
|
||||
# hyprctl wrapper
|
||||
|
||||
def _hyprctl(self, *args, on_reply=None):
|
||||
"""Execute a hyprctl command via Gio.Subprocess.
|
||||
@@ -78,7 +78,7 @@ class KeyboardLayout(Service):
|
||||
|
||||
proc.communicate_utf8_async(None, None, on_done)
|
||||
|
||||
# ── initialization ─────────────────────────────────────────────────────────
|
||||
# initialization
|
||||
|
||||
def _init_layout_config(self):
|
||||
self._layouts = self._load_layouts_from_config()
|
||||
@@ -99,7 +99,7 @@ class KeyboardLayout(Service):
|
||||
return list(DEFAULT_LAYOUTS)
|
||||
return [str(layout).strip() for layout in layouts if str(layout).strip()]
|
||||
|
||||
# ── Hyprland synchronization ───────────────────────────────────────────────
|
||||
# Hyprland synchronization
|
||||
|
||||
def _sync_from_hyprland(self):
|
||||
"""Query Hyprland for the current layout and update in-memory state.
|
||||
@@ -151,7 +151,7 @@ class KeyboardLayout(Service):
|
||||
def _on_hyprland_layout_event(self, _hyprland, _event):
|
||||
self._sync_from_hyprland()
|
||||
|
||||
# ── state management ───────────────────────────────────────────────────────
|
||||
# state management
|
||||
|
||||
def _set_current(self, index: int, emit: bool) -> bool:
|
||||
if not self._layouts:
|
||||
@@ -171,7 +171,7 @@ class KeyboardLayout(Service):
|
||||
self.emit("layout_changed", layout)
|
||||
return True
|
||||
|
||||
# ── Hyprland writes ────────────────────────────────────────────────────────
|
||||
# Hyprland writes
|
||||
|
||||
def _apply_layouts_to_hyprland(self):
|
||||
if not self._layouts:
|
||||
@@ -180,7 +180,7 @@ class KeyboardLayout(Service):
|
||||
lua_eval_cmd = f"hl.config({{ input = {{ kb_layout = '{layouts_str}' }} }})"
|
||||
self._hyprctl("eval", lua_eval_cmd)
|
||||
|
||||
# ── public API ─────────────────────────────────────────────────────────────
|
||||
# public API
|
||||
|
||||
def switch_to_next(self) -> bool:
|
||||
if not self._layouts:
|
||||
@@ -196,7 +196,7 @@ class KeyboardLayout(Service):
|
||||
def switch_keyboard_layout():
|
||||
KeyboardLayout.get_initial().switch_to_next()
|
||||
|
||||
# ── config changes ─────────────────────────────────────────────────────────
|
||||
# config changes
|
||||
|
||||
def _on_config_change(self, new_config, old_config):
|
||||
new_layouts = new_config.get("keyboard_layouts")
|
||||
@@ -220,7 +220,7 @@ class KeyboardLayout(Service):
|
||||
|
||||
logger.info(f"[KeyboardLayout] Layouts updated from config: {self._layouts}")
|
||||
|
||||
# ── properties ─────────────────────────────────────────────────────────────
|
||||
# properties
|
||||
|
||||
@Property(str, "readable", default_value="")
|
||||
def current_layout(self) -> str:
|
||||
|
||||
@@ -140,7 +140,7 @@ class Notch(Box):
|
||||
|
||||
self.notch_stack.connect("scroll-event", self._on_scroll)
|
||||
|
||||
# ── Transient indicator show / hide ──────────────────────────────────────
|
||||
# Transient indicator show / hide
|
||||
|
||||
def _show_transient(self, widget):
|
||||
"""Make a transient indicator the visible notch page."""
|
||||
@@ -153,7 +153,7 @@ class Notch(Box):
|
||||
self._transient_active = False
|
||||
self._apply_stack_state()
|
||||
|
||||
# ── Init / MPRIS / recording ──────────────────────────────────────────────
|
||||
# Init / MPRIS / recording
|
||||
|
||||
def _init_state(self):
|
||||
self._is_active_recording = screen_recorder_service.recording
|
||||
@@ -198,7 +198,7 @@ class Notch(Box):
|
||||
)
|
||||
self._apply_stack_state()
|
||||
|
||||
# ── Scroll ────────────────────────────────────────────────────────────────
|
||||
# Scroll
|
||||
|
||||
def _on_scroll(self, widget, event):
|
||||
now = GLib.get_monotonic_time()
|
||||
@@ -229,7 +229,7 @@ class Notch(Box):
|
||||
self._apply_stack_state()
|
||||
return True
|
||||
|
||||
# ── Stack state ───────────────────────────────────────────────────────────
|
||||
# Stack state
|
||||
|
||||
def _apply_stack_state(self):
|
||||
# Don't override a transient indicator that is still counting down
|
||||
|
||||
Reference in new issue
Block a user