revamp compat

This commit is contained in:
2025-09-28 22:08:05 +00:00
parent 6bf779a68e
commit 3398c6b4ef
12 changed files with 83 additions and 311 deletions

View File

@@ -41,7 +41,7 @@ formatted_list=$(echo "$window_list" | while IFS='|' read -r id app_id name work
printf "%s%s%s %s %s\n" "$workspace" "$indicator" "$id" "$app_id" "$name"
done)
selection=$(echo "$formatted_list" | bemenu --width-factor 100 --prompt "/" --index "$(echo "$formatted_list" | awk 'substr($0,2,1)==">" {print NR-1}')" )
selection=$(echo "$formatted_list" | bemenu --auto-select --width-factor 100 --prompt "/" --index "$(echo "$formatted_list" | awk 'substr($0,2,1)==">" {print NR-1}')" )
[ -z "$selection" ] && exit 0
window_id=$(echo "$selection" | sed -E 's/^...([0-9]+).*/\1/')

View File

@@ -0,0 +1,33 @@
#!/bin/bash
if [ -z "$WSCOMPAT_DIR" ] || [ "$WS_IS_COMPAT" != 1 ]; then
exit 0
fi
[ -f /etc/profile ] && . /etc/profile
[ -f ~/.profile ] && . ~/.profile
export EDITOR=vim
export SHELL=/bin/bash
export PATH="$WSCOMPAT_DIR:$PATH"
stty intr ^K
export VIMINIT="source $WSCOMPAT_DIR/.vimrc"
cat << 'EOF_04tcIQE7' > "$WSCOMPAT_DIR/.vimrc"
{{ template "vimrc" . }}
EOF_04tcIQE7
export INPUTRC="$WSCOMPAT_DIR/.inputrc"
cat << 'EOF_04tcIQE7' > "$WSCOMPAT_DIR/.inputrc"
{{ template "inputrc" . }}
EOF_04tcIQE7
export LESSKEYIN="$WSCOMPAT_DIR/.lesskey"
cat << 'EOF_04tcIQE7' > "$WSCOMPAT_DIR/.lesskey"
{{ template "lesskey" . }}
EOF_04tcIQE7
cat << 'EOF_04tcIQE7' > "$WSCOMPAT_DIR/wssh"
{{ tmpl.Exec "wssh" . | strings.ReplaceAll "EOF_" "EOF_1_" }}
EOF_04tcIQE7

31
arch-user/bin/wssh Executable file
View File

@@ -0,0 +1,31 @@
#!/bin/bash
if [ $# -lt 1 ]; then
echo "Usage: $0 <hostname> [ssh-options]"
exit 1
fi
[ -z "$WSCOMPAT_MASTER" ] && WSCOMPAT_MASTER="$(whoami)"
read -r -d '' init_cmd << EOF_9oqn7IVF
export WS_IS_COMPAT=1
export WSCOMPAT_MASTER="$WSCOMPAT_MASTER"
export WSCOMPAT_DIR="/tmp/wscompat_${WSCOMPAT_MASTER}_\$(whoami)"
ws_cleanup() { rm -rf "\$WSCOMPAT_DIR"; }
trap ws_cleanup EXIT
rm -rf "\$WSCOMPAT_DIR" && mkdir -p "\$WSCOMPAT_DIR" && chmod 700 "\$WSCOMPAT_DIR"
cat << 'EOF_84EbM3la' > "\$WSCOMPAT_DIR/profile"
$(
cat "$WSCOMPAT_DIR/profile"
for file in "$WSCOMPAT_DIR.profile"*.sh; do
if [ -f "$file" ]; then cat "$file"; fi
done
)
EOF_84EbM3la
. \$WSCOMPAT_DIR/profile
# pam, systemd - wrap in login shell
exec /bin/bash --login --norc --noprofile -c "exec /bin/bash"
EOF_9oqn7IVF
ssh -t "$@" "$init_cmd"