-
Notifications
You must be signed in to change notification settings - Fork 23
/
vnc
executable file
·52 lines (43 loc) · 967 Bytes
/
vnc
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
main() {
case $1 in
start)
start ${@:2}
;;
window)
window ${@:2}
;;
setup)
setup
;;
*)
help
;;
esac
}
start() {
x11vnc -display :0 -clip xinerama$1 -forever -xrandr -shared -repeat -noxdamage ${@:2}
}
window() {
echo Click on wanted window to start vnc
winId=$(xwininfo | grep -Eio "Window id: (0x\w+)" | cut -d' ' -f3)
title=$(xprop -id $winId | awk '/_NET_WM_NAME/{$1=$2="";print}' | cut -d'"' -f2)
echo Window id $winId - \"$title\"
x11vnc -forever -shared -repeat -noxdamage -id $winId $@
}
setup() {
sudo apt-get -y install x11vnc
}
help() {
cat <<TEXT
Vnc wrapper
Commands:
start <display> [x11vnc args]
- start vnc for given display
example: $0 startVnc 1 -scale 1/2:nb -ncache 0
This will start vnc using scale 1/2 wihout bleeding and 0 cache
window [x11vnc args]
- start vnc for a window, you will need to click on desired window
TEXT
}
main $@