This commit is contained in:
vaguesyntax
2025-11-06 23:39:32 +03:00
parent 8e1a3d26b1
commit 47aa8232f7
2 changed files with 14 additions and 12 deletions
@@ -33,9 +33,9 @@ PanelWindow {
property var selectionMode: RegionSelection.SelectionMode.RectCorners
signal dismiss()
property string permanentScreenshotDir: Config.options.screenSnip.savePath && Config.options.screenSnip.savePath !== ""
? Config.options.screenSnip.savePath
: ""
property string saveScreenshotDir: Config.options.screenSnip.savePath !== ""
? Config.options.screenSnip.savePath
: ""
property string screenshotDir: Directories.screenshotTemp
property string imageSearchEngineBaseUrl: Config.options.search.imageSearch.imageSearchEngineBaseUrl
@@ -262,20 +262,23 @@ PanelWindow {
}
switch (root.action) {
case RegionSelection.SnipAction.Copy:
if (permanentScreenshotDir === "") {
// no permanent dir, just copy to clipboard
if (saveScreenshotDir === "") {
// not saving the screenshot, just copy to clipboard
snipProc.command = ["bash", "-c", `${cropToStdout} | wl-copy && ${cleanup}`]
break;
}
const saveFileName = 'screenshot-' + DateTime.fileDateTime + '.png'
const savePath = `${root.permanentScreenshotDir}/${saveFileName}`
const savePathBase = root.saveScreenshotDir
snipProc.command = [
"bash", "-c",
`mkdir -p '${StringUtils.shellSingleQuoteEscape(root.permanentScreenshotDir)}' ` +
`&& ${cropToStdout} | tee >(wl-copy) > '${StringUtils.shellSingleQuoteEscape(savePath)}' ` +
`&& ${cleanup}`
"bash", "-c",
`mkdir -p '${StringUtils.shellSingleQuoteEscape(savePathBase)}' && \
saveFileName="screenshot-$(date '+%Y-%m-%d_%H.%M.%S').png" && \
savePath="${savePathBase}/$saveFileName" && \
${cropToStdout} | tee >(wl-copy) > "$savePath" && \
${cleanup}`
]
break;
case RegionSelection.SnipAction.Edit:
snipProc.command = ["bash", "-c", `${cropToStdout} | swappy -f - && ${cleanup}`]
@@ -22,7 +22,6 @@ Singleton {
property string shortDate: Qt.locale().toString(clock.date, Config.options?.time.shortDateFormat ?? "dd/MM")
property string date: Qt.locale().toString(clock.date, Config.options?.time.dateFormat ?? "dddd, dd/MM")
property string collapsedCalendarFormat: Qt.locale().toString(clock.date, "dd MMMM yyyy")
property string fileDateTime: Qt.locale().toString(clock.date, "dd-MM-yyyy_HH.mm")
property string uptime: "0h, 0m"
Timer {