commit
97f30d139f
23 changed files with 174 additions and 25 deletions
@ -0,0 +1,80 @@ |
||||
#!/bin/bash |
||||
|
||||
# A simple wrapper around ffmpeg |
||||
# |
||||
# When run, a screenrecording will be made |
||||
# The file path will be put in the primary selection |
||||
# Will create notification containing file path |
||||
# |
||||
# If you have a project specified, it will put the sceenshot in that folder instead of /tmp |
||||
# |
||||
# Relies on ffmpeg for taking screenrecording |
||||
|
||||
PIDFILE="/tmp/screenrecord.pid" |
||||
|
||||
|
||||
|
||||
if [ -f "$PIDFILE" ]; then |
||||
pkill ffmpeg |
||||
exit |
||||
fi |
||||
|
||||
echo $$ > "$PIDFILE" |
||||
|
||||
|
||||
|
||||
path='/tmp' |
||||
command -v ffmpeg > /dev/null || ( echo -n "You need to install ffmpeg" && exit 1 ) |
||||
|
||||
#If a project is set we will put screenshots in the project's folder |
||||
command -v project > /dev/null && project=$(project current --path) |
||||
if [ -n "$project" ]; then |
||||
path="$project/screenrecordings" |
||||
#Make the directory if it doesn't exist |
||||
mkdir "$path" 2> /dev/null |
||||
fi |
||||
|
||||
filename="$(date +"%Y-%m-%dT%H-%M-%SZ").mkv" |
||||
file="${path}/${filename}" |
||||
|
||||
[ "$1" = "-w" ] && sleep "$2" && shift && shift |
||||
|
||||
case $1 in |
||||
"select") |
||||
if [ -n "$WAYLAND_DISPLAY" ]; then |
||||
echo "Shouldn't get here" |
||||
echo "No wayland support yet" >&2 |
||||
exit |
||||
else |
||||
echo "I get here" |
||||
ffmpeg -framerate 30 -f x11grab $(slop -l -c "0.41,0.62,0.42,0.2" -f "-video_size %wx%h -i :0.0+%x,%y") "$file" |
||||
fi |
||||
;; |
||||
*) |
||||
if [ -n "$WAYLAND_DISPLAY" ]; then |
||||
echo "No wayland support yet" >&2 |
||||
exit |
||||
else |
||||
ffmpeg -framerate 30 -f x11grab -video_size "$(xdpyinfo | grep dimensions | awk '{print $2}')" -i :0.0 "$file" |
||||
fi |
||||
;; |
||||
esac |
||||
|
||||
if [ -f "$file" ]; then |
||||
# Create a gif |
||||
ffmpeg -i "$file" -vf "fps=10,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 "${file%.*}".gif |
||||
if [ -n "$WAYLAND_DISPLAY" ]; then |
||||
# Copies the image to your clipboard (ctrl + v) |
||||
wl-copy < "${file%.*}.gif" |
||||
# Copies the filename to primary selection (shift + insert or middle mouse) |
||||
echo -n "${file%.*}.gif" | wl-copy --primary |
||||
else |
||||
# Copies the image to your clipboard (ctrl + v) |
||||
xclip -selection clipboard -target image/gif -i "${file%.*}.gif" |
||||
# Copies the filename to primary selection (shift + insert or middle mouse) |
||||
echo -n "${file%.*}.gif" | xclip -selection primary |
||||
fi |
||||
# Creates notification with file name |
||||
notify-send "New Screenrecording" "$file\n${file%.*}.gif" |
||||
fi |
||||
rm "$PIDFILE" |
@ -1 +1 @@ |
||||
Subproject commit fb51bfebd8ac57282154d119f80368b4b94199b7 |
||||
Subproject commit a716897b958d1f1c0809d92a70e8d849a3d652e2 |
@ -1 +1 @@ |
||||
Subproject commit 51440bb8d9bc5e421d31d1a2a60a204468624e1b |
||||
Subproject commit 4caf12730256579921d77e80423b339b8128c5b6 |
@ -1 +1 @@ |
||||
Subproject commit 5e6fac425119bcbd03a6b7e4d293de0c63cbc5ff |
||||
Subproject commit 22e7618fc338baea39c46d0c7369f134b7d18f44 |
@ -1 +1 @@ |
||||
Subproject commit 7d45724fdd323d5eb7d39c8caa2e38e63c5e84a7 |
||||
Subproject commit e34f6c129d39b90db44df1107c8b7dfacfd18946 |
@ -1 +1 @@ |
||||
Subproject commit 89bf4dc13539131a29cf938074b3f1ce9d000bfd |
||||
Subproject commit 6b716e2118d842a26620387f0845e57cfd69ffaf |
@ -1 +1 @@ |
||||
Subproject commit 60133c47e0fd82556d7ca092546ebfa8d047466e |
||||
Subproject commit ea72eaae8809c0e475a8248aa665034d7d4520db |
@ -1 +1 @@ |
||||
Subproject commit c270950492d71bac0317d47d42cd0884eefe6490 |
||||
Subproject commit 8803960a4e09daf1ad4d82e16a25bbdb4c78530e |
@ -1 +1 @@ |
||||
Subproject commit 1a77f1c00e12e8460f39098ec3289c5433d32512 |
||||
Subproject commit 6c53da0783a15d2dcde504ae299468ac69078ebe |
@ -1 +1 @@ |
||||
Subproject commit c947ad2b6a16983724a0153bdf7f66d7a80a32ca |
||||
Subproject commit 24afe922e6a05891756ecf331f39a1f6743d3d5a |
@ -1 +1 @@ |
||||
Subproject commit 0c5114e90837eac9af2150406f7821041e7e720b |
||||
Subproject commit 75309fc96c49725cf9bbd7bc881b7b342a60aa9a |
@ -1 +1 @@ |
||||
Subproject commit 5fee9d230ec4a6a16c45f2c71482595e4d9a67bd |
||||
Subproject commit b245f3ab4580eba27616a5ce06a56d5f791e67bd |
@ -0,0 +1,19 @@ |
||||
#!/usr/bin/env zsh |
||||
|
||||
#_call_navi() { |
||||
# local selected |
||||
# if [ -n "$LBUFFER" ]; then |
||||
# if selected="$(printf "%s" "$(navi --print --fzf-overrides '--no-select-1' --query "${LBUFFER}" </dev/tty)")"; then |
||||
# LBUFFER="$selected" |
||||
# fi |
||||
# else |
||||
# if selected="$(printf "%s" "$(navi --print </dev/tty)")"; then |
||||
# LBUFFER="$selected" |
||||
# fi |
||||
# fi |
||||
# zle redisplay |
||||
#} |
||||
# |
||||
#zle -N _call_navi |
||||
# |
||||
#bindkey '^n' _call_navi |
@ -1 +1 @@ |
||||
Subproject commit 83c98a4dbf703d58795e8d9482135b72c6a0a433 |
||||
Subproject commit 89a33154707c09789177a893e5a8ebbb131d5d3d |
@ -1 +1 @@ |
||||
Subproject commit 64b48d1d61fa830d9f157b5d59410b44c2088b72 |
||||
Subproject commit 6bf6db61d3bd9a16203130587ccfbc02f4ca9a57 |
Loading…
Reference in new issue