🐛 fix(panel): correctly detect screen recording processes and show recording indicator

This commit is contained in:
sankalp committed 2025-08-04 06:17:00 +05:45
1 parent d7d95af306
commit 092d254266
2 files changed
+17 -9

No files matched your search

+3 -1
View File
@@ -318,7 +318,9 @@ class Player(Box):
f"https://img.youtube.com/vi/{video_id}/hqdefault.jpg" f"https://img.youtube.com/vi/{video_id}/hqdefault.jpg"
) )
logger.debug( logger.debug(
f"Found YouTube thumbnail for {player_name}: {new_thumbnail}" f"Found YouTube thumbnail for {player_name}: {
new_thumbnail
}"
) )
# Only update if thumbnail has changed # Only update if thumbnail has changed
@@ -12,7 +12,7 @@ from gi.repository import GLib
class RecordingIndicator(Button): class RecordingIndicator(Button):
def __init__(self, **kwargs): def __init__(self, **kwargs):
super().__init__(name="panel-button", visible=False, **kwargs) super().__init__(name="panel-button", visible=True, **kwargs)
self.script_path = get_relative_path("../../../scripts/screen-capture.sh") self.script_path = get_relative_path("../../../scripts/screen-capture.sh")
self.recording_start_time = None self.recording_start_time = None
@@ -58,14 +58,20 @@ class RecordingIndicator(Button):
return False return False
def is_recorder_running(self): def is_recorder_running(self):
# add more process names if needed
recorder_processes = ["wf-recorder", "gpu-screen-recorder"]
try: try:
result = subprocess.run( for proc in recorder_processes:
["pgrep", "-x", "wf-recorder", "-x", "gpu-screen-recorder"], result = subprocess.run(
capture_output=True, ["pgrep", "-x", proc],
text=True, capture_output=True,
timeout=1, text=True,
) timeout=1,
return result.returncode == 0 )
if result.returncode == 0:
return True # Found a running recorder process
return False # None found running
except Exception: except Exception:
return False return False