forked from Shinonome/dots-hyprland
Update virtmon
This commit is contained in:
@@ -3,11 +3,30 @@
|
|||||||
|
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
|
|
||||||
readarray -t vmon < <(hyprctl -j monitors all | jq -r '.[] | select(.name | test("^HEADLESS-")) | .name')
|
readarray -t vmons < <(hyprctl -j monitors all | jq -r '.[] | select(.name | test("^HEADLESS-")) | .name')
|
||||||
|
|
||||||
if [ "${#vmon[@]}" -gt 0 ]; then
|
if [ "${#vmons[@]}" -gt 0 ]; then
|
||||||
printf '%s\n' "${vmon[@]}"
|
echo "headless monitors found:"
|
||||||
|
printf '%s\n' "${vmons[@]}"
|
||||||
|
if [[ ! "${KEEP_VIRTUAL_MONITORS}" = true ]]; then
|
||||||
|
echo "Cleaning..."
|
||||||
|
for i in "${vmons[@]}"; do
|
||||||
|
x hyprctl output remove "$i"
|
||||||
|
done
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "no headless monitors found" >&2
|
echo "No headless monitors found."
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Creating headless monitor..."
|
||||||
|
readarray -t vmons_old < <(hyprctl -j monitors all | jq -r '.[] | select(.name | test("^HEADLESS-")) | .name')
|
||||||
|
x hyprctl output create headless
|
||||||
|
readarray -t vmons_new < <(hyprctl -j monitors all | jq -r '.[] | select(.name | test("^HEADLESS-")) | .name')
|
||||||
|
#echo "Setting geometry..."
|
||||||
|
#${vmon_new}
|
||||||
|
|
||||||
|
echo "Using wayvnc to share monitor..."
|
||||||
|
wayvnc -o=${vmon_new} --log-level=trace 0.0.0.0 5901
|
||||||
|
|
||||||
|
echo "Cleaning the new headless monitor..."
|
||||||
|
x hyprctl output remove "${vmon_new}"
|
||||||
|
|||||||
@@ -8,12 +8,13 @@ Create virtual monitor for testing multi-monitors.
|
|||||||
|
|
||||||
Options:
|
Options:
|
||||||
-h, --help Show this help message
|
-h, --help Show this help message
|
||||||
|
-k, --keep Do not remove virtual monitors
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
# `man getopt` to see more
|
# `man getopt` to see more
|
||||||
para=$(getopt \
|
para=$(getopt \
|
||||||
-o h \
|
-o hk \
|
||||||
-l help \
|
-l help,keep \
|
||||||
-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
|
||||||
#####################################################################################
|
#####################################################################################
|
||||||
@@ -26,6 +27,15 @@ while true ; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
eval set -- "$para"
|
||||||
|
while true ; do
|
||||||
|
case "$1" in
|
||||||
|
-k|--keep) KEEP_VIRTUAL_MONITORS=true;shift;;
|
||||||
|
--) shift;break ;;
|
||||||
|
*) sleep 0 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
#if [[ -f "$1" ]]; then
|
#if [[ -f "$1" ]]; then
|
||||||
# echo "Using list file \"$1\".";LIST_FILE_PATH="$1";shift 1
|
# echo "Using list file \"$1\".";LIST_FILE_PATH="$1";shift 1
|
||||||
#else
|
#else
|
||||||
|
|||||||
Reference in New Issue
Block a user