dot_testing/builds/utils/disp

169 lines
4.7 KiB
Plaintext
Raw Normal View History

2021-02-15 12:02:09 -06:00
#!/bin/sh
# you can think of this more as post-wm setup
set -x
[ "$1" = "-h" ] && echo "use DISP_ACCESS_IP to control sshfs conn ip" && exit 0
set_walls() {
for i in $(xrandr | grep ' connected' | cut -d' ' -f1); do
xwallpaper --output $i --zoom ~/.local/share/pape.jpg
done
}
screensaver () {
pkill xscreensaver
HOME=".config/xscreensaver" xscreensaver --no-splash & 2>&1 > /dev/null
}
keyboard () {
setxkbmap -option caps:super
pkill xcape
xcape -e 'Super_L=Escape'
xkbset bo 50
xkbset exp =bo
xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock
2024-02-04 07:50:31 -06:00
xset -r 161 # tablet rotate key doesn't need repeat
2024-04-10 18:59:38 -05:00
xset r rate 200 80
}
2024-01-18 03:54:32 -06:00
find_card_pci() {
[ -z $pci_path ] && pci_path=$(find /sys/devices | \
grep edid | \
cut -d/ -f1-6
)
2021-02-15 12:02:09 -06:00
}
2024-01-18 03:54:32 -06:00
assert_edid() {
find_card_pci
out=$(sha256sum ${pci_path}/card0/card0-$1/edid | \
cut -d' ' -f1)
[ "$out" = "$2" ] && return 0 || return 1
}
2022-08-01 18:32:00 -05:00
2024-01-18 03:54:32 -06:00
exists() {
xrandr | grep ' connected' | grep -c "${1}"
}
2024-01-18 03:54:32 -06:00
case "$(hostname)" in
"mainsail")
echo "mainsail"
xrandr --output VGA-1 --left-of HDMI-1
bspc monitor VGA-1 -d 1 3 5 7 9
bspc monitor HDMI-1 -d 2 4 6 8 0
;;
2024-01-24 19:37:55 -06:00
"mlg")
case "$1" in
"invert")
2024-04-06 16:49:39 -05:00
xrandr \
--output DP-0 --off \
2024-04-06 16:49:39 -05:00
--output DP-1-1 --primary --mode 1920x1080 --pos 0x352 --rotate normal --rate 180 \
--output DP-1-2 --mode 1920x1080 --pos 1920x352 --rotate normal --rate 180
bspc monitor DP-1-1 -d 1 3 5 7
bspc monitor DP-1-2 -d 2 4 6 8
;;
"solo")
bspc monitor DP-0 -d 1 2 3 4 5 6 7 8 9
;;
2024-05-25 21:01:05 -05:00
*)
xrandr \
--output DP-0 --off \
--output DP-1-2 --primary --mode 1920x1080 --pos 0x352 --rotate normal --rate 180 \
--output DP-1-1 --mode 1920x1080 --pos 1920x352 --rotate normal --rate 180
bspc monitor DP-1-2 -d 1 3 5 7
bspc monitor DP-1-1 -d 2 4 6 8
;;
esac
xinput set-prop 'INSTANT USB GAMING MOUSE ' 'libinput Accel Speed' -1
# setup synchronization
# check if we have another IP defined
if [ ! -z "$DISP_ACCESS_IP" ]; then
target="$DISP_ACCESS_IP"
else
target=x230t
fi
pkill sshfs
rm $HOME/doc # this is safe, as doc is a dir if it mattered,
# but it's just a link, so it's a regular file.
# in conclusion, good either way
mkdir -p $HOME/.cache/mount_point
sshfs "usr@$target:/home/usr/doc" $HOME/.cache/mount_point -o ConnectTimeout=1
ln -sf $HOME/.cache/mount_point $HOME/doc
2024-03-18 18:38:01 -05:00
rm $HOME/.thunderbird # see previous comment
2024-04-06 16:49:39 -05:00
mkdir -p $HOME/.cache/mount_point3
sshfs "usr@$target:/home/usr/.thunderbird" $HOME/.cache/mount_point3 -o ConnectTimeout=1
2024-04-06 16:49:39 -05:00
ln -sf $HOME/.cache/mount_point3 $HOME/.thunderbird
2024-03-18 18:38:01 -05:00
rm $HOME/Mail
mkdir -p $HOME/.cache/mount_point4
sshfs "usr@$target:/home/usr/Mail" $HOME/.cache/mount_point4 -o ConnectTimeout=1
ln -sf $HOME/.cache/mount_point4 $HOME/Mail
rm $HOME/vdir
mkdir -p $HOME/.cache/mount_point5
sshfs "usr@$target:/home/usr/vdir" $HOME/.cache/mount_point5 -o ConnectTimeout=1
ln -sf $HOME/.cache/mount_point5 $HOME/vdir
2024-01-24 19:37:55 -06:00
;;
2024-01-18 03:54:32 -06:00
"x230t")
echo "x230t"
2024-01-20 08:30:31 -06:00
case "$1" in
"dockedtwo")
# assume we're connected to the two external displays
xrandr --output VGA-1 --primary --mode 1920x1080 --rotate normal \
--output HDMI-1 --mode 1920x1080 --rotate normal --right-of VGA-1 \
--output LVDS-1 --off
bspc monitor VGA-1 -d 1 3 5 7 9
bspc monitor HDMI-1 -d 2 4 6 8
;;
*)
if
assert_edid "VGA-1" "35737dc483d2c3b1b20ea2343ce13c6c42d115febdc9634f8437e1b9f7fd3f5c" &&
assert_edid "HDMI-A-1" "01887cbd23d74201e489a6334656f7db73a7b7f732a738a9f1ee2d53389f7817";
then
echo "docked"
xrandr --output LVDS-1 --primary --mode 1366x768 --pos 1194x1080 --rotate normal \
--output VGA-1 --mode 1920x1080 --pos 0x0 --rotate normal \
--output HDMI-1 --mode 1920x1080 --pos 1920x0 --rotate normal \
--output DP-1 --off \
--output HDMI-2 --off \
--output DP-2 --off
bspc monitor LVDS-1 -d 1 4 7
bspc monitor VGA-1 -d 2 5 8
bspc monitor HDMI-1 -d 3 6 9
else
bspc monitor LVDS-1 -d 1 2 3 4 5 6 7 8 9
fi
;;
esac
2024-01-18 03:54:32 -06:00
;;
2024-07-22 01:22:27 -05:00
"copernicus")
xinput set-prop 'INSTANT USB GAMING MOUSE ' 'libinput Accel Speed' -1
xrandr --output HDMI-0 --primary --mode 1920x1080 --rate 180 --pos 1920x0 --rotate normal \
--output DP-0 --mode 1920x1080 --pos 0x0 --rate 180 --rotate normal \
--output DP-1 --off \
--output DP-2 --off \
--output DP-3 --off \
--output DP-4 --off \
--output DP-5 --off \
--output DP-1-1 --off \
--output HDMI-1-1 --off \
2024-07-24 13:16:58 -05:00
--output DP-1-2 --off \
--output HDMI-1-2 --mode 1920x1080 --pos 3840x0 --rotate normal
2024-07-22 01:22:27 -05:00
bspc monitor DP-0 -d 1 3 5 7
bspc monitor HDMI-0 -d 2 4 6 8
2024-07-24 13:16:58 -05:00
bspc monitor HDMI-1-2 -d 9
2024-07-22 01:22:27 -05:00
;;
2024-01-18 03:54:32 -06:00
esac
2024-02-10 23:49:22 -06:00
# initial post-wm setup
keyboard
2024-05-12 13:23:26 -05:00
statusbar start_statusbars
2024-02-10 23:49:22 -06:00
set_walls
screensaver