1
0
mirror of https://github.com/tiyn/dotfiles.git synced 2025-10-10 03:21:16 +02:00

wayland: preliminary migration done

This commit is contained in:
tiyn
2025-04-09 02:31:49 +02:00
parent 45bfcbf68e
commit 170020a287
9 changed files with 473 additions and 19 deletions

View File

@@ -5,13 +5,18 @@ audio_2=${CAPTURE_OUTPUT_AUDIO:-easyeffects_source}
output=${CAPTURE_DIR:-$HOME/downloads}
device=${CAPTURE_DEVICE:-cpu}
window=$(xdotool getwindowfocus)
fps=60
format="mp4"
v_codec="h264"
a_codec="opus"
lenght=20
if [ $DISPLAY_SERVER = "wayland" ]; then
window="screen"
elif [ $DISPLAY_SERVER = "xorg" ]; then
window=$(xdotool getwindowfocus)
fi
gpu-screen-recorder -encoder $device -w $window -f $fps -a $audio_1 -a $audio_2 -c $format -k $v_codec -ac $a_codec -r $lenght -o $output &
# gpu-screen-recorder -encoder $device -w screen -f $fps -a $audio_1 -a $audio_2 -c $format -k $v_codec -ac $a_codec -r $lenght -o $output & # wayland command
notify-send -u low 'Screen record' 'Replay started'

View File

@@ -5,13 +5,17 @@ audio_2=${CAPTURE_OUTPUT_AUDIO:-easyeffects_source}
output=${CAPTURE_DIR:-$HOME/downloads}
device=${CAPTURE_DEVICE:-cpu}
window=$(xdotool getwindowfocus)
fps=30
format="mp4"
v_codec="h264"
a_codec="aac"
output="$output/recording-$(date '+%Y-%m-%d_%H-%M-%S').$format"
if [ $DISPLAY_SERVER = "wayland" ]; then
window="screen"
elif [ $DISPLAY_SERVER = "xorg" ]; then
window=$(xdotool getwindowfocus)
fi
gpu-screen-recorder -encoder $device -w $window -c $format -k $v_codec -ac $a_codec -f $fps -o $output &
# gpu-screen-recorder -encoder $device -w screen -c $format -k $v_codec -ac $a_codec -f $fps -o $output & # wayland command
notify-send -u low 'Screen record' 'Recording started'

View File

@@ -9,12 +9,21 @@ output="$output/screenshot-$(date '+%Y-%m-%d_%H-%M-%S').png"
xclip_img="xclip -sel clip -t image/png"
xclip_txt="xclip -sel clip -t text/plain"
case "$(printf "a selected area\\na selected area (copy)\\ncurrent window\\ncurrent window (copy)\\nfull screen\\nfull screen (copy)\\ncolor picker (copy)" | dmenu -l 6 -i -p "Screenshot which area?")" in
"a selected area") maim -s --hidecursor $output ;;
"a selected area (copy)") maim -s --hidecursor | ${xclip_img} ;;
"current window") maim -i "$(xdotool getactivewindow)" $output ;;
"current window (copy)") maim -i "$(xdotool getactivewindow)" | ${xclip_img} ;;
"full screen") maim $output ;;
"full screen (copy)") maim | ${xclip_img} ;;
"color picker (copy)") xcolor |tr -d '\n' | ${xclip_txt} ;;
esac
if [ $DISPLAY_SERVER = "wayland" ]; then
case "$(printf "a selected area\\na selected area (copy)\\nfull screen\\nfull screen (copy)" | dmenu -l 6 -i -p "Screenshot which area?")" in
"a selected area") grim -g "$(slurp)" $output ;;
"a selected area (copy)") grim -g "$(slurp)" - | wl-copy ;;
"full screen") grim $output ;;
"full screen (copy)") grim - | wl-copy ;;
esac
elif [ $DISPLAY_SERVER = "xorg" ]; then
case "$(printf "a selected area\\na selected area (copy)\\ncurrent window\\ncurrent window (copy)\\nfull screen\\nfull screen (copy)\\ncolor picker (copy)" | dmenu -l 6 -i -p "Screenshot which area?")" in
"a selected area") maim -s --hidecursor $output ;;
"a selected area (copy)") maim -s --hidecursor | ${xclip_img} ;;
"current window") maim -i "$(xdotool getactivewindow)" $output ;;
"current window (copy)") maim -i "$(xdotool getactivewindow)" | ${xclip_img} ;;
"full screen") maim $output ;;
"full screen (copy)") maim | ${xclip_img} ;;
"color picker (copy)") xcolor |tr -d '\n' | ${xclip_txt} ;;
esac
fi