aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAargh Rai <aargh.rai+git@gmail.com>2026-08-12 11:27:28 +0530
committerAargh Rai <aargh.rai+git@gmail.com>2026-08-12 11:27:28 +0530
commit961fff2de6ef80c8ef0ccc4b2e3324f39ab619e6 (patch)
treefd820213530d2b360448a938a0030c9f3556664e
parent1cb4e47ccadfe3c673d46808838eca751001609e (diff)
vnc extend like second monitor
-rw-r--r--i3/config16
-rwxr-xr-xi3/setup-vnc-monitor.sh31
-rw-r--r--nixos/apps.nix4
-rwxr-xr-xscripts/vnc-extend.sh41
4 files changed, 87 insertions, 5 deletions
diff --git a/i3/config b/i3/config
index eb78fa9..34f459f 100644
--- a/i3/config
+++ b/i3/config
@@ -1,8 +1,5 @@
set $mod Mod4
font pango:Jetbrains Mono Nerd Font 16
-exec --no-startup-id dex --autostart --environment i3
-exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork
-exec --no-startup-id nm-applet
set $refresh_i3status killall -SIGUSR1 i3status
bindsym XF86AudioRaiseVolume exec --no-startup-id wpctl set-volume @DEFAULT_SINK@ 0.1+ && $refresh_i3status
@@ -69,6 +66,17 @@ set $ws8 "8"
set $ws9 "9"
set $ws10 "10"
+workspace $ws1 output PHYSICAL
+workspace $ws2 output PHYSICAL
+workspace $ws3 output PHYSICAL
+workspace $ws4 output PHYSICAL
+workspace $ws5 output PHYSICAL
+workspace $ws6 output VNC
+workspace $ws7 output VNC
+workspace $ws8 output VNC
+workspace $ws9 output VNC
+workspace $ws10 output VNC
+
bindsym $mod+1 workspace number $ws1
bindsym $mod+2 workspace number $ws2
bindsym $mod+3 workspace number $ws3
@@ -116,6 +124,8 @@ bar {
}
exec --no-startup-id xrandr --auto
+exec --no-startup-id ~/.config/i3/setup-vnc-monitor.sh
+exec --no-startup-id nitrogen --restore
set $bg #282828
set $red #cc241d
diff --git a/i3/setup-vnc-monitor.sh b/i3/setup-vnc-monitor.sh
new file mode 100755
index 0000000..cfbcc2e
--- /dev/null
+++ b/i3/setup-vnc-monitor.sh
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+export DISPLAY=:0
+
+# Make the X framebuffer large enough for:
+# physical monitor: 1920x1080
+# VNC monitor: 1366x768
+#
+# Total width = 1920 + 1366 = 3286
+xrandr --fb 3286x1080
+
+# Remove the default Xvnc-style monitor if one exists.
+xrandr --delmonitor VNC-0 2>/dev/null || true
+
+# Don't create duplicates when i3 reloads.
+xrandr --delmonitor VNC-1 2>/dev/null || true
+xrandr --delmonitor VNC-2 2>/dev/null || true
+
+# Physical monitor is 1920x1080 at 0,0.
+xrandr --setmonitor PHYSICAL \
+ 1920/509x1080/286+0+0 \
+ none
+
+# Virtual VNC monitor is 1366x768 at 1920,0.
+xrandr --setmonitor VNC \
+ 1366/361x768/203+1920+0 \
+ none
+
+xrandr --listmonitors
diff --git a/nixos/apps.nix b/nixos/apps.nix
index 0c7b451..1f333cf 100644
--- a/nixos/apps.nix
+++ b/nixos/apps.nix
@@ -41,6 +41,6 @@
programs.thunderbird.enable = true;
- networking.firewall.allowedTCPPorts = [ 53317 41567 5173 ];
- networking.firewall.allowedUDPPorts = [ 53317 41567 5173 ];
+ networking.firewall.allowedTCPPorts = [ 53317 41567 5173 22 ];
+ networking.firewall.allowedUDPPorts = [ 53317 41567 5173 22 ];
}
diff --git a/scripts/vnc-extend.sh b/scripts/vnc-extend.sh
new file mode 100755
index 0000000..6004958
--- /dev/null
+++ b/scripts/vnc-extend.sh
@@ -0,0 +1,41 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+DISPLAY=:0
+
+x11vnc \
+ -display :0 \
+ -auth /run/user/1000/lyxauth \
+ -clip 1366x768+1920+0 \
+ -viewonly \
+ -noshm \
+ -noxdamage \
+ -nowf \
+ -forever \
+ -shared \
+ -rfbauth "$HOME/.config/vnc/passwd"
+
+# x11vnc \
+# -display :0 \
+# -auth /run/user/1000/lyxauth \
+# -clip 1366x768+1920+0 \
+# -xwarppointer \
+# -noshm \
+# -noxdamage \
+# -forever \
+# -shared \
+# -rfbauth "$HOME/.config/vnc/passwd" \
+# -debug_pointer
+
+# x11vnc \
+# -display :0 \
+# -auth /run/user/1000/lyxauth \
+# -clip 1366x768+1920+0 \
+# -noshm \
+# -noxdamage \
+# -nowf \
+# -forever \
+# -shared \
+# -rfbauth "$HOME/.config/vnc/passwd" \
+# -debug_pointer