summary refs log tree commit diff
path: root/bin/vncez
blob: f82f5248d1a65395f1abf3d3c12bca5d57a0c65a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh
set -e
[ -n "$DEBUG" ] && set -x

if [ -n "$1" ]; then
	printf "usage: %s\n" "$(basename "$0")"
	printf "\n"
	printf "launches a vnc server and client, creating a loopback X window\n"
	exit 2
fi

server_args=
if [ -n "$OUTPUT" ]; then
	server_args="-o ${OUTPUT}"
fi


trap '{ printf "\n=> killing everything...\n"; }' INT
trap '{ killall -9 wayvnc gvncviewer; notify-send "stopped output mirror" "cleaned up viewer window and workspace"; }' EXIT

# echo "=> starting wshowkeys"
# swaymsg exec "wshowkeys -a bottom -a left -F 'Iosevka Sparkle 25' -t 1" >/dev/null
echo "=> starting wayvnc"
swaymsg exec "wayvnc -r ${server_args} 0.0.0.0"
echo "=> starting viewer"
swx -w __vnc -- x11fy gvncviewer "0.0.0.0"

notify-send 'started output mirror' 'the vnc viewer X window was moved to new workspace\nyou can screen cast the desktop using it'
while true; do
	sleep $((1024*1024))
done