Add define_vars function
This commit is contained in:
parent
3b5b7aac64
commit
43a5a54ffe
29
ecran
29
ecran
|
@ -16,7 +16,6 @@ readonly RESET='\033[0m'
|
|||
readonly COLOR_DEBUG="${PURPLE}"
|
||||
# }}}
|
||||
|
||||
# Functions {{{
|
||||
debug_message() { # {{{
|
||||
|
||||
local_message="${1}"
|
||||
|
@ -27,9 +26,30 @@ debug_message() { # {{{
|
|||
return 0
|
||||
}
|
||||
# }}}
|
||||
define_vars() { # {{{
|
||||
|
||||
return_second_output_name="0"
|
||||
|
||||
SECOND_OUTPUT=$(xrandr | grep " connected" | grep -v "${MAIN_SCREEN}" | awk 'NR==1{ print $1 }')
|
||||
|
||||
debug_message "define_vars − \
|
||||
The second connected output is: ${SECOND_OUTPUT}."
|
||||
|
||||
return "${return_second_output_name}"
|
||||
}
|
||||
# }}}
|
||||
main() { # {{{
|
||||
|
||||
## Define all vars
|
||||
define_vars
|
||||
|
||||
}
|
||||
# }}}
|
||||
|
||||
main
|
||||
|
||||
# Manage arguments # {{{
|
||||
# This code can't be in a function due to arguments
|
||||
case "${1}" in
|
||||
ds | dockstation | work )
|
||||
xrandr --output DP-1 --mode 1920x1080 --left-of "${MAIN_SCREEN:=/dev/null}" --output "${MAIN_SCREEN:=/dev/null}" --mode 1366x768
|
||||
|
@ -61,10 +81,13 @@ case "${1}" in
|
|||
;;
|
||||
* )
|
||||
printf 'Bad argument, please use [vga|hdmi|ds|work|-|off]'
|
||||
exit 1;;
|
||||
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# }}}
|
||||
|
||||
# Update herbstluftWM configuration
|
||||
herbstclient detect_monitors
|
||||
herbstclient reload
|
||||
|
||||
|
|
Loading…
Reference in New Issue