add screenshot location

This commit is contained in:
vaguesyntax
2025-11-01 15:55:46 +03:00
parent 0fabedb0c4
commit ace8802480
4 changed files with 42 additions and 4 deletions
@@ -464,6 +464,10 @@ Singleton {
property string savePath: Directories.videos
}
property JsonObject screenSnip: JsonObject {
property string savePath: "/home/vaguesyntax/Pictures"
}
property JsonObject sounds: JsonObject {
property bool battery: false
property bool pomodoro: false
@@ -33,6 +33,10 @@ 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 screenshotDir: Directories.screenshotTemp
property string imageSearchEngineBaseUrl: Config.options.search.imageSearch.imageSearchEngineBaseUrl
property string fileUploadApiEndpoint: "https://uguu.se/upload"
@@ -258,8 +262,24 @@ PanelWindow {
}
switch (root.action) {
case RegionSelection.SnipAction.Copy:
snipProc.command = ["bash", "-c", `${cropToStdout} | wl-copy && ${cleanup}`]
if (permanentScreenshotDir === "") {
// no permanent dir, just copy to clipboard
snipProc.command = ["bash", "-c", `${cropToStdout} | wl-copy && ${cleanup}`]
break;
}
const saveFileName = 'screenshot-' + DateTime.fileDateTime + '.png'
const savePath = `${root.permanentScreenshotDir}/${saveFileName}`
snipProc.command = [
"bash", "-c",
`mkdir -p '${StringUtils.shellSingleQuoteEscape(root.permanentScreenshotDir)}' ` +
`&& ${cropToStdout} | tee >(wl-copy) > '${StringUtils.shellSingleQuoteEscape(savePath)}' ` +
`&& ${cleanup}`
]
break;
//snipProc.command = ["bash", "-c", `${cropToStdout} | wl-copy && ${cleanup}`]
//break;
case RegionSelection.SnipAction.Edit:
snipProc.command = ["bash", "-c", `${cropToStdout} | swappy -f - && ${cleanup}`]
break;
@@ -86,11 +86,11 @@ ContentPage {
}
ContentSection {
icon: "screen_record"
title: Translation.tr("Screen Recording")
icon: "file_open"
title: Translation.tr("Save paths")
ContentSubsection {
title: Translation.tr("Save path") + " (example: /home/user/Videos)"
title: Translation.tr("Video save path")
MaterialTextArea {
Layout.fillWidth: true
placeholderText: Translation.tr("Path")
@@ -101,6 +101,19 @@ ContentPage {
}
}
}
ContentSubsection {
title: Translation.tr("Screenshot save path") + " (leave empty to just copy)"
MaterialTextArea {
Layout.fillWidth: true
placeholderText: Translation.tr("Path")
text: Config.options.screenSnip.savePath
wrapMode: TextEdit.Wrap
onTextChanged: {
Config.options.screenSnip.savePath = text;
}
}
}
}
@@ -22,6 +22,7 @@ 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 {