feat: add external monitor detection

This commit is contained in:
ineanto 2025-05-14 11:31:33 +02:00
parent 8cd08998c1
commit 4524badf49
Signed by: ineanto
GPG key ID: E511F9CAA2F9CE84
2 changed files with 20 additions and 0 deletions
dot_config/i3
scripts

View file

@ -42,6 +42,8 @@ exec --no-startup-id xset s 480 dpms 600 600 600
# Desktop notifications
exec --no-startup-id dbus-launch dunst --config ~/.config/dunst/dunstrc
exec --no-startup-id ~/scripts/monitor.sh
# set floating (nontiling) for special apps
for_window [class="Pavucontrol" instance="pavucontrol"] floating enable
for_window [class="Blueberry.py" instance="blueberry.py"] floating enable

View file

@ -0,0 +1,18 @@
#!/usr/bin/env bash
# v1.0 - Shell Script to automatically set display based on connected monitors.
get_active_monitors()
{
xrandr | awk '/ connected/ && /[[:digit:]]x[[:digit:]].*+/{print $1}'
}
monitors=$(get_active_monitors)
for sub in "${monitors[@]}"; do
if [[ *"$sub"* == *"HDMI-1"* ]]; then
echo "HDMI-1 detected, switching to one primary display."
xrandr --output eDP-1 --off --output HDMI-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal
fi
done