The Cookie Machine - Click here to drag window

DUMMY TEXT - Real text set in assets/js/theCookieMachine.js

If you can read me, I'm broken!

Views: 11,130     Votes:  7     ✅ Solution
Tags: bash   gui   shortcuts   windows-subsystem-for-linux   yad  
Link: 🔍 See Original Answer on Ask Ubuntu ⧉ 🔗

URL: https://askubuntu.com/q/979332
Title: Windows Subsystem for Linux desktop shortcut to GUI
ID: /2017/11/23/Windows-Subsystem-for-Linux-desktop-shortcut-to-GUI
Created: November 23, 2017    Edited:  June 12, 2020
Upload: April 8, 2024    Layout:  post
TOC: false    Navigation:  false    Copy to clipboard:  false


Why didn’t I think of that?

This is one of those solutions where you look at it and think “Why didn’t I think of that?”. Unfortunately I had to look at many websites with wrong suggestions or over-kill such as “how to use regedit to run shortcut as admin”.

Having the right parameters

Right click on your Windows 10 desktop and setup your shortcut to look like this:

Windows 10 shortcut properties

The full line for the Target field should look like this:

C:\Windows\System32\bash.exe -c "cd && DISPLAY=:0 /mnt/e/bin/lock-screen-timer"

NOTE: Most users will use /mnt/c/.... as their path but I’m dual-booting and the same script is shared by WSL and Ubuntu 16.04 so must be on a separate NTFS partition I’ve called /mnt/e. WSL cannot write to a Linux ext4 drive and Linux nor Windows Apps can write to a WSL sub-directory. It’s complicated…

Also note the DISPLAY=:0 parameter accommodates calling a bash GUI script but the same is likely true if calling gedit or nautilus which are my next desktop shortcut projects. If not, I’ll revise this answer..

Click the Change Icon button to get a default list of icons to choose from. This is where the clock icon came from.

⇧ Cannot suspend with NVMe M.2 SSD Windows Subsystem for Linux display Linux distribution?  ⇩