#!/bin/zsh
autoxrandr

# run script in xpra container to reset keyboard layout on all X servers
() {
  local display xsession_cookie
  display=${DISPLAY#:}
  xsession_cookie="$(xauth list $DISPLAY)" || exit $?
  xsession_cookie=${xsession_cookie##* } || exit $?
  s6-sudo /run/cmd.s link xsession.$display.$USER xpra.$USER tmp/.X11-unix/X$display || exit $?
  s6-sudo /run/inbox/xpra.$USER/run/exec/x11 "$display" "$xsession_cookie" s6-svc -o /run/service/xclipring-primary.$display
  s6-sudo /run/inbox/xpra.$USER/run/exec/x11 "$display" "$xsession_cookie" s6-svc -o /run/service/xclipring-clipboard.$display
  exec s6-sudo /run/inbox/xpra.$USER/run/exec/x11 "$display" "$xsession_cookie" xkb-all
}

#xkb
#for N in {00..10}; do
#	DISPLAY=$DISPLAY$N xkb
#done