From fd214d3c37c88d6ef1abb87b854120b6260ec94f Mon Sep 17 00:00:00 2001 From: TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> Date: Sun, 15 Mar 2026 11:56:04 +0900 Subject: modified x11/xprofile, deleted bin/setmonitor, created bin/setmonitors --- ar/.local/bin/setmonitor | 40 ---------------------------------------- ar/.local/bin/setmonitors | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 40 deletions(-) delete mode 100755 ar/.local/bin/setmonitor create mode 100755 ar/.local/bin/setmonitors (limited to 'ar/.local') diff --git a/ar/.local/bin/setmonitor b/ar/.local/bin/setmonitor deleted file mode 100755 index b127425..0000000 --- a/ar/.local/bin/setmonitor +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh - -# Run screenlayout script if available -for script in ~/.screenlayout/*.sh; do - [ -f "$script" ] && sh "$script" && exit -done - -# Parse connected displays -default="--mode 1920x1080 --rotate normal --scale 1.0x1.0 --dpi 96" - -for connected in $(xrandr -q | grep -w "connected" | cut -d ' ' -f 1); do - case $connected in - eDP*) edp="$connected" ;; - HDMI*) hdmi="$connected" ;; - DP*) dp="$connected" ;; - *) display="$connected" ;; - esac -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 - elif [ -z "$hdmi" ] && [ -n "$dp" ] && [ -n "$edp" ]; then - xrandr --output "$edp" --off --output "$dp" --primary $default - else - xrandr --output "$edp" --off --output "$display" --auto --primary $default - 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 - elif [ -z "$hdmi" ] && [ -n "$dp" ] && [ -n "$edp" ]; then - xrandr --output "$edp" --pos 1920x0 $default --output "$dp" --primary --pos 0x0 $default - elif [ -z "$hdmi" ] && [ -z "$dp" ] && [ -n "$edp" ]; then - xrandr --output "$edp" --primary $default - else - xrandr --output "$display" --primary --auto - fi -fi diff --git a/ar/.local/bin/setmonitors b/ar/.local/bin/setmonitors new file mode 100755 index 0000000..e39409b --- /dev/null +++ b/ar/.local/bin/setmonitors @@ -0,0 +1,42 @@ +#!/bin/sh + +# Run screenlayout script if available +script="$HOME/.screenlayout/default.sh" +[ -f "$script" ] && sh "$script" && exit + +# 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" ;; + HDMI*) hdmi="$connected" ;; + DP*) dp="$connected" ;; + *) display="$connected" ;; + esac +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 $hdmi_cfg + elif [ -z "$hdmi" ] && [ -n "$dp" ] && [ -n "$edp" ]; then + xrandr --output "$edp" --off --output "$dp" --primary $dp_cfg + else + 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 "$hdmi" --primary --pos 0x0 $hdmi_cfg --output "$edp" --pos 1920x0 $edp_cfg + elif [ -z "$hdmi" ] && [ -n "$dp" ] && [ -n "$edp" ]; then + 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 $edp_cfg + else + xrandr --output "$display" --primary --auto + fi +fi -- cgit v1.2.3