diff --git a/dots/.config/quickshell/ii/modules/common/Config.qml b/dots/.config/quickshell/ii/modules/common/Config.qml index 042d10639..db8171b45 100644 --- a/dots/.config/quickshell/ii/modules/common/Config.qml +++ b/dots/.config/quickshell/ii/modules/common/Config.qml @@ -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 diff --git a/dots/.config/quickshell/ii/modules/regionSelector/RegionSelection.qml b/dots/.config/quickshell/ii/modules/regionSelector/RegionSelection.qml index 5ecce47ba..53ccfaf34 100644 --- a/dots/.config/quickshell/ii/modules/regionSelector/RegionSelection.qml +++ b/dots/.config/quickshell/ii/modules/regionSelector/RegionSelection.qml @@ -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; diff --git a/dots/.config/quickshell/ii/modules/settings/ServicesConfig.qml b/dots/.config/quickshell/ii/modules/settings/ServicesConfig.qml index 778ff2b84..5511a6bad 100644 --- a/dots/.config/quickshell/ii/modules/settings/ServicesConfig.qml +++ b/dots/.config/quickshell/ii/modules/settings/ServicesConfig.qml @@ -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; + } + } + } } diff --git a/dots/.config/quickshell/ii/services/DateTime.qml b/dots/.config/quickshell/ii/services/DateTime.qml index 62d296dbc..c6998f056 100644 --- a/dots/.config/quickshell/ii/services/DateTime.qml +++ b/dots/.config/quickshell/ii/services/DateTime.qml @@ -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 {