• Stars
    star
    159
  • Rank 235,916 (Top 5 %)
  • Language
    Python
  • License
    BSD 3-Clause "New...
  • Created over 4 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

xdg-open replacement for WSL that opens files and links using Windows apps.

xdg-open-wsl

xdg-open-wsl is an xdg-open replacement for WSL that opens files and links using Windows apps.

For WSL apps using X, e.g. emacs, this enables the opening of files using the relevant Windows tool.

Run Tests

Installation.

Until I publish to pypi, the easiest is option 1.

Option 1: Install from github using pip.

# make sure you have the latest pip
# NOTE: you HAVE to do this upgrade, else pip install won't know what to do without setup.py!
pip3 install --user --upgrade pip
# install xdg-open-wsl using your latest pip
pip install --user git+https://github.com/cpbotha/xdg-open-wsl.git
# ensure that the newly installed xdg-open is active
# the following command should show something like /home/username/.local/bin/xdg-open
which xdg-open

Option 2: Use the main script directly.

Download only the xdg_open_wsl.py script and save it as xdg-open into your ~/.local/bin/ or ~/bin/, whichever is in your PATH before any system xdg-open.

Ensure with which xdg-open that your new xdg-open is preferred.

FAQ.

Does this work for Emacs on WSL?

Why yes, of course it does. This is also why I wrote this in the first place.

Importantly, there is a "bug" somewhere between Emacs and the WSL which will cause org-open-file to block forever.

Follow the advice in my blog post Patch Emacs org-open-file using advice to fix this behaviour.

In short, simply add this to your init.el:

;; fix org-open-file for wsl by temporarily replacing start-process-shell-command with call-process-shell-command
;; if we don't do this, emacs on WSL will block forever trying to open exported file with windows handler
(defun wsl-fix-org-open-file (orig-org-open-file &rest args)
  ;; temporarily replace function,
  ;; see https://endlessparentheses.com/understanding-letf-and-how-it-replaces-flet.html
  (cl-letf (((symbol-function 'start-process-shell-command) #'call-process-shell-command))
    (apply orig-org-open-file args)))

(advice-add #'org-open-file :around #'wsl-fix-org-open-file)

More Repositories

1

nvpy

Simplenote syncing note-taking application, inspired by Notational Velocity and ResophNotes, but uglier and cross-platformerer.
Python
849
star
2

mlabwrap-purepy

Pure Python version of the mlabwrap Python to Matlab bridge
Python
28
star
3

devide

This is the official DeVIDE project site: github.com/cpbotha/devide
Python
27
star
4

homebrew-marmaduke-chromium

homebrew tap for the marmaduke builds of chromium
Ruby
24
star
5

braindump4000

jethrokuan's braindump modified for nested org-files and many broken links. Also Obsidian export!
Python
22
star
6

org-roam-canvas

render org-roam nodes as part of the obsidian canvas
Python
21
star
7

django-shell-ipynb

Django management command shell_ipynb that starts up the IPython Notebook as Django shell.
Python
21
star
8

bwtl-python-tutorials

Best way to learn Python tutorials
20
star
9

stdeb-minimal-example

Minimal example of turning a Python package into a DEB package using stdeb
Python
14
star
10

arduino-clion-minimal

CMake
14
star
11

vxdesktops.ahk

AutoHotkey script for fast switching between Windows 10 / 11 virtual desktops with hotkeys, and showing the current desktop number
AutoHotkey
14
star
12

ansible-ubu-to-pytorch

simple ansible playbook to take clean ubuntu 18.04 to CUDA 10, PyTorch 1.0, fastai, miniconda heaven
12
star
13

org-roam-similarity

Jupyter Notebook
10
star
14

deft-turbo

Recursive directory support and multiple file extensions for Deft (Emacs note-taking inspired by Notational Velocity)
Emacs Lisp
9
star
15

obsidian-ai-chat-as-md

TypeScript
9
star
16

ai-screenshot-namer

Rename your screenshots with ollama LLaVA, GPT-4o and macOS OCR
Python
5
star
17

dbwriter_python

minimal API with Python, FastAPI and SQLModel
Python
4
star
18

vxlabs-software-development-handbook

Org mode source of the vxlabs software development handbook.
3
star
19

dbwriter_go

minimal API made with Go, GORM, GIN and swaggo
Go
2
star
20

conan-sfml

Python
2
star
21

twentyseventeen-visorb

Wordpress Twenty Seventeen child theme with page sidebar
PHP
2
star
22

save_image_from_clipboard

Save any image from the X11 clipboard to disk in the format of your choice.
Python
2
star
23

papercite_static

Inject bibtex-rendered bibliograpies into your markdown, for static websites.
Python
2
star
24

org-mode-canvas

an attempt at making an HTML canvas where org-mode notes can be laid out, like Obsidian Canvas
Emacs Lisp
2
star
25

audio-my-book

use openai text-to-speech API to narrate whole books
Python
2
star
26

vtktudoss

C++
1
star
27

ipynb-open

Python
1
star
28

conan-demo

C++
1
star
29

cpbotha.github.io

source of the https://cpbotha.net/ (canonical URL) personal blog, which is now mirrored, at the moment without comments, at https://cpbotha.github.io/
CSS
1
star
30

devide.johannes

Automatically exported from code.google.com/p/devide.johannes
Python
1
star
31

typescript-emacs-demo

TypeScript
1
star
32

org-ms-todo

sync your org-mode tasks with Microsoft To-Do
Emacs Lisp
1
star
33

pandoc-md-docx-roundtrip

demo of roundtripping markdown to docx and back with pandoc
Lua
1
star