[monitors] Disable unneeded monitors
This commit is contained in:
parent
5d39292d68
commit
85b359b47e
1 changed files with 29 additions and 1 deletions
|
@ -27,6 +27,23 @@ trigger_change_and_exit() {
|
|||
exit
|
||||
}
|
||||
|
||||
builtin_off() {
|
||||
level=$(xbacklight -get)
|
||||
if [[ $level -gt 0 ]]; then
|
||||
echo $level >/tmp/.brightness
|
||||
xbacklight -time 500 -fps 30 -set 0
|
||||
fi
|
||||
}
|
||||
builtin_on() {
|
||||
level=$(xbacklight -get)
|
||||
if [[ $level -eq 0 ]]; then
|
||||
wanted=$([[ -r /tmp/.brightness ]] && cat /tmp/.brightness || echo "50")
|
||||
elif [[ $level -lt 10 ]]; then
|
||||
wanted=10
|
||||
fi
|
||||
xbacklight -time 500 -fps 30 -set $wanted
|
||||
}
|
||||
|
||||
single_screen() {
|
||||
one="$1"
|
||||
off1="$2"
|
||||
|
@ -36,6 +53,7 @@ single_screen() {
|
|||
--output "$one" --auto --primary \
|
||||
--output "$off1" --off \
|
||||
--output "$off2" --off
|
||||
builtin_on
|
||||
notify-send -a 'Monitor layout toggler' -i display "Only $one connected" "Disabled all outputs except for $one."
|
||||
trigger_change_and_exit
|
||||
}
|
||||
|
@ -50,16 +68,19 @@ toggle_two_screens() {
|
|||
--output "$one" --off \
|
||||
--output "$two" --auto --primary \
|
||||
--output "$off" --off
|
||||
builtin_off
|
||||
elif ! actv "$one" && actv "$two"; then
|
||||
xrandr \
|
||||
--output "$one" --auto --primary \
|
||||
--output "$two" --off \
|
||||
--output "$off" --off
|
||||
builtin_on
|
||||
else
|
||||
xrandr \
|
||||
--output "$one" --auto --primary \
|
||||
--output "$two" --auto --left-of "$builtin" \
|
||||
--output "$off" --off
|
||||
builtin_on
|
||||
fi
|
||||
trigger_change_and_exit
|
||||
}
|
||||
|
@ -74,36 +95,43 @@ toggle_three_screens() {
|
|||
--output "$one" --off \
|
||||
--output "$two" --auto --primary \
|
||||
--output "$three" --auto --left-of "$two"
|
||||
builtin_off
|
||||
elif ! actv "$one" && actv "$two" && actv "$three"; then
|
||||
xrandr \
|
||||
--output "$one" --auto --primary \
|
||||
--output "$two" --off \
|
||||
--output "$three" --auto --left-of "$one"
|
||||
builtin_on
|
||||
elif actv "$one" && ! actv "$two" && actv "$three"; then
|
||||
xrandr \
|
||||
--output "$one" --auto --primary \
|
||||
--output "$two" --auto --left-of "$one" \
|
||||
--output "$three" --off
|
||||
builtin_on
|
||||
elif actv "$one" && actv "$two" && ! actv "$three"; then
|
||||
xrandr \
|
||||
--output "$one" --auto --primary \
|
||||
--output "$two" --off \
|
||||
--output "$three" --off
|
||||
builtin_on
|
||||
elif actv "$one" && ! actv "$two" && ! actv "$three"; then
|
||||
xrandr \
|
||||
--output "$one" --off \
|
||||
--output "$two" --auto --primary \
|
||||
--output "$three" --off
|
||||
builtin_off
|
||||
elif ! actv "$one" && actv "$two" && ! actv "$three"; then
|
||||
xrandr \
|
||||
--output "$one" --off \
|
||||
--output "$two" --off \
|
||||
--output "$three" --auto --primary
|
||||
builtin_off
|
||||
else
|
||||
xrandr \
|
||||
--output "$one" --auto --primary \
|
||||
--output "$two" --auto --left-of "$one" \
|
||||
--output "$three" --auto --left-of "$two"
|
||||
builtin_on
|
||||
fi
|
||||
trigger_change_and_exit
|
||||
}
|
||||
|
@ -133,4 +161,4 @@ xrandr \
|
|||
--output "$builtin" --auto --primary \
|
||||
--output "$ext1" --auto \
|
||||
--output "$ext2" --auto
|
||||
|
||||
builtin_on
|
||||
|
|
Loading…
Reference in a new issue