Allow to source local config file

This commit is contained in:
Jeremy Gardais 2020-12-21 21:07:14 +01:00
parent 0aecd90642
commit f2373a325a
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 19 additions and 3 deletions

22
ecran
View File

@ -53,6 +53,10 @@ The second output is: ${SECOND_OUTPUT_NAME}."
fi
## }}}
[ -f "${HOME}/.config/xrandr.conf" ] && \
. "${HOME}/.config/xrandr.conf" && \
printf "%b\n" 'Use local config file.'
}
# }}}
get_primary_output_name() { # {{{
@ -131,7 +135,11 @@ define_vars
case "${1}" in
primary | off )
## TODO: One command to enable primary screen and a loop to disable all other connected output
xrandr --output "${PRIMARY_OUTPUT_NAME:=/dev/null}" --auto
if [ -n "${PRIMARY_OUTPUT_MODE}" ]; then
xrandr --output "${PRIMARY_OUTPUT_NAME:=/dev/null}" --mode "${PRIMARY_OUTPUT_MODE}"
else
xrandr --output "${PRIMARY_OUTPUT_NAME:=/dev/null}" --auto
fi
if [ -n "${SECOND_OUTPUT_NAME}" ]; then xrandr --output "${SECOND_OUTPUT_NAME:=/dev/null}" --off ; fi
printf "%b\n" 'Enable only primary output'
;;
@ -141,11 +149,19 @@ case "${1}" in
printf "%b\n" 'Xrandr for second output left-of primary screen'
;;
rightof | right-of | home )
xrandr --output "${SECOND_OUTPUT_NAME:=/dev/null}" --auto --right-of "${PRIMARY_OUTPUT_NAME:=/dev/null}" --output "${PRIMARY_OUTPUT_NAME:=/dev/null}" --auto
if [ -n "${PRIMARY_OUTPUT_MODE}" ]; then
xrandr --output "${SECOND_OUTPUT_NAME:=/dev/null}" --auto --right-of "${PRIMARY_OUTPUT_NAME:=/dev/null}" --output "${PRIMARY_OUTPUT_NAME:=/dev/null}" --mode "${PRIMARY_OUTPUT_MODE}"
else
xrandr --output "${SECOND_OUTPUT_NAME:=/dev/null}" --auto --right-of "${PRIMARY_OUTPUT_NAME:=/dev/null}" --output "${PRIMARY_OUTPUT_NAME:=/dev/null}" --auto
fi
printf "%b\n" 'Xrandr for second output left-of primary screen'
;;
above )
xrandr --output "${SECOND_OUTPUT_NAME:=/dev/null}" --auto --above "${PRIMARY_OUTPUT_NAME:=/dev/null}" --output "${PRIMARY_OUTPUT_NAME:=/dev/null}" --auto
if [ -n "${PRIMARY_OUTPUT_MODE}" ]; then
xrandr --output "${SECOND_OUTPUT_NAME:=/dev/null}" --auto --above "${PRIMARY_OUTPUT_NAME:=/dev/null}" --output "${PRIMARY_OUTPUT_NAME:=/dev/null}" --mode "${PRIMARY_OUTPUT_MODE}"
else
xrandr --output "${SECOND_OUTPUT_NAME:=/dev/null}" --auto --above "${PRIMARY_OUTPUT_NAME:=/dev/null}" --output "${PRIMARY_OUTPUT_NAME:=/dev/null}" --auto
fi
printf "%b\n" 'Xrandr for second output above primary screen'
;;
out | game | second )