}
current_cfg_xrandr() {
- $XRANDR -q | awk '
- /^[^ ]+ disconnected / {
- print "output "$1;
- print "off";
- }
- /^[^ ]+ connected / {
+ local PRIMARY_SETUP=$(xdpyinfo -ext XINERAMA|awk '/^ head #0:/ {printf $3 $5}')
+ $XRANDR -q | awk -v primary_setup=${PRIMARY_SETUP} '
+ # display is connected and has a mode
+ /^[^ ]+ connected [^(]/ {
split($3, A, "+");
print "output "$1;
print "mode "A[1];
print "pos "A[2]"x"A[3];
+ if (A[1] A[2] "," A[3] == primary_setup)
+ print "primary";
+ next;
+ }
+ # disconnected or disabled displays
+ /^[^ ]+ (dis)?connected / {
+ print "output "$1;
+ print "off";
+ next;
}'
}
}
current_cfg() {
- $CURRENT_METHOD;
+ $CURRENT_CFG_METHOD;
}
blocked() {
}
load_cfg_disper() {
- $DISPER < -i < "$1"
+ $DISPER -i < "$1"
}
load() {
echo "Saving current configuration as profile '${SAVE_PROFILE}'"
mkdir -p "$PROFILES/$SAVE_PROFILE"
echo "$CURRENT_SETUP" > "$PROFILES/$SAVE_PROFILE/setup"
- current_cfg > "$PROFILES/$SAVE_PROFILE/config"
+ $CURRENT_CFG_METHOD > "$PROFILES/$SAVE_PROFILE/config"
exit 0
fi