-
-
Notifications
You must be signed in to change notification settings - Fork 525
feat: Screen Recorder script #477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 24 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
66e0d94
C++ script to record with wf-recorder
0xAquora d035272
Update keybindings.conf
0xAquora 06fd56e
Update pkg_core.lst
0xAquora 38c90ba
Delete Configs/.local/lib/hyde/smart-recorder
0xAquora b0cbbc0
Uploaded script to use wf-recorder easily.
0xAquora a3919f5
Added files to record screen through keybind.
0xAquora 0c89738
Update keybindings.conf
0xAquora cb8caa1
Update keybindings.conf
0xAquora cd21ef3
Update keybindings.conf
0xAquora e752218
Update keybindings.conf
0xAquora bc9ed3b
Delete Configs/.local/lib/hyde/smart-recorder
0xAquora d9f0da5
Added wf-recorder.sh
0xAquora 5a12fac
Delete Configs/.local/lib/hyde/get_encoder.sh
0xAquora 919a402
Delete Configs/.local/lib/hyde/record_video_audio.sh
0xAquora 585463f
Delete Configs/.local/lib/hyde/record_video.sh
0xAquora 5dc3ad8
Update keybindings.conf
0xAquora 31b4fa0
Merge branch 'master' into master
0xAquora 5294cd6
Update keybindings.conf
0xAquora afbcd74
Update pkg_core.lst
0xAquora 1da0659
Update pkg_extra.lst
0xAquora 53010ec
Merge branch 'master' into master
0xAquora 31256ab
rename to generic "screenrecord"
kRHYME7 57d48c8
Added wk-screenrec and wf-recorder backend support . sheshhhhh
kRHYME7 145a24c
use --start
kRHYME7 ea71cec
Merge branch 'master' into master
kRHYME7 02a2a98
Update pkg_extra.lst
kRHYME7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,151 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| # shellcheck source=$HOME/.local/bin/hyde-shell | ||
| # shellcheck disable=SC1091 | ||
| if ! source "$(command -v hyde-shell)"; then | ||
| echo "[wf-recorder] code :: Error: hyde-shell not found." | ||
| echo "[wf-recorder] code :: Is HyDE installed?" | ||
| exit 1 | ||
| fi | ||
|
|
||
| RECORDER="wl-screenrec" | ||
| command -v "$RECORDER" &>/dev/null || RECORDER="wf-recorder" | ||
| if ! command -v "$RECORDER" &>/dev/null; then | ||
| notify-send -a "HyDE Alert" "No screen recorder found. Try installing wl-screenrec or wf-recorder." | ||
| echo "No screen recorder found. Try installing wl-screenrec or wf-recorder." | ||
| exit 1 | ||
| fi | ||
|
|
||
| USAGE() { | ||
| cat <<USAGE | ||
|
|
||
| Usage: 'hyde-shell screenrecord' [option] | ||
|
|
||
| Using ${RECORDER} to record the screen. | ||
|
|
||
| Options: | ||
|
|
||
| --start Screen record | ||
| --backend Use 'wl-screenrec' or 'wf-recorder' as the backend | ||
| --file Specify the output file | ||
| --quit Stop the recording | ||
| --help Show this help message | ||
| -- Pass additional arguments to '${RECORDER}' | ||
|
|
||
| Note: | ||
|
|
||
| Click and drag on the screen to select a region to record. | ||
| To record the whole screen, simply click without dragging. | ||
|
|
||
| Additional arguments are passed to '${RECORDER}'. | ||
|
|
||
| Example: | ||
| 'hyde-shell screenrecord' --record -- --audio --codec libx264 | ||
|
|
||
|
|
||
| To see all available options for '${RECORDER}', run: | ||
| ${RECORDER} --help | ||
|
|
||
| USAGE | ||
| } | ||
|
|
||
| handle_recording() { | ||
|
|
||
| save_dir="${XDG_VIDEOS_DIR:-$HOME/Videos}/Recordings" | ||
| save_file=$(date +'%y%m%d_%Hh%Mm%Ss_recording.mp4') | ||
| save_file_path="${FILE_PATH:-"${save_dir}/${save_file}"}" | ||
| mkdir -p "$save_dir" | ||
|
|
||
| parameters=() | ||
|
|
||
| # Process additional arguments after -- | ||
| while [[ $# -gt 0 ]]; do | ||
| if [[ "$1" == "--" ]]; then | ||
| shift | ||
| # Add all remaining arguments to parameters array | ||
| while [[ $# -gt 0 ]]; do | ||
| parameters+=("$1") | ||
| shift | ||
| done | ||
| break | ||
| fi | ||
| shift | ||
| done | ||
|
|
||
| OUTPUT="$(hyprctl -j monitors | jq -r '.[] | select(.focused==true) | .name')" | ||
| GEOM="$( | ||
| # Only accept selections at least 16x16 pixels in size | ||
| slurp -w 0 -b "#00000000" -c "#FFFFFF" -s "#00000055" -B "#00000000" -o | awk '{ | ||
| # slurp outputs format: x,y WxH | ||
| split($1, pos, ","); # Split x,y | ||
| x = pos[1]; | ||
| y = pos[2]; | ||
| split($2, size, "x"); # Split WxH | ||
| width = size[1]; | ||
| height = size[2]; | ||
|
|
||
| # Check if selection meets minimum size | ||
| if (width >= 16 && height >= 16) { | ||
| print x","y" "width"x"height; # Output in the same format | ||
| } | ||
| }' | ||
|
|
||
| )" | ||
|
|
||
| if [[ -n "$GEOM" ]]; then | ||
| parameters+=("--geometry" "$GEOM") | ||
| else | ||
| echo "Using whole screen for recording" | ||
| [[ -n "$OUTPUT" ]] && parameters+=(--output "$OUTPUT") | ||
| fi | ||
|
|
||
| tmp_thumbnail=$(mktemp -t thumbnail_XXXXXX.png) | ||
| if [[ -z "$GEOM" ]]; then | ||
| "$LIB_DIR/hyde/grimblast" save active "$tmp_thumbnail" | ||
| else | ||
| grim -g "$GEOM" "$tmp_thumbnail" | ||
| fi | ||
|
|
||
| "${RECORDER}" "${parameters[@]}" -f "${save_file_path}" | ||
| notify-send -a "HyDE Alert" "${RECORDER}: Recording saved at ${save_file_path}" -i "${tmp_thumbnail}" | ||
| } | ||
|
|
||
| # Process arguments with while loop | ||
| while [[ $# -gt 0 ]]; do | ||
| case "$1" in | ||
| --file) | ||
| shift | ||
| FILE_PATH="$1" | ||
| ;; | ||
| --backend) | ||
| shift | ||
| RECORDER="$1" | ||
| ;; | ||
| --start) | ||
| handle_recording "$@" | ||
| exit 0 | ||
| ;; | ||
| --quit) | ||
| killall "${RECORDER}" | ||
| notify-send -a "HyDE Alert" "Recording stopped" | ||
| exit 0 | ||
| ;; | ||
| --help) | ||
| USAGE | ||
| exit 0 | ||
| ;; | ||
| *) | ||
| # Unknown option | ||
| USAGE | ||
| exit 1 | ||
| ;; | ||
| esac | ||
| shift | ||
| done | ||
|
|
||
| # If no arguments provided, show usage | ||
| if [[ $# -eq 0 ]]; then | ||
| USAGE | ||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.