flattening and cleaning up various configurations and executables

This commit is contained in:
2022-08-22 16:40:57 -06:00
parent e0594ebfb7
commit 26571b5dfc
32 changed files with 189 additions and 85 deletions

19
bin/butterfree/gamedock Executable file
View File

@ -0,0 +1,19 @@
#!/bin/zsh
source ${0:a:h}/xorg.zsh
[ ! $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"
xset dpms 0 0 0 && xset s noblank && xset s off \
&& notify-send 'DPMS' 'disabled screen blank'

15
bin/butterfree/hdmidock Executable file
View File

@ -0,0 +1,15 @@
#!/bin/zsh
source ${0:a:h}/xorg.zsh
[ ! $EXTERNAL_MONITOR ] && {
NOTIFY 'No external monitor connected!'
return
}
xrandr \
--output $EXTERNAL_MONITOR \
--primary \
--mode 1920x1080 \
--rotate normal \
--pos 0x0 \
&& DISCONNECT_OTHER login \
|| NOTIFY "Unable to connect '$EXTERNAL_MONITOR' to 1920x1080"

15
bin/butterfree/runedock Executable file
View File

@ -0,0 +1,15 @@
#!/bin/zsh
source ${0:a:h}/xorg.zsh
[ ! $EXTERNAL_MONITOR ] && {
NOTIFY 'No external monitor connected!'
return
}
xrandr \
--output $EXTERNAL_MONITOR \
--primary \
--mode 1280x720 \
--rotate normal \
--pos 0x0 \
&& DISCONNECT_OTHER login \
|| NOTIFY "Unable to connect '$EXTERNAL_MONITOR' to 1920x1080"

10
bin/butterfree/runeundock Executable file
View File

@ -0,0 +1,10 @@
#!/bin/zsh
source ${0:a:h}/xorg.zsh
xrandr \
--output eDP1 \
--primary \
--mode 1280x720 \
--rotate normal \
--pos 0x0 \
&& DISCONNECT_OTHER login \
|| NOTIFY "Unable to connect to do the thing :S"

18
bin/butterfree/undock Executable file
View File

@ -0,0 +1,18 @@
#!/bin/zsh
source ${0:a:h}/xorg.zsh
[ ! $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"
xset +dpms && xset s blank && xset s on \
&& notify-send 'DPMS' 'enabled screen blank'

24
bin/butterfree/workdock Executable file
View File

@ -0,0 +1,24 @@
#!/bin/zsh
source ${0:a:h}/xorg.zsh
LEFT=$(GET_ALL_EXTERNAL_MONITORS | grep 'DP.-1')
RIGHT=$(GET_ALL_EXTERNAL_MONITORS | grep 'DP.-2')
[ $LEFT ] && [ $RIGHT ] || {
NOTIFY "Unable to detect work monitors; are you connected?"
return
}
xrandr \
--output $RIGHT \
--primary \
--mode 1920x1080 \
--scale 1.25x1.25 \
--rotate normal \
--pos 2400x0 \
--output $LEFT \
--mode 1920x1080 \
--scale 1.25x1.25 \
--rotate normal \
--pos 0x0 \
&& DISCONNECT_OTHER login $LEFT \
|| NOTIFY "Unable to connect '$EXTERNAL_MONITOR' to 1920x1080"

55
bin/butterfree/xorg.zsh Normal file
View File

@ -0,0 +1,55 @@
#!/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_ALL_EXTERNAL_MONITORS() {
xrandr \
| grep ' connect' \
| awk '{print $1;}' \
| grep -v "$NATIVE_MONITOR" \
2>/dev/null
}
GET_DEFAULT_EXTERNAL_MONITOR() {
GET_ALL_EXTERNAL_MONITORS | head -n 1
}
EXTERNAL_MONITOR=$(GET_DEFAULT_EXTERNAL_MONITOR)
DISCONNECT_OTHER() {
local SFX="$1"
local INACTIVE_MONITORS=$(\
xrandr --listmonitors \
| sed '1d' | awk '{print $NF;}' \
| grep -v "^$(GET_PRIMARY_MONITOR)$"
)
for ACTIVE_MONITOR in ${@:2}
do
INACTIVE_MONITORS=$(echo $INACTIVE_MONITORS | grep -v "^$ACTIVE_MONITOR$")
done
local MONITOR
for MONITOR in $INACTIVE_MONITORS
do
xrandr --output $MONITOR --off
done
sleep 1
$DOTWRYN/bin/set-background random
[ $SFX ] && ( $DOTWRYN/bin/play-sound $SFX ) &
return 0
}
NOTIFY() {
notify-send 'xrandr screenlayout' $@
}