dev: automated commit - 2025-09-29 14:44:33
This commit is contained in:
parent
188e601c2e
commit
76256d9db3
8 changed files with 127 additions and 122 deletions
55
local-bin/.local/bin/record.sh
Executable file
55
local-bin/.local/bin/record.sh
Executable file
|
|
@ -0,0 +1,55 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
[[ -f ~/.config/user-dirs.dirs ]] && source ~/.config/user-dirs.dirs
|
||||
OUTPUT_DIR="${OMARCHY_SCREENRECORD_DIR:-${XDG_VIDEOS_DIR:-$HOME/Videos}}"
|
||||
|
||||
if [[ ! -d "$OUTPUT_DIR" ]]; then
|
||||
notify-send "Screen recording directory does not exist: $OUTPUT_DIR" -u critical -t 3000
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Selects region or output
|
||||
SCOPE="$1"
|
||||
|
||||
# Selects audio inclusion or not
|
||||
AUDIO=$([[ $2 == "audio" ]] && echo "--audio")
|
||||
|
||||
start_screenrecording() {
|
||||
local filename="$OUTPUT_DIR/screenrecording-$(date +'%Y-%m-%d_%H-%M-%S').mp4"
|
||||
|
||||
if lspci | grep -qi 'nvidia'; then
|
||||
wf-recorder $AUDIO -f "$filename" -c libx264 -p crf=23 -p preset=medium -p movflags=+faststart "$@" &
|
||||
else
|
||||
wl-screenrec $AUDIO -f "$filename" --ffmpeg-encoder-options="-c:v libx264 -crf 23 -preset medium -movflags +faststart" "$@" &
|
||||
fi
|
||||
|
||||
toggle_screenrecording_indicator
|
||||
}
|
||||
|
||||
stop_screenrecording() {
|
||||
pkill -x wl-screenrec
|
||||
pkill -x wf-recorder
|
||||
|
||||
notify-send "Screen recording saved to $OUTPUT_DIR" -t 2000
|
||||
|
||||
sleep 0.2 # ensures the process is actually dead before we check
|
||||
toggle_screenrecording_indicator
|
||||
}
|
||||
|
||||
toggle_screenrecording_indicator() {
|
||||
pkill -RTMIN+8 waybar
|
||||
}
|
||||
|
||||
screenrecording_active() {
|
||||
pgrep -x wl-screenrec >/dev/null || pgrep -x wf-recorder >/dev/null
|
||||
}
|
||||
|
||||
if screenrecording_active; then
|
||||
stop_screenrecording
|
||||
elif [[ "$SCOPE" == "output" ]]; then
|
||||
output=$(slurp -o) || exit 1
|
||||
start_screenrecording -g "$output"
|
||||
else
|
||||
region=$(slurp) || exit 1
|
||||
start_screenrecording -g "$region"
|
||||
fi
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
CONFIG_FILES="$HOME/.config/waybar/config.jsonc $HOME/.config/waybar/style.css"
|
||||
CONFIG_FILES="$HOME/.config/waybar/config.jsonc $HOME/.config/waybar/common.jsonc $HOME/.config/waybar/style.css"
|
||||
|
||||
trap "killall waybar" EXIT
|
||||
trap "killall .waybar-wrapped" EXIT
|
||||
|
||||
while true; do
|
||||
waybar &
|
||||
inotifywait -e create,modify $CONFIG_FILES
|
||||
killall waybar
|
||||
killall .waybar-wrapped
|
||||
done
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue