]> git.scottworley.com Git - srec/commitdiff
Make GUI control for webcam sharing
authorScott Worley <scottworley@scottworley.com>
Wed, 1 Oct 2025 03:35:32 +0000 (20:35 -0700)
committerScott Worley <scottworley@scottworley.com>
Wed, 1 Oct 2025 03:35:32 +0000 (20:35 -0700)
(It doesn't do anything yet)

srec.py

diff --git a/srec.py b/srec.py
index 7780e511e4b423afa0fe7adaaabfdf11ab88af18..4a9d5b95fdbb96ee39ed1cd207d10509aab60ed4 100644 (file)
--- a/srec.py
+++ b/srec.py
@@ -75,6 +75,14 @@ def make_button(label: str, action: Callable[[
     return button
 
 
+def make_share_control() -> Gtk.CheckButton:
+    can_share = os.path.exists('/sys/module/v4l2looback')
+    control = Gtk.CheckButton(
+        label='Share Webcam', sensitive=can_share, active=can_share)
+    control.set_margin_start(20)
+    return control
+
+
 def on_activate(app: Gtk.Application) -> None:
     win = Gtk.ApplicationWindow(application=app)
     win.set_title('SRec')
@@ -87,6 +95,7 @@ def on_activate(app: Gtk.Application) -> None:
     screen = Gtk.CheckButton(label='Screen')
     nr_box.append(screen)
     nr_box.append(Gtk.CheckButton(label='Webcam', active=True, group=screen))
+    nr_box.append(make_share_control())
     nr_box.append(make_button("Start Recording", on_start_recording, stack))
     stack.add_named(nr_box, "not_recording")