mirror of https://gitlab.com/dabruh/dotfiles.git
Support identical config on different output names
This commit is contained in:
parent
bab7f76557
commit
a9ccc78482
|
@ -285,6 +285,7 @@ move_nonexistent_i3_workspaces() {
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
local primary_monitor monitor_count monitors=() profile_found=false
|
||||||
primary_monitor=$(get_monitors primary | cut -d',' -f1)
|
primary_monitor=$(get_monitors primary | cut -d',' -f1)
|
||||||
monitor_count=$(get_monitors connected | wc -l)
|
monitor_count=$(get_monitors connected | wc -l)
|
||||||
echo "Monitors connected: $monitor_count"
|
echo "Monitors connected: $monitor_count"
|
||||||
|
@ -292,15 +293,30 @@ main() {
|
||||||
if [ "$monitor_count" -eq 1 ]; then
|
if [ "$monitor_count" -eq 1 ]; then
|
||||||
echo "Applying laptop-only profile"
|
echo "Applying laptop-only profile"
|
||||||
xrandr --auto
|
xrandr --auto
|
||||||
elif usb_devices_exist all exact "HP, Inc HP USB-C Universal Dock" >/dev/null && monitors_exist eDP-1 DVI-I-2-2 DVI-I-3-3; then
|
profile_found=true
|
||||||
echo "Applying work profile"
|
elif usb_devices_exist all exact "HP, Inc HP USB-C Universal Dock" >/dev/null; then
|
||||||
xrandr \
|
monitors=(
|
||||||
--output eDP-1 --primary --mode 1920x1200 --pos 1200x1474 --rotate normal \
|
"eDP-1,DVI-I-1-1,DVI-I-2-2"
|
||||||
--output DVI-I-2-2 --mode 1920x1200 --pos 0x0 --rotate left \
|
"eDP-1,DVI-I-2-2,DVI-I-3-3"
|
||||||
--output DVI-I-3-3 --mode 1920x1200 --pos 1200x274 --rotate normal
|
)
|
||||||
else
|
|
||||||
|
for monitor in "${monitors[@]}"; do
|
||||||
|
IFS=',' read -r -a monitor_array <<<"$monitor"
|
||||||
|
if monitors_exist "${monitor_array[@]}"; then
|
||||||
|
echo "Applying dock profile for ${monitor_array[*]}"
|
||||||
|
xrandr \
|
||||||
|
--output "${monitor_array[0]}" --mode 1920x1200 --rotate normal --pos 1200x1474 --primary \
|
||||||
|
--output "${monitor_array[1]}" --mode 1920x1200 --rotate left --pos 0x0 \
|
||||||
|
--output "${monitor_array[2]}" --mode 1920x1200 --rotate normal --pos 1200x274
|
||||||
|
profile_found=true
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! "$profile_found"; then
|
||||||
echo "No profile found"
|
echo "No profile found"
|
||||||
return 0
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
move_nonexistent_i3_workspaces "$primary_monitor" 10
|
move_nonexistent_i3_workspaces "$primary_monitor" 10
|
||||||
|
|
Loading…
Reference in New Issue