revamp compat
This commit is contained in:
		| @@ -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/') | ||||
|   | ||||
							
								
								
									
										33
									
								
								arch-user/bin/workspace-compat/profile.tmpl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								arch-user/bin/workspace-compat/profile.tmpl
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										31
									
								
								arch-user/bin/wssh
									
									
									
									
									
										Executable 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" | ||||
| @@ -3,7 +3,6 @@ | ||||
| export PATH=~/.local/bin:$PATH | ||||
|  | ||||
| #export WLR_RENDERER=vulkan | ||||
|  | ||||
| export QT_STYLE_OVERRIDE=kvantum | ||||
| export GTK_THEME=Materia-dark | ||||
|  | ||||
|   | ||||
							
								
								
									
										1
									
								
								arch-user/config/workspace-compat/env.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								arch-user/config/workspace-compat/env.sh
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| export WSCOMPAT_DIR=~/.local/bin/workspace-compat | ||||
| @@ -5,6 +5,7 @@ cd "$(dirname "$(readlink -f -- "$0")")" | ||||
| umask 002  | ||||
|  | ||||
| export IS_COMPAT=1 | ||||
| gomplate --file config/vim/vimrc --out ../linux-compat/home/.vimrc | ||||
| gomplate --file config/readline/inputrc --out ../linux-compat/home/.inputrc | ||||
| gomplate --file config/less/lesskey --out ../linux-compat/home/.lesskey | ||||
| gomplate --file bin/workspace-compat  | ||||
| gomplate --file config/vim/vimrc | ||||
| gomplate --file config/readline/inputrc | ||||
| gomplate --file config/less/lesskey | ||||
|   | ||||
| @@ -8,6 +8,7 @@ set -e | ||||
| cd "$(dirname "$(readlink -f -- "$0")")" | ||||
| umask 002 | ||||
| [[ "$(id -u)" == "0" ]] && echo "ERROR: wrong user" >&1 && exit 1 | ||||
| export IS_COMPAT=0 | ||||
|  | ||||
| ########## init config ######### | ||||
| if [[ ! -f ~/.config/workspace.conf ]]; then | ||||
| @@ -48,7 +49,7 @@ mkdir -p "${USER_DIRS[@]}" | ||||
| ########## scripts ############# | ||||
| cp -rf bin/* ~/.local/bin | ||||
|  | ||||
| LN_EXCLUDE_DIRS=(i3blocks bemenu sway) | ||||
| LN_EXCLUDE_DIRS=(i3blocks bemenu sway workspace-compat) | ||||
|  | ||||
| ln_exclude_dirs_cmp=" ${LN_EXCLUDE_DIRS[*]} " | ||||
| for sdir in bin/*; do | ||||
| @@ -64,7 +65,6 @@ done | ||||
| ################################ | ||||
|  | ||||
| ########### config ############# | ||||
| export IS_COMPAT=0 | ||||
| gomplate --input-dir config \ | ||||
| 	--output-map "$HOME/.config/{{ .in | strings.ReplaceAll \".tmpl\" \"\" }}" \ | ||||
| 	--exclude-processing "!*.tmpl" \ | ||||
| @@ -83,6 +83,17 @@ mkdir -p ~/.gnupg && ln -sf ~/.config/gnupg/gpg-agent.conf ~/.gnupg | ||||
| cp -rf data/* ~/.local/share | ||||
| ############################### | ||||
|  | ||||
| ########### compat ############ | ||||
| export IS_COMPAT=1 | ||||
| gomplate --file bin/workspace-compat/profile.tmpl \ | ||||
| 	-t vimrc=config/vim/vimrc \ | ||||
| 	-t inputrc=config/readline/inputrc \ | ||||
| 	-t lesskey=config/less/lesskey \ | ||||
| 	-t wssh=bin/wssh \ | ||||
| 	--out ~/.local/bin/workspace-compat/profile | ||||
| export IS_COMPAT=0 | ||||
| ############################### | ||||
|  | ||||
| swaymsg reload || true | ||||
|  | ||||
| echo ok | ||||
|   | ||||
		Reference in New Issue
	
	Block a user