diff --git a/config.ini b/config.ini index ceb5ae6..5dac812 100644 --- a/config.ini +++ b/config.ini @@ -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 diff --git a/scripts/winlinks b/scripts/winlinks new file mode 100644 index 0000000..7309c71 --- /dev/null +++ b/scripts/winlinks @@ -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) diff --git a/scripts/winmode b/scripts/winmode new file mode 100755 index 0000000..a763046 --- /dev/null +++ b/scripts/winmode @@ -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)