14 lines
525 B
Bash
14 lines
525 B
Bash
#!/bin/bash
|
|
|
|
# Provides a stub for WSL when using X11 forwarding to ensure the xauthority is updated correctly.
|
|
|
|
# First make a timestamp that represents "startup" timestamp
|
|
touch "$HOME/.uptime_tag" -d "$(uptime -s)"
|
|
# If file is missing or is outdated, fix it!
|
|
if [[ ! -e "$HOME/.Xauthority" || "$HOME/.uptime_tag" -nt "$HOME/.Xauthority" ]]; then
|
|
# then create the new Xauthority file IF display is defined
|
|
# but only do it if we have a display
|
|
if [[ ! -z "$DISPLAY" ]]; then
|
|
xauth add "$DISPLAY" . $(mcookie)
|
|
fi
|
|
fi
|