Use LVDS for laptop or first connected output

This commit is contained in:
Jeremy Gardais 2020-10-23 10:15:41 +02:00
parent 45613fb4a7
commit 7337e99c26
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 22 additions and 0 deletions

22
ecran
View File

@ -59,6 +59,28 @@ get_primary_output_name() { # {{{
if [ -n "${local_primary_output_name}" ]; then if [ -n "${local_primary_output_name}" ]; then
debug_message "get_primary_output_name \ debug_message "get_primary_output_name \
An output is defined as primary: ${local_primary_output_name}". An output is defined as primary: ${local_primary_output_name}".
else
## Then check if an output starting with "LVD" (typically a laptop) is connected
local_primary_output_name=$(xrandr | grep "^LVD" | grep " connected" | awk 'NR==1{ print $1 }')
if [ -n "${local_primary_output_name}" ]; then
debug_message "get_primary_output_name \
The primary output seems to be a laptop screen: ${local_primary_output_name}".
else
## Then check if any output is connected and take the first one
local_primary_output_name=$(xrandr | grep " connected" | awk 'NR==1{ print $1 }')
if [ -n "${local_primary_output_name}" ]; then
debug_message "get_primary_output_name \
Take the first connected output as primary: ${local_primary_output_name}".
else
debug_message "get_primary_output_name \
Unable to get primary output name!
Ensure to have a primary, LVDS or any connected output in xrandr."
exit 2
fi
fi
fi fi
readonly MAIN_OUTPUT_NAME="${local_primary_output_name}" readonly MAIN_OUTPUT_NAME="${local_primary_output_name}"