From f5faaaa51beb2c69678e21535387e09c5189cd93 Mon Sep 17 00:00:00 2001 From: Riley Housden Date: Thu, 27 Jan 2022 02:26:41 -0500 Subject: [PATCH] added wsl support for bwg --- .xonshrc | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.xonshrc b/.xonshrc index a9358dc..21e9ffd 100644 --- a/.xonshrc +++ b/.xonshrc @@ -10,9 +10,23 @@ class CommandNotFoundException(Exception): def __init__(self, command): super().__init__(f"Command '{command}' not found.") +# Windows Subsystem for Linux stuff + +def in_wsl() -> bool: + version = p'/proc/version'.read_text() + if "microsoft" in version: + return True + return False + +if in_wsl(): + $GPG_TTY=$(tty) + def to_clipboard(text: str): - requires("xclip") - $(echo -n @(text) | xclip -sel clipboard) + if in_wsl(): + $(echo -n @(text) | clip.exe) + else: + requires("xclip") + $(echo -n @(text) | xclip -sel clipboard) def requires(command: str): if not !(which @(command)):