improving skel/disp. might move to bin/ at some point

This commit is contained in:
q
2018-08-12 09:53:37 +03:00
parent cbc826bc8f
commit f2a148f353

View File

@@ -115,7 +115,14 @@ _xrandr() {
xrandr "$@" xrandr "$@"
} }
_list_arandr() { _list_arandr() {
test -d "$ARANDR_FOLDER" || return [[ -d "$ARANDR_FOLDER" ]] || {
_arandr_empty
return
}
[[ $(ls -A "$ARANDR_FOLDER") ]] || {
_arandr_empty
return
}
ls "$ARANDR_FOLDER" | head -n 6 | awk '{printf(" %d %s\n", NR+3, $0) }' ls "$ARANDR_FOLDER" | head -n 6 | awk '{printf(" %d %s\n", NR+3, $0) }'
} }
_run_arandr_script() { _run_arandr_script() {
@@ -125,6 +132,9 @@ _run_arandr_script() {
sh -x "$ARANDR_FOLDER/$script_name" sh -x "$ARANDR_FOLDER/$script_name"
} }
} }
_arandr_empty() {
echo " [No arandr scripts]"
}
_help() { _help() {
echo 'DISPtool echo 'DISPtool
@@ -144,7 +154,7 @@ _help() {
Second argument to any previous sets the gamma correction value Second argument to any previous sets the gamma correction value
Configuration file: '$CONFIG' Configuration file: '$CONFIG'
Display settings saved with arandr are displayed last: Display settings saved with arandr are displayed last
' '
_list_arandr _list_arandr
exit exit
@@ -164,7 +174,8 @@ i=$1
if [ -z "$1" ]; then if [ -z "$1" ]; then
echo "Currently connected displays:" echo "Currently connected displays:"
xrandr | grep --color=always -e ".* connected" -e '.*\*' | awk '{ print $1,$2,$3} ' xrandr | grep --color=always -e ".* connected" -e '.*\*' | awk '{ print $1,$2,$3} '
echo 'Menu choices:
echo 'See further help by running with argument: -h
0 Run "arandr" to setup manually 0 Run "arandr" to setup manually
1 Main display only ('$MAIN') 1 Main display only ('$MAIN')
@@ -173,9 +184,7 @@ if [ -z "$1" ]; then
a All displays on a All displays on
s Create and edit configuration '$CONFIGURED' s Create and edit configuration '$CONFIGURED'
See further help by running with argument: -h Settings by arandr:'
Settings from arandr:
'
_list_arandr _list_arandr
read -N 1 i read -N 1 i
echo "" echo ""