winmode concept hmm

master
Jordan Orelli 2 years ago
parent fc39e2fdc3
commit 2a285a3006

@ -19,6 +19,7 @@ files=
# systems relative to the user's home directory
[map.posix]
nvim/init.vim=.config/nvim/init.vim
scripts/winmode=bin/winmode
# items in the map.windows section defines a place where config files will be
# placed on windows, relative to the user's home directory

@ -0,0 +1,12 @@
#!/usr/bin/env python
"""
creates hardlinks to files in windows
"""
import platform
import sys
if platform.system() != 'Windows':
print("You gotta run this on windows")
sys.exit(1)

@ -0,0 +1,35 @@
#!/usr/bin/env python
"""
places the wsl instance into winmode
"""
import os
import pathlib
import subprocess
import shutil
env = os.environ
env['PS1'] = f"(W) {env['PS1']}"
path = env['PATH']
parts = path.split(':')
winbin_dir = pathlib.Path('/home/jorelli/.config/winbin')
winbin_dir.mkdir(parents=True, exist_ok=True)
links = {
'cargo': '/mnt/c/Users/jordan/.cargo/bin/cargo.exe',
'python': '/mnt/c/Users/jordan/AppData/Local/Microsoft/WindowsApps/python.exe',
}
for k, v in links.items():
target_path = winbin_dir / k
target_path.symlink_to(v)
parts.insert(0, '/home/jorelli/.config/winbin')
env['PATH'] = ':'.join(parts)
subprocess.run('/usr/bin/bash --norc', shell=True, check=False, env=env)
shutil.rmtree(winbin_dir)
Loading…
Cancel
Save