feat: add external monitor detection
This commit is contained in:
parent
8cd08998c1
commit
4524badf49
2 changed files with 20 additions and 0 deletions
18
scripts/executable_monitor.sh
Normal file
18
scripts/executable_monitor.sh
Normal 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
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue