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>
126 lines
4.8 KiB
QML
126 lines
4.8 KiB
QML
import QtQuick
|
|
import QtQuick.Layouts
|
|
import Quickshell
|
|
import qs.compat.noctalia.Commons
|
|
import qs.compat.noctalia.Services.UI
|
|
import qs.compat.noctalia.Services.System
|
|
import qs.compat.noctalia.Widgets
|
|
|
|
NIconButton {
|
|
id: root
|
|
|
|
property var pluginApi: null
|
|
property ShellScreen screen
|
|
property string widgetId: ""
|
|
property string section: ""
|
|
property int sectionWidgetIndex: -1
|
|
property int sectionWidgetsCount: 0
|
|
|
|
// Bar positioning properties
|
|
readonly property string screenName: screen ? screen.name : ""
|
|
readonly property string barPosition: Settings.getBarPositionForScreen(screenName)
|
|
readonly property bool isVertical: barPosition === "left" || barPosition === "right"
|
|
readonly property real barHeight: Style.getBarHeightForScreen(screenName)
|
|
readonly property real capsuleHeight: Style.getCapsuleHeightForScreen(screenName)
|
|
readonly property real barFontSize: Style.getBarFontSizeForScreen(screenName)
|
|
|
|
readonly property var mainInstance: pluginApi?.mainInstance
|
|
readonly property bool hideInactive:
|
|
pluginApi?.pluginSettings?.hideInactive ??
|
|
pluginApi?.manifest?.metadata?.defaultSettings?.hideInactive ??
|
|
false
|
|
|
|
property var cfg: pluginApi?.pluginSettings || ({})
|
|
property var defaults: pluginApi?.manifest?.metadata?.defaultSettings || ({})
|
|
readonly property string iconColorKey: cfg.iconColor ?? defaults.iconColor ?? "none"
|
|
readonly property color iconColor: Color.resolveColorKey(iconColorKey)
|
|
|
|
readonly property bool shouldShow: !hideInactive || (mainInstance?.isRecording ?? false) || (mainInstance?.isPending ?? false) || (mainInstance?.isReplaying ?? false)
|
|
|
|
visible: true
|
|
opacity: shouldShow ? 1.0 : 0.0
|
|
implicitWidth: shouldShow ? baseSize : 0
|
|
implicitHeight: shouldShow ? baseSize : 0
|
|
|
|
Behavior on opacity {
|
|
NumberAnimation { duration: Style.animationNormal }
|
|
}
|
|
|
|
Behavior on implicitWidth {
|
|
NumberAnimation { duration: Style.animationNormal }
|
|
}
|
|
|
|
Behavior on implicitHeight {
|
|
NumberAnimation { duration: Style.animationNormal }
|
|
}
|
|
|
|
enabled: mainInstance?.isAvailable ?? false
|
|
icon: "camera-video"
|
|
tooltipText: mainInstance?.buildTooltip()
|
|
tooltipDirection: BarService.getTooltipDirection()
|
|
baseSize: root.capsuleHeight
|
|
applyUiScale: false
|
|
customRadius: Style.radiusL
|
|
colorBg: (mainInstance?.isRecording || mainInstance?.isPending) ? Color.mPrimary : (mainInstance?.isReplaying ? Qt.alpha(Color.mSecondary, 0.25) : Style.capsuleColor)
|
|
colorFg: (mainInstance?.isRecording || mainInstance?.isPending) ? Color.mOnPrimary : (mainInstance?.isReplaying ? Color.mSecondary : root.iconColor)
|
|
colorBorder: "transparent"
|
|
colorBorderHover: "transparent"
|
|
border.color: Style.capsuleBorderColor
|
|
border.width: Style.capsuleBorderWidth
|
|
|
|
// mx fork: left/middle click do nothing; all controls live in the right-click menu.
|
|
onRightClicked: {
|
|
PanelService.showContextMenu(contextMenu, root, screen);
|
|
}
|
|
|
|
|
|
NPopupContextMenu {
|
|
id: contextMenu
|
|
|
|
model: {
|
|
var recording = mainInstance?.isRecording || mainInstance?.isPending;
|
|
var replaying = mainInstance?.isReplaying || mainInstance?.isReplayPending;
|
|
return [
|
|
{
|
|
"label": recording ? "Stop recording" : "Start recording",
|
|
"action": "toggle-recording",
|
|
"icon": recording ? "player-stop" : "player-record"
|
|
},
|
|
{
|
|
"label": "Save replay",
|
|
"action": "save-replay",
|
|
"icon": "device-floppy",
|
|
"enabled": mainInstance?.isReplaying ?? false
|
|
},
|
|
{
|
|
"label": replaying ? "Stop replay" : "Start replay",
|
|
"action": "toggle-replay",
|
|
"icon": replaying ? "stop" : "player-play",
|
|
"enabled": mainInstance?.replayEnabled ?? false
|
|
},
|
|
{
|
|
"label": I18n.tr("actions.widget-settings"),
|
|
"action": "widget-settings",
|
|
"icon": "settings"
|
|
}
|
|
];
|
|
}
|
|
|
|
onTriggered: action => {
|
|
contextMenu.close();
|
|
PanelService.closeContextMenu(screen);
|
|
|
|
if (action === "widget-settings") {
|
|
BarService.openPluginSettings(screen, pluginApi.manifest);
|
|
} else if (action === "toggle-recording" && mainInstance) {
|
|
mainInstance.toggleRecording();
|
|
} else if (action === "toggle-replay" && mainInstance) {
|
|
mainInstance.toggleReplay();
|
|
} else if (action === "save-replay" && mainInstance) {
|
|
mainInstance.saveReplay();
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|