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

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' $@
}