Add mx-screen-recorder plugin (fork of Noctalia screen-recorder)
Local fork of the Noctalia screen-recorder plugin (noctalia-plugins ea21cb6) for this setup: - Always capture DP-5; drop the source picker and portal pre-check. - Start the replay buffer as soon as the plugin loads. - Bar widget is right-click only: Start/Stop recording, Save replay, Start/Stop replay, Widget settings. - Stop/save signal the plugin's own gpu-screen-recorder by PID instead of pkill-ing every instance (stopping a recording killed the replay). - IPC target plugin:mx-screen-recorder, so it can coexist with upstream. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
30e98bac63
25 files changed
+3226
No files matched your search
@@ -0,0 +1,530 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import qs.compat.noctalia.Commons
|
||||
import qs.compat.noctalia.Widgets
|
||||
import qs.compat.noctalia.Services.UI
|
||||
import qs.compat.noctalia.Services.Compositor
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
spacing: Style.marginL
|
||||
|
||||
property var pluginApi: null
|
||||
|
||||
property bool editHideInactive: pluginApi?.pluginSettings?.hideInactive ?? pluginApi?.manifest?.metadata?.defaultSettings?.hideInactive ?? false
|
||||
|
||||
property string editIconColor: pluginApi?.pluginSettings?.iconColor ?? pluginApi?.manifest?.metadata?.defaultSettings?.iconColor ?? "none"
|
||||
|
||||
property string editDirectory: pluginApi?.pluginSettings?.directory || pluginApi?.manifest?.metadata?.defaultSettings?.directory || ""
|
||||
|
||||
property string editFilenamePattern: pluginApi?.pluginSettings?.filenamePattern || pluginApi?.manifest?.metadata?.defaultSettings?.filenamePattern || "recording_yyyyMMdd_HHmmss"
|
||||
|
||||
// Migrate legacy frame rates to "custom"
|
||||
readonly property var _validFrameRates: ["30", "60", "120", "custom"]
|
||||
readonly property string _rawFrameRate:
|
||||
pluginApi?.pluginSettings?.frameRate ||
|
||||
pluginApi?.manifest?.metadata?.defaultSettings?.frameRate ||
|
||||
"60"
|
||||
|
||||
property string editFrameRate:
|
||||
_validFrameRates.includes(_rawFrameRate) ? _rawFrameRate : "custom"
|
||||
|
||||
property string editCustomFrameRate:
|
||||
_validFrameRates.includes(_rawFrameRate)
|
||||
? (pluginApi?.pluginSettings?.customFrameRate ||
|
||||
pluginApi?.manifest?.metadata?.defaultSettings?.customFrameRate ||
|
||||
"60")
|
||||
: _rawFrameRate
|
||||
|
||||
property string editAudioCodec:
|
||||
pluginApi?.pluginSettings?.audioCodec ||
|
||||
pluginApi?.manifest?.metadata?.defaultSettings?.audioCodec ||
|
||||
"opus"
|
||||
|
||||
property string editVideoCodec: pluginApi?.pluginSettings?.videoCodec || pluginApi?.manifest?.metadata?.defaultSettings?.videoCodec || "h264"
|
||||
|
||||
property string editQuality: pluginApi?.pluginSettings?.quality || pluginApi?.manifest?.metadata?.defaultSettings?.quality || "very_high"
|
||||
|
||||
property string editColorRange: pluginApi?.pluginSettings?.colorRange || pluginApi?.manifest?.metadata?.defaultSettings?.colorRange || "limited"
|
||||
|
||||
property bool editShowCursor: pluginApi?.pluginSettings?.showCursor ?? pluginApi?.manifest?.metadata?.defaultSettings?.showCursor ?? true
|
||||
|
||||
property bool editCopyToClipboard: pluginApi?.pluginSettings?.copyToClipboard ?? pluginApi?.manifest?.metadata?.defaultSettings?.copyToClipboard ?? false
|
||||
|
||||
property string editAudioSource: pluginApi?.pluginSettings?.audioSource || pluginApi?.manifest?.metadata?.defaultSettings?.audioSource || "default_output"
|
||||
|
||||
property string editVideoSource: pluginApi?.pluginSettings?.videoSource || pluginApi?.manifest?.metadata?.defaultSettings?.videoSource || "portal"
|
||||
|
||||
property string editResolution: pluginApi?.pluginSettings?.resolution || pluginApi?.manifest?.metadata?.defaultSettings?.resolution || "original"
|
||||
|
||||
property bool editRestorePortalSession: pluginApi?.pluginSettings?.restorePortalSession ?? pluginApi?.manifest?.metadata?.defaultSettings?.restorePortalSession ?? false
|
||||
|
||||
// Replay settings
|
||||
property bool editReplayEnabled: pluginApi?.pluginSettings?.replayEnabled ?? pluginApi?.manifest?.metadata?.defaultSettings?.replayEnabled ?? false
|
||||
|
||||
readonly property var _validReplayDurations: ["15", "30", "60", "120", "300", "custom"]
|
||||
readonly property string _rawReplayDuration:
|
||||
pluginApi?.pluginSettings?.replayDuration ||
|
||||
pluginApi?.manifest?.metadata?.defaultSettings?.replayDuration ||
|
||||
"30"
|
||||
|
||||
property string editReplayDuration:
|
||||
_validReplayDurations.includes(_rawReplayDuration) ? _rawReplayDuration : "custom"
|
||||
|
||||
property string editCustomReplayDuration:
|
||||
_validReplayDurations.includes(_rawReplayDuration)
|
||||
? (pluginApi?.pluginSettings?.customReplayDuration ||
|
||||
pluginApi?.manifest?.metadata?.defaultSettings?.customReplayDuration ||
|
||||
"30")
|
||||
: _rawReplayDuration
|
||||
|
||||
property string editReplayStorage: pluginApi?.pluginSettings?.replayStorage || pluginApi?.manifest?.metadata?.defaultSettings?.replayStorage || "ram"
|
||||
|
||||
|
||||
|
||||
function saveSettings() {
|
||||
if (!pluginApi || !pluginApi.pluginSettings) {
|
||||
Logger.e("ScreenRecorder", "Cannot save: pluginApi or pluginSettings is null");
|
||||
return;
|
||||
}
|
||||
|
||||
// Core settings
|
||||
pluginApi.pluginSettings.hideInactive = root.editHideInactive
|
||||
pluginApi.pluginSettings.iconColor = root.editIconColor
|
||||
pluginApi.pluginSettings.directory = root.editDirectory
|
||||
pluginApi.pluginSettings.filenamePattern = root.editFilenamePattern
|
||||
pluginApi.pluginSettings.frameRate = root.editFrameRate
|
||||
pluginApi.pluginSettings.customFrameRate = root.editCustomFrameRate
|
||||
pluginApi.pluginSettings.audioCodec = root.editAudioCodec
|
||||
pluginApi.pluginSettings.videoCodec = root.editVideoCodec
|
||||
pluginApi.pluginSettings.quality = root.editQuality
|
||||
pluginApi.pluginSettings.colorRange = root.editColorRange
|
||||
pluginApi.pluginSettings.showCursor = root.editShowCursor
|
||||
pluginApi.pluginSettings.copyToClipboard = root.editCopyToClipboard
|
||||
pluginApi.pluginSettings.audioSource = root.editAudioSource
|
||||
pluginApi.pluginSettings.videoSource = root.editVideoSource
|
||||
pluginApi.pluginSettings.resolution = root.editResolution
|
||||
pluginApi.pluginSettings.restorePortalSession = root.editRestorePortalSession
|
||||
|
||||
// Replay settings
|
||||
pluginApi.pluginSettings.replayEnabled = root.editReplayEnabled
|
||||
pluginApi.pluginSettings.replayDuration = root.editReplayDuration
|
||||
pluginApi.pluginSettings.customReplayDuration = root.editCustomReplayDuration
|
||||
pluginApi.pluginSettings.replayStorage = root.editReplayStorage
|
||||
|
||||
|
||||
pluginApi.saveSettings();
|
||||
|
||||
Logger.i("ScreenRecorder", "Settings saved successfully");
|
||||
}
|
||||
// Icon Color
|
||||
NComboBox {
|
||||
label: I18n.tr("common.select-icon-color")
|
||||
description: I18n.tr("common.select-color-description")
|
||||
model: Color.colorKeyModel
|
||||
currentKey: root.editIconColor
|
||||
onSelected: key => root.editIconColor = key
|
||||
minimumWidth: 200
|
||||
}
|
||||
|
||||
NTextInputButton {
|
||||
label: pluginApi.tr("settings.general.output-folder")
|
||||
description: pluginApi.tr("settings.general.output-folder-description")
|
||||
placeholderText: Quickshell.env("HOME") + "/Videos"
|
||||
text: root.editDirectory
|
||||
buttonIcon: "folder-open"
|
||||
buttonTooltip: pluginApi.tr("settings.general.output-folder")
|
||||
onInputEditingFinished: root.editDirectory = text
|
||||
onButtonClicked: folderPicker.openFilePicker()
|
||||
}
|
||||
|
||||
// Filename Pattern
|
||||
NTextInput {
|
||||
label: pluginApi?.tr("settings.filename-pattern.label") || "Filename pattern"
|
||||
description: pluginApi?.tr("settings.filename-pattern.description") || "Pattern for generated filenames. Supported: yyyy, yy, MM, M, dd, d, HH, H, mm, m, ss, s (e.g., mycool-recording_yyyyMMdd_HHmmss)"
|
||||
placeholderText: "recording_yyyyMMdd_HHmmss"
|
||||
text: root.editFilenamePattern
|
||||
onTextChanged: root.editFilenamePattern = text
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
NDivider {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
// Show Cursor
|
||||
NToggle {
|
||||
label: pluginApi.tr("settings.general.show-cursor")
|
||||
description: pluginApi.tr("settings.general.show-cursor-description")
|
||||
checked: root.editShowCursor
|
||||
onToggled: c => root.editShowCursor = c
|
||||
defaultValue: pluginApi?.manifest?.metadata?.defaultSettings?.showCursor ?? true
|
||||
}
|
||||
|
||||
// Copy to Clipboard
|
||||
NToggle {
|
||||
label: pluginApi.tr("settings.general.copy-to-clipboard")
|
||||
description: pluginApi.tr("settings.general.copy-to-clipboard-description")
|
||||
checked: root.editCopyToClipboard
|
||||
onToggled: c => root.editCopyToClipboard = c
|
||||
defaultValue: pluginApi?.manifest?.metadata?.defaultSettings?.copyToClipboard ?? false
|
||||
}
|
||||
|
||||
// Hide When Inactive Toggle
|
||||
NToggle {
|
||||
label: pluginApi.tr("settings.general.hide-when-inactive")
|
||||
description: pluginApi.tr("settings.general.hide-when-inactive-description")
|
||||
checked: root.editHideInactive
|
||||
onToggled: c => root.editHideInactive = c
|
||||
defaultValue: pluginApi?.manifest?.metadata?.defaultSettings?.hideInactive ?? false
|
||||
}
|
||||
|
||||
// Restore Portal Session
|
||||
NToggle {
|
||||
label: pluginApi.tr("settings.general.restore-portal-session")
|
||||
description: pluginApi.tr("settings.general.restore-portal-session-description")
|
||||
checked: root.editRestorePortalSession
|
||||
onToggled: c => root.editRestorePortalSession = c
|
||||
defaultValue: pluginApi?.manifest?.metadata?.defaultSettings?.restorePortalSession ?? false
|
||||
}
|
||||
|
||||
NDivider {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
// Replay Settings
|
||||
ColumnLayout {
|
||||
spacing: Style.marginL
|
||||
Layout.fillWidth: true
|
||||
|
||||
NToggle {
|
||||
label: pluginApi.tr("settings.replay.enable")
|
||||
description: pluginApi.tr("settings.replay.enable-desc")
|
||||
checked: root.editReplayEnabled
|
||||
onToggled: c => root.editReplayEnabled = c
|
||||
defaultValue: pluginApi?.manifest?.metadata?.defaultSettings?.replayEnabled ?? false
|
||||
}
|
||||
|
||||
NComboBox {
|
||||
visible: root.editReplayEnabled
|
||||
label: pluginApi.tr("settings.replay.duration")
|
||||
description: pluginApi.tr("settings.replay.duration-desc")
|
||||
model: [
|
||||
{ "key": "15", "name": "15s" },
|
||||
{ "key": "30", "name": "30s" },
|
||||
{ "key": "60", "name": "60s" },
|
||||
{ "key": "120", "name": "2 min" },
|
||||
{ "key": "300", "name": "5 min" },
|
||||
{ "key": "custom", "name": pluginApi.tr("settings.video.frame-rate-custom") }
|
||||
]
|
||||
currentKey: root.editReplayDuration
|
||||
onSelected: key => root.editReplayDuration = key
|
||||
defaultValue: pluginApi?.manifest?.metadata?.defaultSettings?.replayDuration || "30"
|
||||
}
|
||||
|
||||
NTextInput {
|
||||
visible: root.editReplayEnabled && root.editReplayDuration === "custom"
|
||||
label: pluginApi.tr("settings.replay.custom-duration")
|
||||
description: pluginApi.tr("settings.replay.custom-duration-desc")
|
||||
placeholderText: "30"
|
||||
text: root.editCustomReplayDuration
|
||||
onTextChanged: {
|
||||
var numeric = text.replace(/[^0-9]/g, '')
|
||||
if (numeric !== text) {
|
||||
text = numeric
|
||||
}
|
||||
if (numeric) {
|
||||
root.editCustomReplayDuration = numeric
|
||||
}
|
||||
}
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
NComboBox {
|
||||
visible: root.editReplayEnabled
|
||||
label: pluginApi.tr("settings.replay.storage")
|
||||
description: pluginApi.tr("settings.replay.storage-desc")
|
||||
model: [
|
||||
{ "key": "ram", "name": pluginApi.tr("settings.replay.storage-ram") },
|
||||
{ "key": "disk", "name": pluginApi.tr("settings.replay.storage-disk") }
|
||||
]
|
||||
currentKey: root.editReplayStorage
|
||||
onSelected: key => root.editReplayStorage = key
|
||||
defaultValue: pluginApi?.manifest?.metadata?.defaultSettings?.replayStorage || "ram"
|
||||
}
|
||||
}
|
||||
|
||||
NDivider {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
// Video Settings
|
||||
ColumnLayout {
|
||||
spacing: Style.marginL
|
||||
Layout.fillWidth: true
|
||||
|
||||
// Source: mx fork always captures DP-5 (see Main.qml), so no picker here.
|
||||
|
||||
// Frame Rate
|
||||
NComboBox {
|
||||
label: pluginApi.tr("settings.video.frame-rate")
|
||||
description: pluginApi.tr("settings.video.frame-rate-desc")
|
||||
model: [
|
||||
{
|
||||
"key": "30",
|
||||
"name": "30 FPS"
|
||||
},
|
||||
{
|
||||
"key": "60",
|
||||
"name": "60 FPS"
|
||||
},
|
||||
{
|
||||
"key": "120",
|
||||
"name": "120 FPS"
|
||||
},
|
||||
{
|
||||
"key": "custom",
|
||||
"name": pluginApi.tr("settings.video.frame-rate-custom")
|
||||
}
|
||||
]
|
||||
currentKey: root.editFrameRate
|
||||
onSelected: key => root.editFrameRate = key
|
||||
defaultValue: pluginApi?.manifest?.metadata?.defaultSettings?.frameRate || "60"
|
||||
}
|
||||
|
||||
// Custom Frame Rate
|
||||
NTextInput {
|
||||
visible: root.editFrameRate === "custom"
|
||||
label: pluginApi.tr("settings.video.custom-frame-rate")
|
||||
description: pluginApi.tr("settings.video.custom-frame-rate-desc")
|
||||
placeholderText: "60"
|
||||
text: root.editCustomFrameRate
|
||||
onTextChanged: {
|
||||
// Only allow numeric values
|
||||
var numeric = text.replace(/[^0-9]/g, '')
|
||||
if (numeric !== text) {
|
||||
text = numeric
|
||||
}
|
||||
if (numeric) {
|
||||
root.editCustomFrameRate = numeric
|
||||
}
|
||||
}
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
// Video Quality
|
||||
NComboBox {
|
||||
label: pluginApi.tr("settings.video.quality")
|
||||
description: pluginApi.tr("settings.video.quality-desc")
|
||||
model: [
|
||||
{
|
||||
"key": "medium",
|
||||
"name": pluginApi.tr("settings.video.quality-medium")
|
||||
},
|
||||
{
|
||||
"key": "high",
|
||||
"name": pluginApi.tr("settings.video.quality-high")
|
||||
},
|
||||
{
|
||||
"key": "very_high",
|
||||
"name": pluginApi.tr("settings.video.quality-very-high")
|
||||
},
|
||||
{
|
||||
"key": "ultra",
|
||||
"name": pluginApi.tr("settings.video.quality-ultra")
|
||||
}
|
||||
]
|
||||
currentKey: root.editQuality
|
||||
onSelected: key => root.editQuality = key
|
||||
defaultValue: pluginApi?.manifest?.metadata?.defaultSettings?.quality || "very_high"
|
||||
}
|
||||
|
||||
// Video Codec
|
||||
NComboBox {
|
||||
label: pluginApi.tr("settings.video.codec")
|
||||
description: pluginApi.tr("settings.video.codec-desc")
|
||||
model: {
|
||||
let options = [
|
||||
{
|
||||
"key": "h264",
|
||||
"name": "H264"
|
||||
},
|
||||
{
|
||||
"key": "hevc",
|
||||
"name": "HEVC"
|
||||
},
|
||||
{
|
||||
"key": "av1",
|
||||
"name": "AV1"
|
||||
},
|
||||
{
|
||||
"key": "vp8",
|
||||
"name": "VP8"
|
||||
},
|
||||
{
|
||||
"key": "vp9",
|
||||
"name": "VP9"
|
||||
}
|
||||
];
|
||||
// Only add HDR options if source is 'screen' or 'focused-monitor'
|
||||
if (true) { // mx fork: always direct monitor capture (DP-5)
|
||||
options.push({
|
||||
"key": "hevc_hdr",
|
||||
"name": "HEVC HDR"
|
||||
});
|
||||
options.push({
|
||||
"key": "av1_hdr",
|
||||
"name": "AV1 HDR"
|
||||
});
|
||||
}
|
||||
return options;
|
||||
}
|
||||
currentKey: root.editVideoCodec
|
||||
onSelected: key => {
|
||||
root.editVideoCodec = key;
|
||||
// If an HDR codec is selected, change the colorRange to full
|
||||
if (key.includes("_hdr")) {
|
||||
root.editColorRange = "full";
|
||||
}
|
||||
}
|
||||
defaultValue: pluginApi?.manifest?.metadata?.defaultSettings?.videoCodec || "h264"
|
||||
|
||||
Connections {
|
||||
target: root
|
||||
function onEditVideoSourceChanged() {
|
||||
if (false && (root.editVideoCodec === "av1_hdr" || root.editVideoCodec === "hevc_hdr")) {
|
||||
root.editVideoCodec = "h264";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Color Range
|
||||
NComboBox {
|
||||
label: pluginApi.tr("settings.video.color-range")
|
||||
description: pluginApi.tr("settings.video.color-range-desc")
|
||||
model: [
|
||||
{
|
||||
"key": "limited",
|
||||
"name": pluginApi.tr("settings.video.color-range-limited")
|
||||
},
|
||||
{
|
||||
"key": "full",
|
||||
"name": pluginApi.tr("settings.video.color-range-full")
|
||||
}
|
||||
]
|
||||
currentKey: root.editColorRange
|
||||
onSelected: key => root.editColorRange = key
|
||||
defaultValue: pluginApi?.manifest?.metadata?.defaultSettings?.colorRange || "limited"
|
||||
}
|
||||
|
||||
// Resolution
|
||||
NComboBox {
|
||||
label: pluginApi.tr("settings.video.resolution")
|
||||
description: pluginApi.tr("settings.video.resolution-desc")
|
||||
model: [
|
||||
{
|
||||
"key": "original",
|
||||
"name": pluginApi.tr("settings.video.resolution-original")
|
||||
},
|
||||
{
|
||||
"key": "1920x1080",
|
||||
"name": "1920x1080 (Full HD)"
|
||||
},
|
||||
{
|
||||
"key": "1920x1200",
|
||||
"name": "1920x1200 (WUXGA)"
|
||||
},
|
||||
{
|
||||
"key": "2560x1440",
|
||||
"name": "2560x1440 (QHD)"
|
||||
},
|
||||
{
|
||||
"key": "3840x2160",
|
||||
"name": "3840x2160 (4K)"
|
||||
},
|
||||
{
|
||||
"key": "1280x720",
|
||||
"name": "1280x720 (HD)"
|
||||
}
|
||||
]
|
||||
currentKey: root.editResolution
|
||||
onSelected: key => root.editResolution = key
|
||||
defaultValue: pluginApi?.manifest?.metadata?.defaultSettings?.resolution || "original"
|
||||
}
|
||||
}
|
||||
|
||||
NDivider {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
// Audio Settings
|
||||
ColumnLayout {
|
||||
spacing: Style.marginL
|
||||
Layout.fillWidth: true
|
||||
|
||||
// Audio Source
|
||||
NComboBox {
|
||||
label: pluginApi.tr("settings.audio.source")
|
||||
description: pluginApi.tr("settings.audio.source-desc")
|
||||
model: [
|
||||
{
|
||||
"key": "none",
|
||||
"name": pluginApi.tr("settings.audio.audio-sources-none")
|
||||
},
|
||||
{
|
||||
"key": "default_output",
|
||||
"name": pluginApi.tr("settings.audio.audio-sources-system-output")
|
||||
},
|
||||
{
|
||||
"key": "default_input",
|
||||
"name": pluginApi.tr("settings.audio.audio-sources-microphone-input")
|
||||
},
|
||||
{
|
||||
"key": "both",
|
||||
"name": pluginApi.tr("settings.audio.audio-sources-both")
|
||||
}
|
||||
]
|
||||
currentKey: root.editAudioSource
|
||||
onSelected: key => root.editAudioSource = key
|
||||
defaultValue: pluginApi?.manifest?.metadata?.defaultSettings?.audioSource || "default_output"
|
||||
}
|
||||
|
||||
// Audio Codec
|
||||
NComboBox {
|
||||
label: pluginApi.tr("settings.audio.codec")
|
||||
description: pluginApi.tr("settings.audio.codec-desc")
|
||||
model: [
|
||||
{
|
||||
"key": "opus",
|
||||
"name": "Opus"
|
||||
},
|
||||
{
|
||||
"key": "aac",
|
||||
"name": "AAC"
|
||||
}
|
||||
]
|
||||
currentKey: root.editAudioCodec
|
||||
onSelected: key => root.editAudioCodec = key
|
||||
defaultValue: pluginApi?.manifest?.metadata?.defaultSettings?.audioCodec || "opus"
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
|
||||
NFilePicker {
|
||||
id: folderPicker
|
||||
selectionMode: "folders"
|
||||
title: pluginApi.tr("settings.general.output-folder")
|
||||
initialPath: root.editDirectory || Quickshell.env("HOME") + "/Videos"
|
||||
onAccepted: paths => {
|
||||
if (paths.length > 0) {
|
||||
root.editDirectory = paths[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user