forked from Shinonome/dots-hyprland
Enable hypr_mon_guard by default
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
ensure_cmds wayvnc lsof jq ip
|
ensure_cmds wayvnc lsof jq ip
|
||||||
|
|
||||||
enable_hypr_mon_guard(){
|
start_hypr_mon_guard(){
|
||||||
if ! pgrep -x hypr_mon_guard >/dev/null 2>&1; then
|
if ! pgrep -x hypr_mon_guard >/dev/null 2>&1; then
|
||||||
if PATH=$PATH:${REPO_ROOT}/sdata/subcmd-virtmon command -v hypr_mon_guard ; then
|
if PATH=$PATH:${REPO_ROOT}/sdata/subcmd-virtmon command -v hypr_mon_guard ; then
|
||||||
echo "Running hypr_mon_guard."
|
echo "Running hypr_mon_guard."
|
||||||
@@ -16,8 +16,8 @@ enable_hypr_mon_guard(){
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
if [[ "${ENABLE_HYPR_MON_GUARD}" = true ]]; then
|
if ! [[ "${DISABLE_HYPR_MON_GUARD}" = true ]]; then
|
||||||
enable_hypr_mon_guard
|
start_hypr_mon_guard
|
||||||
fi
|
fi
|
||||||
|
|
||||||
readarray -t vmon_ids < <(hyprctl -j monitors all | jq -r '.[] | select(.name | test("^TESTER-")) | .name | sub("^TESTER-"; "")')
|
readarray -t vmon_ids < <(hyprctl -j monitors all | jq -r '.[] | select(.name | test("^TESTER-")) | .name | sub("^TESTER-"; "")')
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#!/usr/bin/bash
|
#!/usr/bin/bash
|
||||||
# This script is to prevent hyprland from not responding to any input when no monitor is enabled.
|
# This script is to prevent hyprland from not responding to any input when no monitor is enabled.
|
||||||
|
# When this script is running in background,
|
||||||
|
# it will be safe to temporarily disable monitors using hyprctl.
|
||||||
# The shebang cannot be #!/usr/bin/env bash , idk why
|
# The shebang cannot be #!/usr/bin/env bash , idk why
|
||||||
while true; do
|
while true; do
|
||||||
readarray -t enabled_mons < <(hyprctl -j monitors all | jq -r '.[] | select(.disabled == false) | .name')
|
readarray -t enabled_mons < <(hyprctl -j monitors all | jq -r '.[] | select(.disabled == false) | .name')
|
||||||
|
|||||||
@@ -21,8 +21,7 @@ Options:
|
|||||||
-h, --help Show this help message and exit
|
-h, --help Show this help message and exit
|
||||||
-c, --clean Clean all tester monitors and wayvnc sessions and exit
|
-c, --clean Clean all tester monitors and wayvnc sessions and exit
|
||||||
-d, --daemon Run in background
|
-d, --daemon Run in background
|
||||||
-g, --guard Enable hypr_mon_guard so it will be safe to
|
--no-guard Disable hypr_mon_guard
|
||||||
temporarily disable monitors using hyprctl.
|
|
||||||
|
|
||||||
For the syntax of following options, see also Hyprland Wiki:
|
For the syntax of following options, see also Hyprland Wiki:
|
||||||
https://wiki.hypr.land/Configuring/Monitors
|
https://wiki.hypr.land/Configuring/Monitors
|
||||||
@@ -41,8 +40,8 @@ Tip: Recommended VNC client:
|
|||||||
}
|
}
|
||||||
# `man getopt` to see more
|
# `man getopt` to see more
|
||||||
para=$(getopt \
|
para=$(getopt \
|
||||||
-o hcdg \
|
-o hcd \
|
||||||
-l help,clean,daemon,guard,res:,fps:,pos:,sca:,ext: \
|
-l help,clean,daemon,no-guard,res:,fps:,pos:,sca:,ext: \
|
||||||
-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
|
||||||
#####################################################################################
|
#####################################################################################
|
||||||
@@ -60,7 +59,7 @@ while true ; do
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
-c|--clean) CLEAN_TESTER_MONITORS=true;shift;;
|
-c|--clean) CLEAN_TESTER_MONITORS=true;shift;;
|
||||||
-d|--daemon) RUNNING_IN_BACKGROUND=true;shift;;
|
-d|--daemon) RUNNING_IN_BACKGROUND=true;shift;;
|
||||||
-g|--guard) ENABLE_HYPR_MON_GUARD=true;shift;;
|
--no-guard) DISABLE_HYPR_MON_GUARD=true;shift;;
|
||||||
--res) VMON_RESOLUTION="$2";shift 2;;
|
--res) VMON_RESOLUTION="$2";shift 2;;
|
||||||
--fps) VMON_FPS="$2";shift 2;;
|
--fps) VMON_FPS="$2";shift 2;;
|
||||||
--pos) VMON_POSITION="$2";shift 2;;
|
--pos) VMON_POSITION="$2";shift 2;;
|
||||||
|
|||||||
Reference in New Issue
Block a user