forked from Shinonome/dots-hyprland
Save paths for screen recording and screenshots (#2354)
This commit is contained in:
@@ -475,6 +475,14 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
property JsonObject screenRecord: JsonObject {
|
||||||
|
property string savePath: Directories.videos.replace("file://","") // strip "file://"
|
||||||
|
}
|
||||||
|
|
||||||
|
property JsonObject screenSnip: JsonObject {
|
||||||
|
property string savePath: "" // only copy to clipboard when empty
|
||||||
|
}
|
||||||
|
|
||||||
property JsonObject sounds: JsonObject {
|
property JsonObject sounds: JsonObject {
|
||||||
property bool battery: false
|
property bool battery: false
|
||||||
property bool pomodoro: false
|
property bool pomodoro: false
|
||||||
|
|||||||
@@ -33,6 +33,10 @@ PanelWindow {
|
|||||||
property var selectionMode: RegionSelection.SelectionMode.RectCorners
|
property var selectionMode: RegionSelection.SelectionMode.RectCorners
|
||||||
signal dismiss()
|
signal dismiss()
|
||||||
|
|
||||||
|
property string saveScreenshotDir: 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
|
||||||
property string fileUploadApiEndpoint: "https://uguu.se/upload"
|
property string fileUploadApiEndpoint: "https://uguu.se/upload"
|
||||||
@@ -259,7 +263,23 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
switch (root.action) {
|
switch (root.action) {
|
||||||
case RegionSelection.SnipAction.Copy:
|
case RegionSelection.SnipAction.Copy:
|
||||||
snipProc.command = ["bash", "-c", `${cropToStdout} | wl-copy && ${cleanup}`]
|
if (saveScreenshotDir === "") {
|
||||||
|
// not saving the screenshot, just copy to clipboard
|
||||||
|
snipProc.command = ["bash", "-c", `${cropToStdout} | wl-copy && ${cleanup}`]
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
const savePathBase = root.saveScreenshotDir
|
||||||
|
|
||||||
|
snipProc.command = [
|
||||||
|
"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;
|
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}`]
|
||||||
|
|||||||
@@ -85,6 +85,31 @@ ContentPage {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ContentSection {
|
||||||
|
icon: "file_open"
|
||||||
|
title: Translation.tr("Save paths")
|
||||||
|
|
||||||
|
MaterialTextArea {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
placeholderText: Translation.tr("Video Recording Path")
|
||||||
|
text: Config.options.screenRecord.savePath
|
||||||
|
wrapMode: TextEdit.Wrap
|
||||||
|
onTextChanged: {
|
||||||
|
Config.options.screenRecord.savePath = text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialTextArea {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
placeholderText: Translation.tr("Screenshot Path (leave empty to just copy)")
|
||||||
|
text: Config.options.screenSnip.savePath
|
||||||
|
wrapMode: TextEdit.Wrap
|
||||||
|
onTextChanged: {
|
||||||
|
Config.options.screenSnip.savePath = text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ContentSection {
|
ContentSection {
|
||||||
icon: "search"
|
icon: "search"
|
||||||
title: Translation.tr("Search")
|
title: Translation.tr("Search")
|
||||||
|
|||||||
@@ -1,5 +1,18 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
CONFIG_FILE="$HOME/.config/illogical-impulse/config.json"
|
||||||
|
JSON_PATH=".screenRecord.savePath"
|
||||||
|
|
||||||
|
CUSTOM_PATH=$(jq -r "$JSON_PATH" "$CONFIG_FILE" 2>/dev/null)
|
||||||
|
|
||||||
|
RECORDING_DIR=""
|
||||||
|
|
||||||
|
if [[ -n "$CUSTOM_PATH" ]]; then
|
||||||
|
RECORDING_DIR="$CUSTOM_PATH"
|
||||||
|
else
|
||||||
|
RECORDING_DIR="$HOME/Videos" # Use default path
|
||||||
|
fi
|
||||||
|
|
||||||
getdate() {
|
getdate() {
|
||||||
date '+%Y-%m-%d_%H.%M.%S'
|
date '+%Y-%m-%d_%H.%M.%S'
|
||||||
}
|
}
|
||||||
@@ -10,12 +23,8 @@ getactivemonitor() {
|
|||||||
hyprctl monitors -j | jq -r '.[] | select(.focused == true) | .name'
|
hyprctl monitors -j | jq -r '.[] | select(.focused == true) | .name'
|
||||||
}
|
}
|
||||||
|
|
||||||
xdgvideo="$(xdg-user-dir VIDEOS)"
|
mkdir -p "$RECORDING_DIR"
|
||||||
if [[ $xdgvideo = "$HOME" ]]; then
|
cd "$RECORDING_DIR" || exit
|
||||||
unset xdgvideo
|
|
||||||
fi
|
|
||||||
mkdir -p "${xdgvideo:-$HOME/Videos}"
|
|
||||||
cd "${xdgvideo:-$HOME/Videos}" || exit
|
|
||||||
|
|
||||||
# parse --region <value> without modifying $@ so other flags like --fullscreen still work
|
# parse --region <value> without modifying $@ so other flags like --fullscreen still work
|
||||||
ARGS=("$@")
|
ARGS=("$@")
|
||||||
|
|||||||
Reference in New Issue
Block a user