The displayselect script gets the connected displays in the variable screens, with each screen in a new line. When selecting 2 or more displays, the last display (secondary or tertiary) are selected by filtering out the already selected displays with grep - v "$primary".
This can be problematic in the cases where one display name is a substring of anothers name. For example: (eDP1 and DP1). In this case, if DP1 is selected as primary display, the selection of secondary display will fail, as grep -v "DP1" will filter out both lines.
Changes
Adjust grep -v pattern to avoid unintended matches by adding ^ and $ to the searched pattern.
Description
The
displayselect
script gets the connected displays in the variablescreens
, with each screen in a new line. When selecting 2 or more displays, the last display (secondary or tertiary) are selected by filtering out the already selected displays withgrep - v "$primary"
. This can be problematic in the cases where one display name is a substring of anothers name. For example: (eDP1
andDP1
). In this case, ifDP1
is selected as primary display, the selection of secondary display will fail, asgrep -v "DP1"
will filter out both lines.Changes
Adjust
grep -v
pattern to avoid unintended matches by adding^
and$
to the searched pattern.