disp allow names

This commit is contained in:
2023-09-26 09:51:05 +03:00
parent a21d62dfce
commit 87056798fe

View File

@@ -143,9 +143,14 @@ _list_arandr() {
return
}
ls -p1 "$ARANDR_FOLDER" | grep -v / | head -n 6 | awk '{printf(" %d %s\n", NR+3, $0) }'
ls -p1 "$ARANDR_FOLDER" | grep -v / | awk '{printf(" %s\n", $0) }' | tail -n +7
}
_run_arandr_script() {
script_name=$( ls -p1 "$ARANDR_FOLDER" | grep -v / | awk 'NR=='$1'-3 {print $0}' )
if [[ "$1" =~ ^[0-9]$ ]]; then
script_name=$( ls -p1 "$ARANDR_FOLDER" | grep -v / | awk 'NR=='$1'-3 {print $0}' )
else
script_name=$( ls -p1 "$ARANDR_FOLDER" | grep "$1" | head -n 1 )
fi
[[ -f "$ARANDR_FOLDER/$script_name" ]] && {
echo Running script: $script_name
sh -x "$ARANDR_FOLDER/$script_name"
@@ -212,12 +217,13 @@ if [ -z "$1" ]; then
fi
case $i in
"a"*) _allon; ;;
"p"*) _cloneprimary; ;;
"s"*) _setup; ;;
a|all) _allon; ;;
p|primary) _cloneprimary; ;;
s|setup) _setup; ;;
0) ( arandr & ); ;;
1) _display_main; ;;
2) _display_presentation; ;;
3) _display_workstation; ;;
[4-9]) _run_arandr_script $i; ;;
*) _run_arandr_script $i; ;;
esac