40 lines
675 B
Plaintext
40 lines
675 B
Plaintext
|
#!/bin/zsh
|
||
|
source "$HOME/.config/wryn/env.zsh"
|
||
|
NATIVE_MONITOR='eDP1'
|
||
|
|
||
|
GET_PRIMARY_MONITOR() {
|
||
|
xrandr \
|
||
|
| grep 'primary' \
|
||
|
| awk '{print $1;}' \
|
||
|
| head -n 1
|
||
|
}
|
||
|
|
||
|
PRIMARY_MONITOR=$(GET_PRIMARY_MONITOR)
|
||
|
|
||
|
GET_DEFAULT_EXTERNAL_MONITOR() {
|
||
|
xrandr \
|
||
|
| grep ' connect' \
|
||
|
| awk '{print $1;}' \
|
||
|
| grep -v "$NATIVE_MONITOR" \
|
||
|
| head -n 1
|
||
|
}
|
||
|
EXTERNAL_MONITOR=$(GET_DEFAULT_EXTERNAL_MONITOR)
|
||
|
|
||
|
DISCONNECT_OTHER() {
|
||
|
local SFX="$1"
|
||
|
|
||
|
for D in $(xrandr | awk '{print $1;}' | grep -v $(GET_PRIMARY_MONITOR))
|
||
|
do
|
||
|
xrandr --output $D --off
|
||
|
done
|
||
|
|
||
|
$DOTWRYN/bin/randomize-background
|
||
|
|
||
|
[ $SFX ] && ( PLAY_SFX $SFX ) &
|
||
|
return 0
|
||
|
}
|
||
|
|
||
|
NOTIFY() {
|
||
|
notify-send 'xrandr screenlayout' $@
|
||
|
}
|