diff options
| -rw-r--r-- | ar/.config/x11/xprofile | 2 | ||||
| -rwxr-xr-x | ar/.local/bin/setmonitors (renamed from ar/.local/bin/setmonitor) | 24 |
2 files changed, 14 insertions, 12 deletions
diff --git a/ar/.config/x11/xprofile b/ar/.config/x11/xprofile index 5acfa4d..81c7f7e 100644 --- a/ar/.config/x11/xprofile +++ b/ar/.config/x11/xprofile @@ -2,7 +2,7 @@ sleep 3 xrandr --dpi 192 # adjust the number based on your resolution and size of the screen -# setmonitor +setmonitors setbg & # set the background with the `setbg` script # fcitx5 & # set the input method diff --git a/ar/.local/bin/setmonitor b/ar/.local/bin/setmonitors index b127425..e39409b 100755 --- a/ar/.local/bin/setmonitor +++ b/ar/.local/bin/setmonitors @@ -1,13 +1,15 @@ #!/bin/sh # Run screenlayout script if available -for script in ~/.screenlayout/*.sh; do - [ -f "$script" ] && sh "$script" && exit -done +script="$HOME/.screenlayout/default.sh" +[ -f "$script" ] && sh "$script" && exit -# Parse connected displays -default="--mode 1920x1080 --rotate normal --scale 1.0x1.0 --dpi 96" +# Per-monitor settings +edp_cfg="--mode 1920x1080 --rotate normal --scale 1.0x1.0 --dpi 96" +hdmi_cfg="--mode 1920x1080 --rotate normal --scale 1.0x1.0 --dpi 96" +dp_cfg="--mode 2560x1600 --rotate normal --scale 1.0x1.0 --dpi 192" +# Parse connected displays for connected in $(xrandr -q | grep -w "connected" | cut -d ' ' -f 1); do case $connected in eDP*) edp="$connected" ;; @@ -20,20 +22,20 @@ done # If the lid is closed, turn off the laptop's screen if grep -q "closed" /proc/acpi/button/lid/LID/state; then if [ -n "$hdmi" ] && [ -z "$dp" ] && [ -n "$edp" ]; then - xrandr --output "$edp" --off --output "$hdmi" --primary $default + xrandr --output "$edp" --off --output "$hdmi" --primary $hdmi_cfg elif [ -z "$hdmi" ] && [ -n "$dp" ] && [ -n "$edp" ]; then - xrandr --output "$edp" --off --output "$dp" --primary $default + xrandr --output "$edp" --off --output "$dp" --primary $dp_cfg else - xrandr --output "$edp" --off --output "$display" --auto --primary $default + xrandr --output "$edp" --off --output "$display" --auto --primary fi else # Apply display settings when lid is open if [ -n "$hdmi" ] && [ -z "$dp" ] && [ -n "$edp" ]; then - xrandr --output "$edp" --pos 1920x0 $default --output "$hdmi" --primary --pos 0x0 $default + xrandr --output "$hdmi" --primary --pos 0x0 $hdmi_cfg --output "$edp" --pos 1920x0 $edp_cfg elif [ -z "$hdmi" ] && [ -n "$dp" ] && [ -n "$edp" ]; then - xrandr --output "$edp" --pos 1920x0 $default --output "$dp" --primary --pos 0x0 $default + xrandr --output "$dp" --primary --pos 0x0 $dp_cfg --output "$edp" --pos 2560x0 $edp_cfg elif [ -z "$hdmi" ] && [ -z "$dp" ] && [ -n "$edp" ]; then - xrandr --output "$edp" --primary $default + xrandr --output "$edp" --primary $edp_cfg else xrandr --output "$display" --primary --auto fi |
