@@ -45,7 +45,7 @@ PluginComponent {
4545 property bool isMicCaptured: false
4646 property bool isMicMuted: false
4747 property int recordingElapsed: 0
48- property int recordingPid : 0
48+ property var recordingProcess : null
4949 property bool showRecPill: (pluginData && pluginData .showRecPill !== undefined ) ? pluginData .showRecPill : true
5050 property bool showNotify: (pluginData && pluginData .showNotify !== undefined ) ? pluginData .showNotify : true
5151 property bool enableEditorShortcut: (pluginData && pluginData .enableEditorShortcut != null ) ? pluginData .enableEditorShortcut : true
@@ -540,6 +540,22 @@ PluginComponent {
540540 " else " +
541541 " start_rec; exec gpu-screen-recorder -w portal" + gsrSuffix + " ; " +
542542 " fi" ;
543+ } else if (root .captureMode === " all" ) {
544+ scriptBody = " sleep 0.2; mkdir -p \" " + dir + " \" ; " +
545+ " HAS_PORTAL=\"\" ; " +
546+ " if command -v dbus-send >/dev/null 2>&1; then " +
547+ " dbus-send --dest=org.freedesktop.portal.Desktop --print-reply /org/freedesktop/portal/desktop org.freedesktop.DBus.Introspectable.Introspect 2>/dev/null | grep -q \" org.freedesktop.portal.ScreenCast\" && HAS_PORTAL=\" 1\" ; " +
548+ " elif command -v busctl >/dev/null 2>&1; then " +
549+ " busctl introspect org.freedesktop.portal.Desktop /org/freedesktop/portal/desktop 2>/dev/null | grep -q \" org.freedesktop.portal.ScreenCast\" && HAS_PORTAL=\" 1\" ; " +
550+ " fi; " +
551+ " if [ -n \" $HAS_PORTAL\" ] && { [ \" $XDG_SESSION_TYPE\" = \" wayland\" ] || [ -n \" $WAYLAND_DISPLAY\" ]; }; then " +
552+ " exec gpu-screen-recorder -w portal" + gsrSuffix + " ; " +
553+ " elif [ \" $XDG_SESSION_TYPE\" = \" wayland\" ] || [ -n \" $WAYLAND_DISPLAY\" ]; then " +
554+ " notify-send \" Multi-Monitor Recording\" \" Recording focused screen. Install a desktop portal (e.g. xdg-desktop-portal-niri) to record all screens on Wayland.\" -t 5000; " +
555+ " exec gpu-screen-recorder -w \" $MONITOR\" " + gsrSuffix + " ; " +
556+ " else " +
557+ " exec gpu-screen-recorder -w screen" + gsrSuffix + " ; " +
558+ " fi" ;
543559 } else {
544560 scriptBody = " sleep 0.2; mkdir -p \" " + dir + " \" ; exec gpu-screen-recorder -w \" $MONITOR\" " + gsrSuffix;
545561 }
@@ -554,48 +570,34 @@ PluginComponent {
554570 }
555571 root .close ();
556572
557- recorderProcess .command = [" bash" , " -c" , finalCmd];
558- recorderProcess .running = true ;
573+ Quickshell .execDetached ([" bash" , " -c" , finalCmd]);
559574
560575 if (root .showNotify && ! deferRecordingUi) {
561576 Quickshell .execDetached ([" notify-send" , " Recording Started" , " Saving to " + dir]);
562577 }
563578 }
564579
565580 function stopRecording () {
566- if (root .recordingPid > 0 ) {
567- Quickshell .execDetached ([" kill" , " -SIGINT" , String (root .recordingPid )]);
568- } else {
569- Quickshell .execDetached ([" pkill" , " -SIGINT" , " -f" , " gpu-screen-recorder" ]);
570- }
581+ Quickshell .execDetached ([" pkill" , " -SIGINT" , " -f" , " gpu-screen-recorder" ]);
571582 Quickshell .execDetached ([" pactl" , " set-source-mute" , " @DEFAULT_SOURCE@" , " 0" ]);
572583 root .isRecording = false ;
573584 root .isPaused = false ;
574585 root .isMicCaptured = false ;
575586 root .isMicMuted = false ;
576587 root .recordingElapsed = 0 ;
577- root .recordingPid = 0 ;
578588
579589 if (root .showNotify ) {
580590 Quickshell .execDetached ([" notify-send" , " Recording Stopped" , " Video saved to " + (root .videoCustomPath || " ~/Videos" )]);
581591 }
582592 }
583593
584594 function pauseRecording () {
585- if (root .recordingPid > 0 ) {
586- Quickshell .execDetached ([" kill" , " -SIGUSR2" , String (root .recordingPid )]);
587- } else {
588- Quickshell .execDetached ([" pkill" , " -SIGUSR2" , " -f" , " gpu-screen-recorder" ]);
589- }
595+ Quickshell .execDetached ([" pkill" , " -SIGUSR2" , " -f" , " gpu-screen-recorder" ]);
590596 root .isPaused = true ;
591597 }
592598
593599 function resumeRecording () {
594- if (root .recordingPid > 0 ) {
595- Quickshell .execDetached ([" kill" , " -SIGUSR2" , String (root .recordingPid )]);
596- } else {
597- Quickshell .execDetached ([" pkill" , " -SIGUSR2" , " -f" , " gpu-screen-recorder" ]);
598- }
600+ Quickshell .execDetached ([" pkill" , " -SIGUSR2" , " -f" , " gpu-screen-recorder" ]);
599601 root .isPaused = false ;
600602 }
601603
@@ -607,23 +609,6 @@ PluginComponent {
607609 return (m < 10 ? " 0" : " " ) + m + " :" + (s < 10 ? " 0" : " " ) + s;
608610 }
609611
610- Process {
611- id: recorderProcess
612- command: []
613- running: false
614- onStarted: {
615- root .recordingPid = processId;
616- }
617- onExited : exitCode => {
618- root .isRecording = false ;
619- root .isPaused = false ;
620- root .isMicCaptured = false ;
621- root .isMicMuted = false ;
622- root .recordingElapsed = 0 ;
623- root .recordingPid = 0 ;
624- }
625- }
626-
627612 // Recording elapsed timer
628613 Timer {
629614 id: recordingTimer
0 commit comments