Big move about + cleanup
This commit is contained in:
39
bin/xorg/butterfree/common
Normal file
39
bin/xorg/butterfree/common
Normal file
@ -0,0 +1,39 @@
|
||||
#!/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' $@
|
||||
}
|
15
bin/xorg/butterfree/gamedock
Executable file
15
bin/xorg/butterfree/gamedock
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/zsh
|
||||
source ${0:a:h}/common
|
||||
[ ! $PRIMARY_MONITOR ] && {
|
||||
NOTIFY 'Unable to detect primary monitor'
|
||||
return
|
||||
}
|
||||
|
||||
xrandr \
|
||||
--output $PRIMARY_MONITOR \
|
||||
--primary \
|
||||
--mode 1920x1080 \
|
||||
--rotate normal \
|
||||
--pos 0x0 \
|
||||
&& DISCONNECT_OTHER gamedock \
|
||||
|| NOTIFY "Unable to set '$PRIMARY_MONITOR' to 1920x1080"
|
15
bin/xorg/butterfree/hdmidock
Executable file
15
bin/xorg/butterfree/hdmidock
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/zsh
|
||||
source ${0:a:h}/common
|
||||
[ ! $EXTERNAL_MONITOR ] && {
|
||||
NOTIFY 'No external monitor connected!'
|
||||
return
|
||||
}
|
||||
|
||||
xrandr \
|
||||
--output $EXTERNAL_MONITOR \
|
||||
--primary \
|
||||
--auto \
|
||||
--rotate normal \
|
||||
--pos 0x0 \
|
||||
&& DISCONNECT_OTHER login \
|
||||
|| NOTIFY "Unable to connect '$EXTERNAL_MONITOR' to 1920x1080"
|
15
bin/xorg/butterfree/undock
Executable file
15
bin/xorg/butterfree/undock
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/zsh
|
||||
source ${0:a:h}/common
|
||||
[ ! $NATIVE_MONITOR ] && {
|
||||
NOTIFY "Must specify NATIVE_MONITOR"
|
||||
return
|
||||
}
|
||||
|
||||
xrandr \
|
||||
--output $NATIVE_MONITOR \
|
||||
--primary \
|
||||
--mode "2560x1440" \
|
||||
--rotate normal \
|
||||
--pos 0x0 \
|
||||
&& DISCONNECT_OTHER undock \
|
||||
|| NOTIFY "Native monitor '$PRIMARY_MONITOR' unresponsive"
|
Reference in New Issue
Block a user