Add subcmd virtmon (WIP)

This commit is contained in:
clsty
2025-11-12 17:11:14 +08:00
parent efcb826f5c
commit f2cd533ae9
3 changed files with 48 additions and 1 deletions
+13
View File
@@ -0,0 +1,13 @@
# This script is meant to be sourced.
# It's not for directly running.
# shellcheck shell=bash
readarray -t vmon < <(hyprctl -j monitors all | jq -r '.[] | select(.name | test("^HEADLESS-")) | .name')
if [ "${#vmon[@]}" -gt 0 ]; then
printf '%s\n' "${vmon[@]}"
else
echo "no headless monitors found" >&2
exit 1
fi
+33
View File
@@ -0,0 +1,33 @@
# Handle args for subcmd: checkdeps
# shellcheck shell=bash
showhelp(){
echo -e "Syntax: $0 virtmon [OPTIONS]
Create virtual monitor for testing multi-monitors.
Options:
-h, --help Show this help message
"
}
# `man getopt` to see more
para=$(getopt \
-o h \
-l help \
-n "$0" -- "$@")
[ $? != 0 ] && echo "$0: Error when getopt, please recheck parameters." && exit 1
#####################################################################################
eval set -- "$para"
while true ; do
case "$1" in
-h|--help) showhelp;exit;;
--) shift;break ;;
*) sleep 0 ;;
esac
done
#if [[ -f "$1" ]]; then
# echo "Using list file \"$1\".";LIST_FILE_PATH="$1";shift 1
#else
# echo "Wrong path \"$1\" of list file.";exit 1
#fi