aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2023-03-14 11:19:59 +0100
committerKarel Kočí <cynerd@email.cz>2023-03-14 11:32:31 +0100
commitfc085da8db6746e272ff9ca428f20505ff7e115d (patch)
tree14fa7e4eb0ec0af09a2ee6c86e19973adf279082
parent30c8af33743b725da2d23a9cca285d2f47e5e339 (diff)
downloadmyconfigs-fc085da8db6746e272ff9ca428f20505ff7e115d.tar.gz
myconfigs-fc085da8db6746e272ff9ca428f20505ff7e115d.tar.bz2
myconfigs-fc085da8db6746e272ff9ca428f20505ff7e115d.zip
Rework wayvnc
-rw-r--r--config/systemd/user/wayvnc1.service5
-rwxr-xr-xinstall7
-rwxr-xr-xlocal/bin/sshvnc12
-rwxr-xr-xlocal/sbin/wayvnc13
4 files changed, 20 insertions, 7 deletions
diff --git a/config/systemd/user/wayvnc1.service b/config/systemd/user/wayvnc1.service
new file mode 100644
index 0000000..facb745
--- /dev/null
+++ b/config/systemd/user/wayvnc1.service
@@ -0,0 +1,5 @@
+[Unit]
+Description=wayvnc for wayland display 1
+
+[Service]
+ExecStart="/home/cynerd/.local/sbin/wayvnc1"
diff --git a/install b/install
index e1d2193..e1828f2 100755
--- a/install
+++ b/install
@@ -36,7 +36,12 @@ fi
if ask "ssh" "Install SSH config"; then
mkdir -p ~/.cache/ssh # directory for sockets
inst private/ssh_config ~/.ssh/config
- inst local/bin/sshvnc ~/.local/bin/sshvnc
+fi
+
+if ask "wayvnc" "Install wayland access"; then
+ inst local/bin/sshvnc ~/.local/bin/
+ inst local/sbin/wayvnc1 ~/.local/sbin/
+ inst config/systemd/user/wayvnc1.service ~/.config/systemd/user/
fi
if ask "vim" "Install VIM scripts"; then
diff --git a/local/bin/sshvnc b/local/bin/sshvnc
index fcee459..427a785 100755
--- a/local/bin/sshvnc
+++ b/local/bin/sshvnc
@@ -1,17 +1,17 @@
#!/usr/bin/env bash
-set -eu
+set -eux
target="$1"
-localport="5901"
+localport="5911"
while lsof -i:$localport; do
localport=$((localport + 1))
done
-ssh -L "$localport":localhost:5900 "$target" \
- 'start-stop-daemon -v -w 1000 -bmp "/var/run/user/$(id -u)/sshvnc.pid" -e WAYLAND_DISPLAY=wayland-1 -S wayvnc localhost 5900'
+ssh -L "$localport":localhost:5901 "$target" \
+ 'systemctl --user start wayvnc1.service'
vncviewer "localhost:$localport"
-ssh "$target" 'start-stop-daemon -v -p /var/run/user/$(id -u)/sshvnc.pid -K wayvnc'
-ssh -O cancel -L "$localport":localhost:5900 "$target"
+ssh "$target" 'systemctl --user stop wayvnc1.service'
+ssh -O cancel -L "$localport":localhost:5901 "$target"
diff --git a/local/sbin/wayvnc1 b/local/sbin/wayvnc1
new file mode 100755
index 0000000..b21479d
--- /dev/null
+++ b/local/sbin/wayvnc1
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+export WAYLAND_DISPLAY=wayland-1
+exec wayvnc localhost 5901