@@ -63,6 +63,7 @@ PluginComponent {
6363 property real recPillDragStartPillX: 0
6464 property real recPillDragStartPillY: 0
6565 property bool recPillDragStarted: false
66+ property bool _isSavingDrag: false
6667 readonly property int recPillWindowWidth: 460
6768 readonly property int recPillWindowHeight: 60
6869
@@ -114,7 +115,6 @@ PluginComponent {
114115 root .settingsExpanded = false ;
115116 root .delayExpanded = false ;
116117 overlay .visible = true ;
117- overlay .forceActiveFocus ();
118118 }
119119
120120 function close () {
@@ -128,17 +128,22 @@ PluginComponent {
128128 else root .open ();
129129 }
130130
131+
132+
131133 function _save (key , value ) {
132- if (typeof PluginService !== " undefined " && PluginService ) {
133- PluginService .savePluginData (" screenCaptureToolbar" , key, value);
134- PluginService .setGlobalVar (" screenCaptureToolbar" , key, value);
134+ if (root . pluginService ) {
135+ root . pluginService .savePluginData (" screenCaptureToolbar" , key, value);
136+ root . pluginService .setGlobalVar (" screenCaptureToolbar" , key, value);
135137 }
136138 }
137139
138140 Connections {
139- target: PluginService
140- function onGlobalVarChanged (plugin , key , value ) {
141- if (plugin === " screenCaptureToolbar" ) {
141+ target: root .pluginService
142+ function onGlobalVarChanged (plugin , key ) {
143+ if (plugin === " screenCaptureToolbar" && root .pluginService ) {
144+ const value = root .pluginService .getGlobalVar (plugin, key, undefined );
145+ if (value === undefined ) return ;
146+
142147 if (key === " copyToClipboard" ) root .copyToClipboard = value;
143148 else if (key === " saveToDisk" ) root .saveToDisk = value;
144149 else if (key === " stdout" ) root .stdout = value;
@@ -256,6 +261,7 @@ PluginComponent {
256261 }
257262
258263 function endRecPillDrag () {
264+ root ._isSavingDrag = true ;
259265 root .recPillDragging = false ;
260266 root .recPillDragStarted = false ;
261267
@@ -278,6 +284,7 @@ PluginComponent {
278284 root ._save (" recPillX" , root .recPillX );
279285 root ._save (" recPillY" , root .recPillY );
280286 }
287+ root ._isSavingDrag = false ;
281288 }
282289
283290 function ensureRecPillScreen () {
@@ -345,9 +352,11 @@ PluginComponent {
345352 root .toolbarOpacity = pluginData .toolbarOpacity !== undefined ? pluginData .toolbarOpacity : 0.85 ;
346353 root .pillOpacity = pluginData .pillOpacity !== undefined ? pluginData .pillOpacity : 0.92 ;
347354
348- if (pluginData .recPillScreenName !== undefined ) root .recPillScreenName = pluginData .recPillScreenName ;
349- if (pluginData .recPillX !== undefined ) root .recPillX = pluginData .recPillX ;
350- if (pluginData .recPillY !== undefined ) root .recPillY = pluginData .recPillY ;
355+ if (! root ._isSavingDrag ) {
356+ if (pluginData .recPillScreenName !== undefined ) root .recPillScreenName = pluginData .recPillScreenName ;
357+ if (pluginData .recPillX !== undefined ) root .recPillX = pluginData .recPillX ;
358+ if (pluginData .recPillY !== undefined ) root .recPillY = pluginData .recPillY ;
359+ }
351360 }
352361
353362 function performCapture (forceEdit = false ) {
@@ -356,8 +365,8 @@ PluginComponent {
356365 return ;
357366 }
358367
359- // Apply delay only for non-interactive screenshot modes
360- let useDelay = ! root .isVideoMode && root .captureMode !== " interactive " && root . delaySeconds > 0 ;
368+ // Apply delay for screenshot modes
369+ let useDelay = ! root .isVideoMode && root .delaySeconds > 0 ;
361370
362371 if (useDelay) {
363372 root .close (); // Close immediately so it's not in the shot
@@ -527,12 +536,28 @@ PluginComponent {
527536 " if command -v slurp >/dev/null 2>&1; then " +
528537 " REGION=$(slurp -f '%wx%h+%x+%y') || { cancel_rec; exit 1; }; " +
529538 " [ -z \" $REGION\" ] && { cancel_rec; exit 1; }; " +
530- " start_rec; gpu-screen-recorder -w region -region \" $REGION\" " + gsrSuffix + " ; " +
539+ " start_rec; exec gpu-screen-recorder -w region -region \" $REGION\" " + gsrSuffix + " ; " +
540+ " else " +
541+ " start_rec; exec gpu-screen-recorder -w portal" + gsrSuffix + " ; " +
542+ " 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 + " ; " +
531556 " else " +
532- " start_rec; gpu-screen-recorder -w portal " + gsrSuffix + " ; " +
557+ " exec gpu-screen-recorder -w screen " + gsrSuffix + " ; " +
533558 " fi" ;
534559 } else {
535- scriptBody = " sleep 0.2; mkdir -p \" " + dir + " \" ; gpu-screen-recorder -w \" $MONITOR\" " + gsrSuffix;
560+ scriptBody = " sleep 0.2; mkdir -p \" " + dir + " \" ; exec gpu-screen-recorder -w \" $MONITOR\" " + gsrSuffix;
536561 }
537562
538563 let finalCmd = prelude !== " " ? prelude + " ; " + scriptBody : scriptBody;
@@ -553,7 +578,7 @@ PluginComponent {
553578 }
554579
555580 function stopRecording () {
556- Quickshell .execDetached ([" pkill" , " -SIGINT" , " -f" , " ^ gpu-screen-recorder" ]);
581+ Quickshell .execDetached ([" pkill" , " -SIGINT" , " -f" , " gpu-screen-recorder" ]);
557582 Quickshell .execDetached ([" pactl" , " set-source-mute" , " @DEFAULT_SOURCE@" , " 0" ]);
558583 root .isRecording = false ;
559584 root .isPaused = false ;
@@ -567,12 +592,12 @@ PluginComponent {
567592 }
568593
569594 function pauseRecording () {
570- Quickshell .execDetached ([" pkill" , " -SIGUSR2" , " -f" , " ^ gpu-screen-recorder" ]);
595+ Quickshell .execDetached ([" pkill" , " -SIGUSR2" , " -f" , " gpu-screen-recorder" ]);
571596 root .isPaused = true ;
572597 }
573598
574599 function resumeRecording () {
575- Quickshell .execDetached ([" pkill" , " -SIGUSR2" , " -f" , " ^ gpu-screen-recorder" ]);
600+ Quickshell .execDetached ([" pkill" , " -SIGUSR2" , " -f" , " gpu-screen-recorder" ]);
576601 root .isPaused = false ;
577602 }
578603
@@ -1150,7 +1175,7 @@ PluginComponent {
11501175
11511176 ToolbarBtn {
11521177 id: delayBtn
1153- visible: ! root .isVideoMode && root . captureMode !== " interactive "
1178+ visible: ! root .isVideoMode
11541179 isFirst: true
11551180 iconName: " timer"
11561181 tooltipText: " Delay: " + root .delaySeconds + " s"
0 commit comments