<commit_before>#!/usr/bin/env zsh
linux-process-running() {
  local PID=$1
  kill -s 0 "$PID" &>/dev/null
}

windows-process-running() {
  tasklist.exe | grep -q "$1"
}

load-keyboard() {
  local DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
  local -U xmodmap_candidates=(
    "$DIR/.xmodmap-us-102-tal-enter"
    "$DOTFILES/@wsl/.xmodmap-us-102-tal-enter"
    "$HOME/.dotfiles/@wsl/.xmodmap-us-102-tal-enter"
  )
  for fp in $xmodmap_candidates; do
    if [[ -f $fp ]]; then
      DISPLAY=:0 xmodmap "$fp"
      echo "$fp loaded" >>/dev/stderr
      break
    fi
  done
}

start-dbus() {
  if [ -f ~/.local/bin/rofi-askpass ]; then
    DISPLAY=:0 SUDO_ASKPASS=~/.local/bin/rofi-askpass sudo -A service dbus start
  else
    echo "Sudo required to start dbus" >>/dev/stderr
  fi
}

vcxsrv-is-running() {
  if [[ ! -f "$VCXSRV_PID" ]]; then
    echo "$VCXSRV_PID not found." >>/dev/stderr
    return 1
  fi

  if ! windows-process-running "vcxsrv.exe"; then
    echo "$VCXSRV_PID found, but vcxsrc.exe not running." >>/dev/stderr
    return 1
  fi

  return 0
}

vcxsrv-init() {<commit_msg>Add some ssh-askpass somewhere<commit_after>#!/usr/bin/env zsh
linux-process-running() {
  local PID=$1
  kill -s 0 "$PID" &>/dev/null
}

windows-process-running() {
  tasklist.exe | grep -q "$1"
}

load-keyboard() {
  local DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
  local -U xmodmap_candidates=(
    "$DIR/.xmodmap-us-102-tal-enter"
    "$DOTFILES/@wsl/.xmodmap-us-102-tal-enter"
    "$HOME/.dotfiles/@wsl/.xmodmap-us-102-tal-enter"
  )
  for fp in $xmodmap_candidates; do
    if [[ -f $fp ]]; then
      DISPLAY=:0 xmodmap "$fp"
      echo "$fp loaded" >>/dev/stderr
      break
    fi
  done
}

start-dbus() {
  if [ -f ~/.local/bin/rofi-askpass ]; then
    DISPLAY=:0 SUDO_ASKPASS=~/.local/bin/rofi-askpass sudo -A service dbus start
  elif command -v ssh-askpass &>/dev/null; then
    DISPLAY=:0 SUDO_ASKPASS=ssh-askpass sudo -A service dbus start
  else
    echo "Sudo required to start dbus" >>/dev/stderr
  fi
}

vcxsrv-is-running() {
  if [[ ! -f "$VCXSRV_PID" ]]; then
    echo "$VCXSRV_PID not found." >>/dev/stderr
    return 1
  fi

  if ! windows-process-running "vcxsrv.exe"; then
    echo "$VCXSRV_PID found, but vcxsrc.exe not running." >>/dev/stderr
    return 1
  fi

  return 0
}

vcxsrv-init() {
{'fraction_non_alphanumeric': 0.17504258943781942, 'fraction_numerical': 0.01575809199318569, 'mean_word_length': 2.838235294117647, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6668287', 'n_tokens_mistral': 1004, 'n_tokens_neox': 952, 'n_words': 214}