From 6f7528c87aa7f5f1a973541510e3f01493cc12cc Mon Sep 17 00:00:00 2001 From: Ly-sec Date: Wed, 27 Aug 2025 13:21:53 +0200 Subject: [PATCH] Added issue templates and fixed screenRecorder status symbol ScreenRecorder: add proper checks for screenRecorder ISSUE_TEMPLATE: add bug_report and feature_request --- .github/ISSUE_TEMPLATE/bug_report.md | 29 ++++++++ .github/ISSUE_TEMPLATE/config.yml | 12 ++++ .github/ISSUE_TEMPLATE/feature_request.md | 19 ++++++ Services/ScreenRecorderService.qml | 82 +++++++++++++++++++---- 4 files changed, 129 insertions(+), 13 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..7ec042e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,29 @@ +--- +name: Bug Report +about: Report a bug from noctalia-shell +title: "[Bug]: " +labels: bug +assignees: '' +--- + +### Description +A clear and concise description of the bug. + +### Steps to Reproduce +1. Go to '...' +2. Click on '...' +3. See the error. + +### Expected Behavior +Explain what you expected to happen. + +### Screenshots +Add screenshots if applicable. + +### Environment +- Distro [e.g., CachyOS, NixOS, Arch, ...] +- Compositor [ e.g., Hyprland, Niri, ...] +- Version: [e.g., 1.0.0 or `main`] + +### Additional Context +Add any other context about the problem here. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..175736f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,12 @@ +blank_issues_enabled: false +issue_templates: + - name: "Bug Report" + description: "Report a bug in the system." + title: "[Bug]: " + labels: ["bug"] + body: "./ISSUE_TEMPLATE/bug_report.md" + - name: "Feature Request" + description: "Propose a new feature or improvement." + title: "[Feature]: " + labels: ["enhancement"] + body: "./ISSUE_TEMPLATE/feature_request.md" diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..5322498 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,19 @@ +--- +name: Feature Request +about: Suggest a new feature or improvement +title: "[Feature]: " +labels: enhancement +assignees: '' +--- + +### Feature Description +What feature would you like to see? + +### Why Is This Needed? +Explain the problem or need for this feature. + +### Suggested Solutions +Describe how this feature could be implemented. + +### Additional Context +Add any relevant screenshots, links, or resources. diff --git a/Services/ScreenRecorderService.qml b/Services/ScreenRecorderService.qml index ed35b38..ad4f323 100644 --- a/Services/ScreenRecorderService.qml +++ b/Services/ScreenRecorderService.qml @@ -1,7 +1,7 @@ pragma Singleton - import QtQuick import Quickshell +import Quickshell.Io import qs.Commons import qs.Services @@ -10,19 +10,20 @@ Singleton { readonly property var settings: Settings.data.screenRecorder property bool isRecording: false + property bool isPending: false property string outputPath: "" // Start or Stop recording function toggleRecording() { - isRecording ? stopRecording() : startRecording() + (isRecording || isPending) ? stopRecording() : startRecording() } // Start screen recording using Quickshell.execDetached function startRecording() { - if (isRecording) { + if (isRecording || isPending) { return } - isRecording = true + isPending = true var filename = Time.getFormattedTimestamp() + ".mp4" var videoDir = settings.directory @@ -43,23 +44,78 @@ Singleton { notify-send "gpu-screen-recorder not installed!" -u critical fi` - //Logger.log("ScreenRecorder", command) - Quickshell.execDetached(["sh", "-c", command]) - Logger.log("ScreenRecorder", "Started recording") + // Use Process instead of execDetached so we can monitor it + recorderProcess.exec({ + command: ["sh", "-c", command] + }) + + // Start monitoring - if process ends quickly, it was likely cancelled + pendingTimer.running = true } // Stop recording using Quickshell.execDetached function stopRecording() { - if (!isRecording) { + if (!isRecording && !isPending) { return } - Quickshell.execDetached(["sh", "-c", "pkill -SIGINT -f 'gpu-screen-recorder'"]) - Logger.log("ScreenRecorder", "Finished recording:", outputPath) + Quickshell.execDetached(["sh", "-c", "pkill -SIGINT -f 'gpu-screen-recorder' || pkill -SIGINT -f 'com.dec05eba.gpu_screen_recorder'"]) + + isRecording = false + isPending = false + pendingTimer.running = false + monitorTimer.running = false // Just in case, force kill after 3 seconds killTimer.running = true - isRecording = false + } + + // Process to run and monitor gpu-screen-recorder + Process { + id: recorderProcess + onExited: function(exitCode, exitStatus) { + if (isPending) { + // Process ended while we were pending - likely cancelled or error + isPending = false + pendingTimer.running = false + } else if (isRecording) { + // Process ended normally while recording + isRecording = false + monitorTimer.running = false + } + } + } + + Timer { + id: pendingTimer + interval: 2000 // Wait 2 seconds to see if process stays alive + running: false + repeat: false + onTriggered: { + if (isPending && recorderProcess.running) { + // Process is still running after 2 seconds - assume recording started successfully + isPending = false + isRecording = true + monitorTimer.running = true + } else if (isPending) { + // Process not running anymore - was cancelled or failed + isPending = false + } + } + } + + // Monitor timer to periodically check if we're still recording + Timer { + id: monitorTimer + interval: 2000 + running: false + repeat: true + onTriggered: { + if (!recorderProcess.running && isRecording) { + isRecording = false + running = false + } + } } Timer { @@ -68,7 +124,7 @@ Singleton { running: false repeat: false onTriggered: { - Quickshell.execDetached(["sh", "-c", "pkill -9 -f 'gpu-screen-recorder' 2>/dev/null || true"]) + Quickshell.execDetached(["sh", "-c", "pkill -9 -f 'gpu-screen-recorder' 2>/dev/null || pkill -9 -f 'com.dec05eba.gpu_screen_recorder' 2>/dev/null || true"]) } } -} +} \ No newline at end of file