diff options
author | Toby Vincent <tobyv13@gmail.com> | 2023-07-02 17:40:30 -0500 |
---|---|---|
committer | Toby Vincent <tobyv13@gmail.com> | 2023-07-02 17:40:30 -0500 |
commit | 6f63a1e256c9bbe8c97d946fb63b3bc5fc377cb1 (patch) | |
tree | c6f6be767513dc054cd234491be470f9a5bfc01e | |
parent | 12e34ae9c72bae71b01a801f5d06ccf9824c1265 (diff) |
fix(wsl): remove wsl related files
-rw-r--r-- | wsl/.config/zsh/.zshrc.d/99-wsl.zsh | 59 | ||||
-rwxr-xr-x | wsl/.local/bin/mkln.sh | 165 | ||||
-rw-r--r-- | wsl/.local/share/applications/wslview.desktop | 14 | ||||
-rwxr-xr-x | wsl/install.sh | 36 |
4 files changed, 0 insertions, 274 deletions
diff --git a/wsl/.config/zsh/.zshrc.d/99-wsl.zsh b/wsl/.config/zsh/.zshrc.d/99-wsl.zsh deleted file mode 100644 index 5550aae..0000000 --- a/wsl/.config/zsh/.zshrc.d/99-wsl.zsh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/sh - -alias wsl='/mnt/c/Windows/system32/wsl.exe' -alias powershell.exe='/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe' -alias pwsh.exe='/mnt/c/Program Files/PowerShell/7/pwsh.exe' -alias winget='/mnt/c/Users/tobyv/AppData/Local/Microsoft/WindowsApps/winget.exe' -alias scoop='/mnt/c/Users/tobyv/scoop/shims/scoop' - -zvm_vi_yank () { - zvm_yank - printf %s "${CUTBUFFER}" | win32yank.exe -i - zvm_exit_visual_mode -} - -zvm_vi_put_after () { - local head= foot= - local content=$(win32yank.exe -o) - local offset=1 - if [[ ${content: -1} == $'\n' ]] - then - local pos=${CURSOR} - for ((; $pos<$#BUFFER; pos++)) do - if [[ ${BUFFER:$pos:1} == $'\n' ]] - then - pos=$pos+1 - break - fi - done - if zvm_is_empty_line - then - head=${BUFFER:0:$pos} - foot=${BUFFER:$pos} - else - head=${BUFFER:0:$pos} - foot=${BUFFER:$pos} - if [[ $pos == $#BUFFER ]] - then - content=$'\n'${content:0:-1} - pos=$pos+1 - fi - fi - offset=0 - BUFFER="${head}${content}${foot}" - CURSOR=$pos - else - if zvm_is_empty_line - then - head="${BUFFER:0:$((CURSOR-1))}" - foot="${BUFFER:$CURSOR}" - else - head="${BUFFER:0:$CURSOR}" - foot="${BUFFER:$((CURSOR+1))}" - fi - BUFFER="${head}${BUFFER:$CURSOR:1}${content}${foot}" - CURSOR=$CURSOR+$#content - fi - zvm_highlight clear - zvm_highlight custom $(($#head+$offset)) $(($#head+$#content+$offset)) -} diff --git a/wsl/.local/bin/mkln.sh b/wsl/.local/bin/mkln.sh deleted file mode 100755 index 93f78d6..0000000 --- a/wsl/.local/bin/mkln.sh +++ /dev/null @@ -1,165 +0,0 @@ -#!/usr/bin/env bash - -SCRIPT="$(basename "$0")" - -long='help,verbose,quiet,force,dry-run' -short='hvqfn' - -eval set -- "$(getopt -o $short -l $long -n "$SCRIPT" -- "$@")" - -help() { - cat <<-EOF - $SCRIPT - Toby Vincent <tobyv13@gmail.com> - - $SCRIPT - Creates symbolic links (for files) or junctions (for directories) from the - windows filesystem to the WSL2 instance using mklink.exe. - - USAGE: - $SCRIPT [OPTIONS] <SOURCE> [TARGET] - - OPTIONS: - -h, --help Show this message - -v, --verbose Show more output - -q, --quiet Suppress all output - -f, --force Overwrite items - -n, --dry-run Write output of commands with running them. - - ARGS: - SOURCE (required) - Path to the source file or directory the link should point to. - - TARGET (optional) - Path to the location to create the link. [Default: $PWD] - EOF -} - -say() { - if ! $quiet; then - printf "%s: %s\n" "$SCRIPT" "$@" - fi -} - -say_verbose() { - if $verbose; then - say "$@" - fi -} - -say_err() { - say "$@" >&2 -} - -err() { - # shellcheck disable=SC2145 - say_err "ERROR: $@" - exit 1 -} - -err_help() { - help - err "$*" -} - -need() { - for cmd in "$@"; do - if ! command -v "$cmd" >/dev/null 2>&1; then - err "need $cmd (command not found)" - fi - done -} - -trg=$PWD -verbose=false -quiet=false -force=false -while true; do - case "$1" in - -h | --help) - help - exit 0 - ;; - -v | --verbose) - verbose=true - shift - ;; - -q | --quiet) - quiet=true - shift - ;; - -f | --force) - force=true - shift - ;; - --) - shift - break - ;; - *) - break - ;; - esac -done - -need powershell.exe -need realpath - -case "$#" in -0) err_help "must provide at least 1 argument" ;; -1) - src="$1" - trg="$PWD" - shift - ;; -2) - src="$1" - trg="$2" - shift 2 - ;; -*) err_help "too many arguments" ;; -esac - -while test -L "$src"; do - tmp="$src" - src=$(realpath "$src") - say_verbose "resolved symbolic link $tmp -> $src" -done - -if ! test -e "$src"; then - err "$src does not exist." -fi - -if test -d "$src"; then - say_verbose "$src is a directory. Switching to directory symbolic link." - args='/D' -fi - -trg_name=$(basename "$trg") -trg_dir=$(dirname "$trg") - -say_verbose "linking $src -> $trg" - -if ! test -d "$trg_dir"; then - mkdir -p "$trg_dir" - say_verbose "created directory $trg_dir" -fi - -win_src=$(wslpath -w "$src") -win_trg=$(wslpath -w "$trg_dir")\\"$trg_name" - -# UNC\wsl$\Arch\home\tobyv\.dotfiles\alacritty\.config\alacritty\alacritty.yml -# \\wsl.localhost\Arch\home\tobyv\.dotfiles\alacritty\.config\alacritty\alacritty.yml - -existing="$(powershell.exe "(Get-Item $win_trg).FullName" 2>/dev/null)" - -if test "$existing" != ''; then - if $force; then - say_verbose "$win_trg already exists. Overwriting." - rm -rf "$trg" - else - err "$win_trg already exists." - fi -fi - -powershell.exe "cd ~; cmd /c mklink $args $win_trg $win_src" diff --git a/wsl/.local/share/applications/wslview.desktop b/wsl/.local/share/applications/wslview.desktop deleted file mode 100644 index d917502..0000000 --- a/wsl/.local/share/applications/wslview.desktop +++ /dev/null @@ -1,14 +0,0 @@ -[Desktop Entry] -Version=1.0 -Name=wslview -GenericName=Web Browser -Comment=Open files using Windows start.exe from WSL2 -Keywords=Internet;WWW;Browser;Web;Explorer -Exec=/usr/sbin/wslview %u -Icon=firefox -Terminal=false -Type=Application -MimeType=text/html;text/xml;image/bmp;image/gif;image/jpeg;image/jpg;image/pjpeg;image/png;image/tiff;image/webp;image/x-bmp;image/x-pcx;image/x-png;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-tga;image/x-xbitmap;image/heic;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https;application/x-xpinstall;application/pdf;application/json; -StartupNotify=true -Categories=Network;WebBrowser; -Actions=new-window;new-private-window; diff --git a/wsl/install.sh b/wsl/install.sh deleted file mode 100755 index be0fc95..0000000 --- a/wsl/install.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/sh - -# shellcheck disable=1003 -WINHOME="$(wslpath 'C:\Users\'"${USER}")" - -# link WINHOME -ln -sfn "$WINHOME" ~/win - -# link win binaries -ln -sf "$(wslpath 'C:\Windows\system32\wsl.exe')" ~/.local/bin/wsl.exe -ln -sf "$(wslpath 'C:\Windows\system32\clip.exe')" ~/.local/bin/clip.exe -ln -sf "$(wslpath 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe')" ~/.local/bin/powershell.exe -ln -sf "$(wslpath 'C:\Program Files\PowerShell\7\pwsh.exe')" ~/.local/bin/pwsh.exe -ln -sf "$(wslpath 'C:\Users\tobyv\AppData\Local\wsl-notify-send\wsl-notify-send.exe')" ~/.local/bin/notify-send - -# Create windows symlinks to dotfiles -mkln.sh "$@" "$HOME"/.ssh/config "${WINHOME}"/.ssh/config -mkln.sh "$@" "$HOME"/.config/git/config "${WINHOME}"/.gitconfig -mkln.sh "$@" "$HOME"/.gnupg/gpg.conf "${WINHOME}"/AppData/Roaming/gnupg/gpg.conf -mkln.sh "$@" "$HOME"/.gnupg/gpg-agent.conf "${WINHOME}"/AppData/Roaming/gnupg/gpg-agent.conf -mkln.sh "$@" "$HOME"/.gnupg/scdaemon.conf "${WINHOME}"/AppData/Roaming/gnupg/scdaemon.conf -mkln.sh "$@" "$HOME"/.config/wezterm/wezterm.lua "${WINHOME}"/.config/wezterm/wezterm.lua -mkln.sh "$@" "$HOME"/.config/alacritty/alacritty.yml "${WINHOME}"/AppData/Roaming/alacritty/alacritty.yml -mkln.sh "$@" "$HOME"/.config/yt-dlp/config "${WINHOME}"/AppData/Roaming/yt-dlp/config -mkln.sh "$@" "$HOME"/.config/mpv/mpv.conf "${WINHOME}"/AppData/Roaming/mpv/mpv.conf -mkln.sh "$@" "$HOME"/.config/mpv/input.conf "${WINHOME}"/AppData/Roaming/mpv/input.conf -mkln.sh "$@" "$HOME"/.config/streamlink/config "${WINHOME}"/AppData/Roaming/streamlink/config -mkln.sh "$@" "$HOME"/.config/streamlink/config.twitch "${WINHOME}"/AppData/Roaming/streamlink/config.twitch -mkln.sh "$@" "$HOME"/.config/tridactyl/tridactylrc "${WINHOME}"/.config/tridactyl/tridactylrc - -for f in "$HOME"/.config/alacritty/*; do - case "$f" in - *shell.yml) echo "Skipping $f" ;; - *) mkln.sh "$@" "$f" "${WINHOME}"/.config/alacritty/"$(basename "$f")" ;; - esac -done |