GpuScreenRecorder: added video source option

This commit is contained in:
LemmyCook 2025-08-21 12:20:21 -04:00
parent 88447fbcef
commit 5c6657e3af
7 changed files with 37 additions and 17 deletions

View file

@ -165,6 +165,7 @@ Singleton {
property string colorRange: "limited" property string colorRange: "limited"
property bool showCursor: true property bool showCursor: true
property string audioSource: "default_output" property string audioSource: "default_output"
property string videoSource: "portal"
} }
// wallpaper // wallpaper

View file

@ -304,7 +304,7 @@ ColumnLayout {
} }
} }
currentKey: Settings.data.audio.visualizerType currentKey: Settings.data.audio.visualizerType
onSelected: function (key) { onSelected: key => {
Settings.data.audio.visualizerType = key Settings.data.audio.visualizerType = key
} }
} }

View file

@ -72,7 +72,7 @@ ColumnLayout {
} }
} }
currentKey: Settings.data.bar.position currentKey: Settings.data.bar.position
onSelected: function (key) { onSelected: key => {
Settings.data.bar.position = key Settings.data.bar.position = key
} }
} }

View file

@ -92,10 +92,30 @@ ColumnLayout {
Layout.bottomMargin: Style.marginS * scaling Layout.bottomMargin: Style.marginS * scaling
} }
// Source
NComboBox {
label: "Video Source"
description: "We recommend using portal, if you get artifacts try screen."
model: ListModel {
ListElement {
key: "portal"
name: "Portal"
}
ListElement {
key: "screen"
name: "Screen"
}
}
currentKey: Settings.data.screenRecorder.videoSource
onSelected: key => {
Settings.data.screenRecorder.videoSource = key
}
}
// Frame Rate // Frame Rate
NComboBox { NComboBox {
label: "Frame Rate" label: "Frame Rate"
description: "Target frame rate for screen recordings (default: 60)." description: "Target frame rate for screen recordings. (default: 60)"
model: ListModel { model: ListModel {
ListElement { ListElement {
key: "30" key: "30"
@ -115,7 +135,7 @@ ColumnLayout {
} }
} }
currentKey: Settings.data.screenRecorder.frameRate currentKey: Settings.data.screenRecorder.frameRate
onSelected: function (key) { onSelected: key => {
Settings.data.screenRecorder.frameRate = key Settings.data.screenRecorder.frameRate = key
} }
} }
@ -143,7 +163,7 @@ ColumnLayout {
} }
} }
currentKey: Settings.data.screenRecorder.quality currentKey: Settings.data.screenRecorder.quality
onSelected: function (key) { onSelected: key => {
Settings.data.screenRecorder.quality = key Settings.data.screenRecorder.quality = key
} }
} }
@ -175,7 +195,7 @@ ColumnLayout {
} }
} }
currentKey: Settings.data.screenRecorder.videoCodec currentKey: Settings.data.screenRecorder.videoCodec
onSelected: function (key) { onSelected: key => {
Settings.data.screenRecorder.videoCodec = key Settings.data.screenRecorder.videoCodec = key
} }
} }
@ -195,7 +215,7 @@ ColumnLayout {
} }
} }
currentKey: Settings.data.screenRecorder.colorRange currentKey: Settings.data.screenRecorder.colorRange
onSelected: function (key) { onSelected: key => {
Settings.data.screenRecorder.colorRange = key Settings.data.screenRecorder.colorRange = key
} }
} }
@ -239,7 +259,7 @@ ColumnLayout {
} }
} }
currentKey: Settings.data.screenRecorder.audioSource currentKey: Settings.data.screenRecorder.audioSource
onSelected: function (key) { onSelected: key => {
Settings.data.screenRecorder.audioSource = key Settings.data.screenRecorder.audioSource = key
} }
} }
@ -259,7 +279,7 @@ ColumnLayout {
} }
} }
currentKey: Settings.data.screenRecorder.audioCodec currentKey: Settings.data.screenRecorder.audioCodec
onSelected: function (key) { onSelected: key => {
Settings.data.screenRecorder.audioCodec = key Settings.data.screenRecorder.audioCodec = key
} }
} }

