forked from Shinonome/dots-hyprland
Update virtmon
This commit is contained in:
@@ -16,13 +16,14 @@ para=$(getopt \
|
|||||||
-l help \
|
-l help \
|
||||||
-n "$0" -- "$@")
|
-n "$0" -- "$@")
|
||||||
[ $? != 0 ] && echo "$0: Error when getopt, please recheck parameters." && exit 1
|
[ $? != 0 ] && echo "$0: Error when getopt, please recheck parameters." && exit 1
|
||||||
|
echo $para
|
||||||
#####################################################################################
|
#####################################################################################
|
||||||
eval set -- "$para"
|
eval set -- "$para"
|
||||||
while true ; do
|
while true ; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-h|--help) showhelp;exit;;
|
-h|--help) showhelp;exit;;
|
||||||
--) shift;break ;;
|
--) shift;break ;;
|
||||||
*) sleep 0 ;;
|
*) echo -e "$0: Wrong parameters.";exit 1;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ while true ; do
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
-h|--help) showhelp;exit;;
|
-h|--help) showhelp;exit;;
|
||||||
-c|--clean) cleancache;shift;;
|
-c|--clean) cleancache;shift;;
|
||||||
--) break ;;
|
--) shift;break ;;
|
||||||
*) shift ;;
|
*) shift ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@@ -93,7 +93,7 @@ while true ; do
|
|||||||
fi;;
|
fi;;
|
||||||
|
|
||||||
## Ending
|
## Ending
|
||||||
--) break ;;
|
--) shift;break ;;
|
||||||
*) echo -e "$0: Wrong parameters.";exit 1;;
|
*) echo -e "$0: Wrong parameters.";exit 1;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -22,6 +22,6 @@ while true ; do
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
-h|--help) showhelp;exit;;
|
-h|--help) showhelp;exit;;
|
||||||
--) shift;break ;;
|
--) shift;break ;;
|
||||||
*) sleep 0 ;;
|
*) echo -e "$0: Wrong parameters.";exit 1;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -9,12 +9,15 @@ readarray -t vmon_ids < <(hyprctl -j monitors all | jq -r '.[] | select(.name |
|
|||||||
|
|
||||||
if [[ "${CLEAN_TESTER_MONITORS}" = true ]]; then
|
if [[ "${CLEAN_TESTER_MONITORS}" = true ]]; then
|
||||||
echo "Cleaning tester monitors..."
|
echo "Cleaning tester monitors..."
|
||||||
for i in "TESTER-${vmon_ids[@]}"; do
|
for i in "${vmon_ids[@]}"; do
|
||||||
x hyprctl output remove "$i"
|
echo "Removing tester monitor: TESTER-$i..."
|
||||||
|
x hyprctl output remove "TESTER-$i"
|
||||||
done
|
done
|
||||||
echo "Cleaning tester wayvnc sessions..."
|
echo "Cleaning tester wayvnc sessions..."
|
||||||
for tester_socket in /tmp/wayvncctl_tester_* ; do
|
for i in /tmp/wayvncctl_tester_* ; do
|
||||||
x wayvncctl --socket=$tester_socket -r wayvnc-exit
|
# When no target is matched, * will not be expanded
|
||||||
|
[ -e "$i" ] || continue
|
||||||
|
x bash -c "wayvncctl --socket=$i -r wayvnc-exit || rm $i"
|
||||||
done
|
done
|
||||||
echo "Cleaning complete, exit..."
|
echo "Cleaning complete, exit..."
|
||||||
exit 0
|
exit 0
|
||||||
@@ -35,7 +38,7 @@ fi
|
|||||||
tester_socket=/tmp/wayvncctl_tester_$vnc_port
|
tester_socket=/tmp/wayvncctl_tester_$vnc_port
|
||||||
# In case this exists for some reason
|
# In case this exists for some reason
|
||||||
try rm $tester_socket
|
try rm $tester_socket
|
||||||
vmon_tester=TESTER-$vnc_port;break
|
vmon_tester=TESTER-$vnc_port
|
||||||
|
|
||||||
echo "Creating tester monitor..."
|
echo "Creating tester monitor..."
|
||||||
x hyprctl output create headless ${vmon_tester}
|
x hyprctl output create headless ${vmon_tester}
|
||||||
@@ -43,22 +46,22 @@ x hyprctl output create headless ${vmon_tester}
|
|||||||
echo "Setting geometry..."
|
echo "Setting geometry..."
|
||||||
x hyprctl keyword monitor ${vmon_tester},${VMON_RESOLUTION}@${VMON_FPS},${VMON_POSITION},${VMON_SCALE}${VMON_EXTRA}
|
x hyprctl keyword monitor ${vmon_tester},${VMON_RESOLUTION}@${VMON_FPS},${VMON_POSITION},${VMON_SCALE}${VMON_EXTRA}
|
||||||
|
|
||||||
echo "========================================="
|
printf "%s\n" "========================================="
|
||||||
echo "Use a VNC client to connect to the virtual monitor."
|
printf "%s\n" "Use a VNC client to connect to the virtual monitor."
|
||||||
echo " Port: $vnc_port"
|
printf "%s\n" " Port: $vnc_port"
|
||||||
echo " IP: choose a suitable one from below:"
|
printf "%s\n" " IP: choose a suitable one from below:"
|
||||||
ip -o addr show up | grep -v -E 'docker|veth|virbr' | awk '{split($4,a,"/"); print $2"\t"a[1]}'
|
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]}'
|
||||||
echo "The status of the virtual monitor:"
|
printf "%s\n" "The status of the virtual monitor:"
|
||||||
echo " Resolution: ${VMON_RESOLUTION}"
|
printf "%s\n" " Resolution: ${VMON_RESOLUTION}"
|
||||||
echo " Frame rate: ${VMON_FPS}"
|
printf "%s\n" " Frame rate: ${VMON_FPS}"
|
||||||
echo "Hint:"
|
printf "%s\n" "Hint:"
|
||||||
echo " The VNC client will ask you about server address,"
|
printf "%s\n" " The VNC client will ask you about server address,"
|
||||||
echo " either joined as <IP>:<Port> or separately."
|
printf "%s\n" " either joined as <IP>:<Port> or separately."
|
||||||
echo " As for username and password, just leave them as empty."
|
printf "%s\n" " As for username and password, just leave them as empty."
|
||||||
echo "========================================="
|
printf "%s\n" "========================================="
|
||||||
echo "Launching wayvnc..."
|
|
||||||
|
|
||||||
if [ "$RUNNING_IN_BACKGROUND" = true ];then
|
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 --socket=$tester_socket -f=${VMON_FPS} -o=${vmon_tester} --log-level=${WAYVNC_LOGLEVEL} 0.0.0.0 $vnc_port > $(mktemp) 2>&1 &
|
||||||
disown
|
disown
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ while true ; do
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
-h|--help) showhelp;exit;;
|
-h|--help) showhelp;exit;;
|
||||||
--) shift;break ;;
|
--) shift;break ;;
|
||||||
*) sleep 0 ;;
|
*) shift ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -56,6 +56,6 @@ while true ; do
|
|||||||
--sca) VMON_SCALE="$2";shift 2;;
|
--sca) VMON_SCALE="$2";shift 2;;
|
||||||
--ext) VMON_EXTRA=", $2";shift 2;;
|
--ext) VMON_EXTRA=", $2";shift 2;;
|
||||||
--) shift;break ;;
|
--) shift;break ;;
|
||||||
*) sleep 0 ;;
|
*) echo -e "$0: Wrong parameters.";exit 1;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user