From 55b5d7145dc05726c5f24a5a54ed16aa40811616 Mon Sep 17 00:00:00 2001 From: clsty Date: Wed, 12 Nov 2025 23:11:50 +0800 Subject: [PATCH] Update virtmon --- sdata/subcmd-virtmon/0.run.sh | 30 ++++++++++++++++-------------- sdata/subcmd-virtmon/options.sh | 16 ++++++++-------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/sdata/subcmd-virtmon/0.run.sh b/sdata/subcmd-virtmon/0.run.sh index 289654c37..ee27eb3d6 100644 --- a/sdata/subcmd-virtmon/0.run.sh +++ b/sdata/subcmd-virtmon/0.run.sh @@ -47,27 +47,29 @@ echo "Setting geometry..." x hyprctl keyword monitor ${vmon_tester},${VMON_RESOLUTION}@${VMON_FPS},${VMON_POSITION},${VMON_SCALE}${VMON_EXTRA} e="%s${STY_RST}\n" -printf "${STY_CYAN}$e" "=========================================" -printf "${STY_BLUE}$e" "Use a VNC client to connect to the virtual monitor." -printf "${STY_RED}$e" " Port: $vnc_port" -printf "${STY_RED}$e" " IP: choose a suitable one from below:" +printf "${STY_YELLOW}=========================================$e" +printf "${STY_CYAN}The status of the virtual monitor:$e" +printf "${STY_BLUE}Resolution: ${STY_UNDERLINE}${STY_INVERT}${VMON_RESOLUTION}$e" +printf "${STY_BLUE}Frame rate: ${STY_UNDERLINE}${STY_INVERT}${VMON_FPS}$e" +printf "${STY_CYAN}Use a VNC client to connect to the virtual monitor.$e" +printf "${STY_BLUE}Port: ${STY_UNDERLINE}${STY_INVERT}$vnc_port$e" +printf "${STY_BLUE}IP: use a suitable one from below:$e" +printf ${STY_PURPLE} LANG=C LC_ALL=C ip -o addr show up | grep -v -E 'docker|veth|virbr' | awk '{split($4,a,"/"); print $2"\t"a[1]}' -printf "${STY_YELLOW}$e" "The status of the virtual monitor:" -printf "${STY_YELLOW}$e" " Resolution: ${VMON_RESOLUTION}" -printf "${STY_YELLOW}$e" " Frame rate: ${VMON_FPS}" -printf "${STY_GREEN}$e" "Hint:" -printf "${STY_GREEN}$e" " The VNC client will ask you about server address," -printf "${STY_GREEN}$e" " either joined as : or separately." -printf "${STY_GREEN}$e" " As for username and password, just leave them as empty." -printf "${STY_CYAN}$e" "=========================================" +printf ${STY_RST} +printf "${STY_CYAN}Hint:$e" +printf "${STY_GREEN} The VNC client will ask you about server address,$e" +printf "${STY_GREEN} either joined as : or separately.$e" +printf "${STY_GREEN} As for username and password, just leave them as empty.$e" +printf "${STY_YELLOW}=========================================$e" if [ "$RUNNING_IN_BACKGROUND" = true ];then echo "wayvnc now running in background. Run again with --clean to cleanup." - nohup wayvnc --socket=$tester_socket -f=${VMON_FPS} -o=${vmon_tester} --log-level=${WAYVNC_LOGLEVEL} 0.0.0.0 $vnc_port > $(mktemp) 2>&1 & + nohup wayvnc ${WAYVNC_EX_ARGS} --socket=$tester_socket -f=${VMON_FPS} -o=${vmon_tester} --log-level=${WAYVNC_LOGLEVEL} 0.0.0.0 $vnc_port > $(mktemp) 2>&1 & disown else echo "wayvnc now running, press Ctrl-C to quit." - wayvnc --socket=$tester_socket -f=${VMON_FPS} -o=${vmon_tester} --log-level=${WAYVNC_LOGLEVEL} 0.0.0.0 $vnc_port + wayvnc ${WAYVNC_EX_ARGS} --socket=$tester_socket -f=${VMON_FPS} -o=${vmon_tester} --log-level=${WAYVNC_LOGLEVEL} 0.0.0.0 $vnc_port echo "wayvnc stopped. Cleaning..." hyprctl output remove "${vmon_tester}" fi diff --git a/sdata/subcmd-virtmon/options.sh b/sdata/subcmd-virtmon/options.sh index d4cbda84d..bfe51a59d 100644 --- a/sdata/subcmd-virtmon/options.sh +++ b/sdata/subcmd-virtmon/options.sh @@ -20,21 +20,21 @@ Note: Options: -h, --help Show this help message and exit -c, --clean Clean all tester monitors and wayvnc sessions and exit - - -d, --daemon Running in background + -d, --daemon Run in background For the syntax of following options, see also Hyprland Wiki: https://wiki.hypr.land/Configuring/Monitors - --res Resolution, by default $VMON_RESOLUTION - --fps Refresh rate and FPS, by default $VMON_FPS - --pos Position, by default $VMON_POSITION - --sca Scale, by default $VMON_SCALE - --ext Extra args, e.g. \"transform, 1\" + --res Resolution, by default ${STY_UNDERLINE}$VMON_RESOLUTION${STY_RST} + --fps Refresh rate and FPS, by default ${STY_UNDERLINE}$VMON_FPS${STY_RST} + --pos Position, by default ${STY_UNDERLINE}$VMON_POSITION${STY_RST} + Examples: ${STY_UNDERLINE}auto-left${STY_RST}, ${STY_UNDERLINE}0x-1080${STY_RST} + --sca Scale, by default ${STY_UNDERLINE}$VMON_SCALE${STY_RST} + --ext Extra args, e.g. ${STY_UNDERLINE}transform, 1${STY_RST} Tip: Recommended VNC client: - Android: AVNC (https://github.com/gujjwal00/avnc) - Linux X11, Windows and MacOS: TigerVNC (https://github.com/TigerVNC/tigervnc) -- Linux Wayland: Remmina-VNC (https://remmina.org/remmina-vnc/) +- Linux Wayland: Remmina-VNC (https://remmina.org/remmina-vnc) " } # `man getopt` to see more