View file

@ -188,7 +188,7 @@ ColumnLayout {
} }
} }
currentKey: Settings.data.wallpaper.swww.resizeMethod currentKey: Settings.data.wallpaper.swww.resizeMethod
onSelected: function (key) { onSelected: key => {
Settings.data.wallpaper.swww.resizeMethod = key Settings.data.wallpaper.swww.resizeMethod = key
} }
} }
@ -256,7 +256,7 @@ ColumnLayout {
} }
} }
currentKey: Settings.data.wallpaper.swww.transitionType currentKey: Settings.data.wallpaper.swww.transitionType
onSelected: function (key) { onSelected: key => {
Settings.data.wallpaper.swww.transitionType = key Settings.data.wallpaper.swww.transitionType = key
} }
} }

View file

@ -30,13 +30,12 @@ Singleton {
videoDir += "/" videoDir += "/"
} }
outputPath = videoDir + filename outputPath = videoDir + filename
var command = "gpu-screen-recorder -w portal" + " -f " + settings.frameRate + " -ac " + settings.audioCodec var command = `gpu-screen-recorder -w ${settings.videoSource} -f ${settings.frameRate} -ac ${settings.audioCodec} -k ${settings.videoCodec} -a ${settings.audioSource} -q ${settings.quality} -cursor ${settings.showCursor ? "yes" : "no"} -cr ${settings.colorRange} -o ${outputPath}`
+ " -k " + settings.videoCodec + " -a " + settings.audioSource + " -q " + settings.quality
+ " -cursor " + (settings.showCursor ? "yes" : "no") + " -cr " + settings.colorRange + " -o " + outputPath
//Logger.log("ScreenRecorder", command) //Logger.log("ScreenRecorder", command)
Quickshell.execDetached(["sh", "-c", command]) Quickshell.execDetached(["sh", "-c", command])
Logger.log("ScreenRecorder", "Started recording") Logger.log("ScreenRecorder", "Started recording")
//Logger.log("ScreenRecorder", command)
} }
// Stop recording using Quickshell.execDetached // Stop recording using Quickshell.execDetached
@ -45,7 +44,7 @@ Singleton {
return return
} }
Quickshell.execDetached(["sh", "-c", "pkill -SIGINT -f 'gpu-screen-recorder.*portal'"]) Quickshell.execDetached(["sh", "-c", "pkill -SIGINT -f 'gpu-screen-recorder'"])
Logger.log("ScreenRecorder", "Finished recording:", outputPath) Logger.log("ScreenRecorder", "Finished recording:", outputPath)
// Just in case, force kill after 3 seconds // Just in case, force kill after 3 seconds
@ -59,7 +58,7 @@ Singleton {
running: false running: false
repeat: false repeat: false
onTriggered: { onTriggered: {
Quickshell.execDetached(["sh", "-c", "pkill -9 -f 'gpu-screen-recorder.*portal' 2>/dev/null || true"]) Quickshell.execDetached(["sh", "-c", "pkill -9 -f 'gpu-screen-recorder' 2>/dev/null || true"])
} }
} }
} }

View file

@ -83,7 +83,7 @@ RowLayout {
root.hovering = false root.hovering = false
root.exited() root.exited()
} }
onWheel: function (wheel) { onWheel: wheel => {
if (wheel.angleDelta.y > 0 && spinBox.value < spinBox.to) { if (wheel.angleDelta.y > 0 && spinBox.value < spinBox.to) {
spinBox.increase() spinBox.increase()
} else if (wheel.angleDelta.y < 0 && spinBox.value > spinBox.from) { } else if (wheel.angleDelta.y < 0 && spinBox.value > spinBox.from) {