-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to work with WSL? #178
Comments
Yeah, this is such a nice package and I hope there is a way it can work with WSL GUI Emacs. I can still download from the URL, but there is no way to drag-and-drop local images. |
Also, the package is brilliant, but the |
I have the same problem, I use win10 + wsl2 + mobaxterm, and there is no way to drag or clip images. |
And I have find a solution with the help of windows Powershell, this is the solution function for replacing (defun my-yank-image-from-win-clipboard-through-powershell()
"to simplify the logic, use c:/Users/Public as temporary directoy, and move it into current directoy"
(interactive)
(let* ((powershell "/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe")
(file-name (format-time-string "screenshot_%Y%m%d_%H%M%S.png"))
;; (file-path-powershell (concat "c:/Users/\$env:USERNAME/" file-name))
(file-path-wsl (concat "./images/" file-name))
)
;; (shell-command (concat powershell " -command \"(Get-Clipboard -Format Image).Save(\\\"C:/Users/\\$env:USERNAME/" file-name "\\\")\""))
(shell-command (concat powershell " -command \"(Get-Clipboard -Format Image).Save(\\\"C:/Users/Public/" file-name "\\\")\""))
(rename-file (concat "/mnt/c/Users/Public/" file-name) file-path-wsl)
(insert (concat "[[file:" file-path-wsl "]]"))
(message "insert DONE.")
))
|
I have 0 knowledge about powershell, but from reading and experimenting, I found that the powershell command that you use doesn't save image and it also doesn't produce any error. I use 5.1 version. Can you help me formulate powershell command that would work on 5.1 version? |
I stumbled upon this as I was looking for a similar solution, and this function will work on WSL2 (I am running Ubuntu 20.04). Ensure that the pathing is right, particularly to the powershell command (/mnt/c/Windows/System32/...), the file-path-wsl concat path, and the shell and rename commands. For example, I changed my file-path-wsl to be "~/GDrive/emacs/org-download-images/". The powershell .exe hosted in System32 under v1.0 is Powershell 5.1 on Windows systems. Powershell 6+ is Powershell core and usually stored under Program Files. Also, the Get-Clipboard cmdlet in Powershell6+ doesnt support the Image format (yet), just Raw data, so you would want to utilize powershell 5.1 (as mentioned in the code above) if you want a built in cmdlet that can do that conversion. |
I wanted to continue using org-download so I just changed the org-download-screenshot-method:
|
any way to be able to use drag and drop? |
Does anyone have any success or tips for using this package when running Emacs in WSL? It doesn't appear to work out of the box.
The text was updated successfully, but these errors were encountered: