Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions modules/services/Screenshot.qml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ QtObject {
command: ["mkdir", "-p", root.screenshotsDir]
}

// Ensure screenshotsDir is set and the directory exists
function ensureScreenshotsDir() {
if (root.screenshotsDir === "") {
root.screenshotsDir = Quickshell.env("HOME") + "/Pictures/Screenshots"
}
ensureDirProcess.command = ["mkdir", "-p", root.screenshotsDir]
ensureDirProcess.running = true
}

// Dynamic list of freeze processes, managed via bash for simplicity?
// Or we can use a single shell script that forks grim for each monitor.
// "grim -o name1 path1 & grim -o name2 path2 & wait"
Expand Down Expand Up @@ -301,9 +310,7 @@ QtObject {
if (root.captureMode === "lens") {
root.finalPath = root.lensPath;
} else {
if (root.screenshotsDir === "") {
root.screenshotsDir = Quickshell.env("HOME") + "/Pictures/Screenshots"
}
root.ensureScreenshotsDir()
var filename = "Screenshot_" + getTimestamp() + ".png"
root.finalPath = root.screenshotsDir + "/" + filename
}
Expand Down Expand Up @@ -366,9 +373,7 @@ QtObject {
if (root.captureMode === "lens") {
root.finalPath = root.lensPath;
} else {
if (root.screenshotsDir === "") {
root.screenshotsDir = Quickshell.env("HOME") + "/Pictures/Screenshots"
}
root.ensureScreenshotsDir()
var filename = "Screenshot_" + getTimestamp() + ".png"
root.finalPath = root.screenshotsDir + "/" + filename
}
Expand Down Expand Up @@ -405,9 +410,7 @@ QtObject {
if (root.captureMode === "lens") {
root.finalPath = root.lensPath;
} else {
if (root.screenshotsDir === "") {
root.screenshotsDir = Quickshell.env("HOME") + "/Pictures/Screenshots"
}
root.ensureScreenshotsDir()
var filename = "Screenshot_" + getTimestamp() + ".png"
root.finalPath = root.screenshotsDir + "/" + filename
}
Expand Down