forked from Shinonome/dots-hyprland
initial commit of record-location
This commit is contained in:
@@ -460,6 +460,10 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
property JsonObject screenRecord: JsonObject {
|
||||||
|
property string savePath: Directories.videos
|
||||||
|
}
|
||||||
|
|
||||||
property JsonObject sounds: JsonObject {
|
property JsonObject sounds: JsonObject {
|
||||||
property bool battery: false
|
property bool battery: false
|
||||||
property bool pomodoro: false
|
property bool pomodoro: false
|
||||||
|
|||||||
@@ -85,6 +85,25 @@ ContentPage {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ContentSection {
|
||||||
|
icon: "screen_record"
|
||||||
|
title: Translation.tr("Screen Recording")
|
||||||
|
|
||||||
|
ContentSubsection {
|
||||||
|
title: Translation.tr("Save path") + " (example: /home/user/Videos)"
|
||||||
|
MaterialTextArea {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
placeholderText: Translation.tr("Path")
|
||||||
|
text: Config.options.screenRecord.savePath
|
||||||
|
wrapMode: TextEdit.Wrap
|
||||||
|
onTextChanged: {
|
||||||
|
Config.options.screenRecord.savePath = text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
ContentSection {
|
ContentSection {
|
||||||
icon: "search"
|
icon: "search"
|
||||||
title: Translation.tr("Search")
|
title: Translation.tr("Search")
|
||||||
|
|||||||
@@ -1,21 +1,35 @@
|
|||||||
#!/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"
|
||||||
|
fi
|
||||||
|
|
||||||
getdate() {
|
getdate() {
|
||||||
date '+%Y-%m-%d_%H.%M.%S'
|
date '+%Y-%m-%d_%H.%M.%S'
|
||||||
}
|
}
|
||||||
getaudiooutput() {
|
getaudiooutput() {
|
||||||
pactl list sources | grep 'Name' | grep 'monitor' | cut -d ' ' -f2
|
pactl list sources | grep 'Name' | grep 'monitor' | cut -d ' ' -f2
|
||||||
}
|
}
|
||||||
getactivemonitor() {
|
getactivemonitor() {
|
||||||
hyprctl monitors -j | jq -r '.[] | select(.focused == true) | .name'
|
hyprctl monitors -j | jq -r '.[] | select(.focused == true) | .name'
|
||||||
}
|
}
|
||||||
|
|
||||||
xdgvideo="$(xdg-user-dir VIDEOS)"
|
# ORİJİNAL XDG MANTIĞI SİLİNDİ, YERİNE SADECE YENİ DEĞİŞKEN KULLANILDI
|
||||||
if [[ $xdgvideo = "$HOME" ]]; then
|
# xdgvideo="$(xdg-user-dir VIDEOS)"
|
||||||
unset xdgvideo
|
# if $xdgvideo = "$HOME" ]]; then
|
||||||
fi
|
# unset xdgvideo
|
||||||
mkdir -p "${xdgvideo:-$HOME/Videos}"
|
# fi
|
||||||
cd "${xdgvideo:-$HOME/Videos}" || exit
|
mkdir -p "$RECORDING_DIR"
|
||||||
|
cd "$RECORDING_DIR" || 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=("$@")
|
||||||
@@ -23,47 +37,47 @@ MANUAL_REGION=""
|
|||||||
SOUND_FLAG=0
|
SOUND_FLAG=0
|
||||||
FULLSCREEN_FLAG=0
|
FULLSCREEN_FLAG=0
|
||||||
for ((i=0;i<${#ARGS[@]};i++)); do
|
for ((i=0;i<${#ARGS[@]};i++)); do
|
||||||
if [[ "${ARGS[i]}" == "--region" ]]; then
|
if [[ "${ARGS[i]}" == "--region" ]]; then
|
||||||
if (( i+1 < ${#ARGS[@]} )); then
|
if (( i+1 < ${#ARGS[@]} )); then
|
||||||
MANUAL_REGION="${ARGS[i+1]}"
|
MANUAL_REGION="${ARGS[i+1]}"
|
||||||
else
|
else
|
||||||
notify-send "Recording cancelled" "No region specified for --region" -a 'Recorder' & disown
|
notify-send "Recording cancelled" "No region specified for --region" -a 'Recorder' & disown
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
elif [[ "${ARGS[i]}" == "--sound" ]]; then
|
elif [[ "${ARGS[i]}" == "--sound" ]]; then
|
||||||
SOUND_FLAG=1
|
SOUND_FLAG=1
|
||||||
elif [[ "${ARGS[i]}" == "--fullscreen" ]]; then
|
elif [[ "${ARGS[i]}" == "--fullscreen" ]]; then
|
||||||
FULLSCREEN_FLAG=1
|
FULLSCREEN_FLAG=1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if pgrep wf-recorder > /dev/null; then
|
if pgrep wf-recorder > /dev/null; then
|
||||||
notify-send "Recording Stopped" "Stopped" -a 'Recorder' &
|
notify-send "Recording Stopped" "Stopped" -a 'Recorder' &
|
||||||
pkill wf-recorder &
|
pkill wf-recorder &
|
||||||
else
|
else
|
||||||
if [[ $FULLSCREEN_FLAG -eq 1 ]]; then
|
if [[ $FULLSCREEN_FLAG -eq 1 ]]; then
|
||||||
notify-send "Starting recording" 'recording_'"$(getdate)"'.mp4' -a 'Recorder' & disown
|
notify-send "Starting recording" 'recording_'"$(getdate)"'.mp4' -a 'Recorder' & disown
|
||||||
if [[ $SOUND_FLAG -eq 1 ]]; then
|
if [[ $SOUND_FLAG -eq 1 ]]; then
|
||||||
wf-recorder -o "$(getactivemonitor)" --pixel-format yuv420p -f './recording_'"$(getdate)"'.mp4' -t --audio="$(getaudiooutput)"
|
wf-recorder -o "$(getactivemonitor)" --pixel-format yuv420p -f './recording_'"$(getdate)"'.mp4' -t --audio="$(getaudiooutput)"
|
||||||
else
|
else
|
||||||
wf-recorder -o "$(getactivemonitor)" --pixel-format yuv420p -f './recording_'"$(getdate)"'.mp4' -t
|
wf-recorder -o "$(getactivemonitor)" --pixel-format yuv420p -f './recording_'"$(getdate)"'.mp4' -t
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# If a manual region was provided via --region, use it; otherwise run slurp as before.
|
# If a manual region was provided via --region, use it; otherwise run slurp as before.
|
||||||
if [[ -n "$MANUAL_REGION" ]]; then
|
if [[ -n "$MANUAL_REGION" ]]; then
|
||||||
region="$MANUAL_REGION"
|
region="$MANUAL_REGION"
|
||||||
else
|
else
|
||||||
if ! region="$(slurp 2>&1)"; then
|
if ! region="$(slurp 2>&1)"; then
|
||||||
notify-send "Recording cancelled" "Selection was cancelled" -a 'Recorder' & disown
|
notify-send "Recording cancelled" "Selection was cancelled" -a 'Recorder' & disown
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
notify-send "Starting recording" 'recording_'"$(getdate)"'.mp4' -a 'Recorder' & disown
|
notify-send "Starting recording" 'recording_'"$(getdate)"'.mp4' -a 'Recorder' & disown
|
||||||
if [[ $SOUND_FLAG -eq 1 ]]; then
|
if [[ $SOUND_FLAG -eq 1 ]]; then
|
||||||
wf-recorder --pixel-format yuv420p -f './recording_'"$(getdate)"'.mp4' -t --geometry "$region" --audio="$(getaudiooutput)"
|
wf-recorder --pixel-format yuv420p -f './recording_'"$(getdate)"'.mp4' -t --geometry "$region" --audio="$(getaudiooutput)"
|
||||||
else
|
else
|
||||||
wf-recorder --pixel-format yuv420p -f './recording_'"$(getdate)"'.mp4' -t --geometry "$region"
|
wf-recorder --pixel-format yuv420p -f './recording_'"$(getdate)"'.mp4' -t --geometry "$region"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
Reference in New Issue
Block a user