♻️ refactor(dock/indicators): adapt RecordingIndicator layout based on dock position, update time label only in horizontal mode

This commit is contained in:
sankalp committed 2025-07-11 03:18:27 +05:45
1 parent 960ab05312
commit e26696ee72
1 file changed
+13 -1
+13 -1
View File
@@ -184,6 +184,16 @@ class RecordingIndicator(Button):
self.recording_label = Label(name="recording-label", markup=icons.screenrecord) self.recording_label = Label(name="recording-label", markup=icons.screenrecord)
self.time_label = Label(name="recording-time-label", markup="00:00") self.time_label = Label(name="recording-time-label", markup="00:00")
# Adapt layout based on dock position
if data.VERTICAL:
# Vertical dock: show only icon
self.recording_box = Box(
orientation="v",
spacing=2,
children=[self.recording_label]
)
else:
# Horizontal dock: place icon and time side by side
self.recording_box = Box( self.recording_box = Box(
orientation="h", orientation="h",
spacing=4, spacing=4,
@@ -218,9 +228,11 @@ class RecordingIndicator(Button):
elapsed_seconds = int(time.time() - self.recording_start_time) elapsed_seconds = int(time.time() - self.recording_start_time)
minutes = elapsed_seconds // 60 minutes = elapsed_seconds // 60
seconds = elapsed_seconds % 60 seconds = elapsed_seconds % 60
# Only update time label in horizontal mode
if not data.VERTICAL:
time_text = f"{minutes:02d}:{seconds:02d}" time_text = f"{minutes:02d}:{seconds:02d}"
self.time_label.set_markup(time_text) self.time_label.set_markup(time_text)
self.set_tooltip_text(f"Recording in progress ({time_text}) - Click to stop") self.set_tooltip_text(f"Recording in progress ({minutes:02d}:{seconds:02d}) - Click to stop")
else: else:
self.set_tooltip_text("Recording in progress - Click to stop") self.set_tooltip_text("Recording in progress - Click to stop")
else: else: