This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

superconfig / 5pkgs / super-vnc / default.nix
1.3 kB 38 lines
1{ pkgs, lib }: let 2 3 quoteChar = c: 4 if c == "\n" then "'\n'" 5 else c; 6 quote = x: if x == "" then "''" else lib.stringAsChars quoteChar x; 7 8in pkgs.writers.writeDashBin "super-vnc" '' 9 PATH=${lib.makeBinPath (with pkgs; [ 10 xorg.xrandr gnugrep coreutils xorg.xorgserver gnused openssh gawk tightvnc 11 ])} 12 remote=$1 13 res_x=$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f1) 14 res_y=$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f2) 15 export modeline="$(gtf "$res_x" "$res_y" 60 | sed -n 's/.*Modeline "\([^" ]\+\)" \(.*\)/\1 \2/p')" 16 export name="$(echo "$modeline" | sed 's/\([^ ]\+\) .*/\1/')" 17 export vncline="''${res_x}x''${res_y}+0+0" 18 19 if [ -z "$modeline" -o -z "$name" ]; then 20 echo "Error! modeline=$modeline name=$name" 21 exit 1 22 fi 23 24 echo $modeline 25 26 # TODO user random highport 27 ssh "$remote" -L 5900:localhost:55900 bash <<EOF 28set -x 29export DISPLAY=:0 30export output=\$(xrandr | grep disconnected | tail -1 | cut -d' ' -f1) 31xrandr --newmode $modeline 32xrandr --verbose --addmode "\$output" "$name" 33xrandr --output "\$output" --off 34xrandr --verbose --output "\$output" --mode "$name" --right-of "\$(xrandr | grep primary | cut -d ' ' -f1)" 35EOF 36 sleep 2 37 vncviewer localhost:55900 38''