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 property var selectionMode: RegionSelection.SelectionMode.RectCorners
signal dismiss() signal dismiss()
property string permanentScreenshotDir: Config.options.screenSnip.savePath && Config.options.screenSnip.savePath !== "" property string saveScreenshotDir: Config.options.screenSnip.savePath !== ""
? Config.options.screenSnip.savePath ? Config.options.screenSnip.savePath
: "" : ""
property string screenshotDir: Directories.screenshotTemp property string screenshotDir: Directories.screenshotTemp
property string imageSearchEngineBaseUrl: Config.options.search.imageSearch.imageSearchEngineBaseUrl property string imageSearchEngineBaseUrl: Config.options.search.imageSearch.imageSearchEngineBaseUrl
@@ -262,20 +262,23 @@ PanelWindow {
} }
switch (root.action) { switch (root.action) {
case RegionSelection.SnipAction.Copy: case RegionSelection.SnipAction.Copy:
if (permanentScreenshotDir === "") { if (saveScreenshotDir === "") {
// no permanent dir, just copy to clipboard // not saving the screenshot, just copy to clipboard
snipProc.command = ["bash", "-c", `${cropToStdout} | wl-copy && ${cleanup}`] snipProc.command = ["bash", "-c", `${cropToStdout} | wl-copy && ${cleanup}`]
break; break;
} }
const saveFileName = 'screenshot-' + DateTime.fileDateTime + '.png'
const savePath = `${root.permanentScreenshotDir}/${saveFileName}` const savePathBase = root.saveScreenshotDir
snipProc.command = [ snipProc.command = [
"bash", "-c", "bash", "-c",
`mkdir -p '${StringUtils.shellSingleQuoteEscape(root.permanentScreenshotDir)}' ` + `mkdir -p '${StringUtils.shellSingleQuoteEscape(savePathBase)}' && \
`&& ${cropToStdout} | tee >(wl-copy) > '${StringUtils.shellSingleQuoteEscape(savePath)}' ` + saveFileName="screenshot-$(date '+%Y-%m-%d_%H.%M.%S').png" && \
`&& ${cleanup}` savePath="${savePathBase}/$saveFileName" && \
${cropToStdout} | tee >(wl-copy) > "$savePath" && \
${cleanup}`
] ]
break; break;
case RegionSelection.SnipAction.Edit: case RegionSelection.SnipAction.Edit:
snipProc.command = ["bash", "-c", `${cropToStdout} | swappy -f - && ${cleanup}`] 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 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 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 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" property string uptime: "0h, 0m"
Timer { Timer {