wslu icon indicating copy to clipboard operation
wslu copied to clipboard

[wslusc] Shortcut is invalid after I change the icon of it.

Open stskyblade opened this issue 2 years ago • 11 comments

Background Information:

  • wslu v2.3.6; wslusc v37
  • WSL: Ubuntu 20.04

Describe the bug I use this command wslusc -g -e "export DISPLAY=$(grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}'):0 LIBGL_ALWAYS_INDIRECT=1;" $(which emacs) to create a shortcut for emacs. That shortcut works. But after I changed the icon of it, it doesn't work anymore. (spacemacs.ico downloaded from here: https://github.com/nashamri/spacemacs-logo)

stskyblade avatar Feb 01 '22 05:02 stskyblade

Can you show the results from the Windows PowerShell using $s=(New-Object -COM WScript.Shell).CreateShortcut("<PATH/TO/YOUR/SHORCUT>"); $s and replace <PATH/TO/YOUR/SHORCUT> with the path to your shortcut? Thank you!

patrick330602 avatar Feb 15 '22 09:02 patrick330602

Also, please try out the PPA version of wslu using the method here: https://wslutiliti.es/wslu/install.html#ubuntu

patrick330602 avatar Feb 15 '22 09:02 patrick330602

PS C:\Users\stskyblade> $s=(New-Object -COM WScript.Shell).CreateShortcut("C:\\Users\\stskyblade\\Desktop\\emacs.lnk"); $s


FullName         : C:\Users\stskyblade\Desktop\emacs.lnk
Arguments        : C:\\Users\\stskyblade\wslu\runHidden.vbs "C:\\Users\\stskyblade\\AppData\\Local\\Microsoft\\WindowsApps\\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\\ubuntu2004.exe" run "cd ~;
                    . /usr/share/wslu/wsl-integration.sh; export DISPLAY=172.21.0.1:0 LIBGL_ALWAYS_INDIRECT=1; /usr/bin/emacs"
Description      :
Hotkey           :
IconLocation     : C:\\Users\\stskyblade\wslu\wsl.ico,0
RelativePath     :
TargetPath       : C:\Windows\System32\wscript.exe
WindowStyle      : 1
WorkingDirectory :

stskyblade avatar Feb 23 '22 08:02 stskyblade

I have reinstalled wslu using PPA. Here is wslu version:

> wslusc --version                                                                                                                                                                      ─╯

wslu v3.2.2-1; wslusc v40

The new generated shortcut emacs-27.127 is invalid as well. Here is output of your command:

PS C:\Users\stskyblade> $s=(New-Object -COM WScript.Shell).CreateShortcut("C:\\Users\\stskyblade\\Desktop\\emacs-27.127.lnk"); $s


FullName         : C:\Users\stskyblade\Desktop\emacs-27.127.lnk
Arguments        : C:\\Users\\stskyblade\wslu\runHidden.vbs C:\\Users\\stskyblade\\AppData\\Local\\Microsoft\\WindowsApps\\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\\ubuntu2004.exe run export D
                   ISPLAY=172.23.16.1:0 LIBGL_ALWAYS_INDIRECT=1; /usr/share/wslu/wslusc-helper.sh "/usr/bin/emacs-27.127 "
Description      :
Hotkey           :
IconLocation     : C:\\Users\\stskyblade\wslu\wsl-gui.ico,0
RelativePath     :
TargetPath       : C:\Windows\System32\wscript.exe
WindowStyle      : 1
WorkingDirectory :

stskyblade avatar Feb 24 '22 13:02 stskyblade

Are you using Windows 11 with WSLg?

patrick330602 avatar Mar 18 '22 02:03 patrick330602

I'm using Windows 10.

stskyblade avatar Apr 05 '22 06:04 stskyblade

Can you print the content of the shortcut after you change the icon? Thanks!

patrick330602 avatar Apr 07 '22 06:04 patrick330602

Do you mean the output of $s=(New-Object -COM WScript.Shell).CreateShortcut("C:\\Users\\stskyblade\\Desktop\\emacs-27.127.lnk"); $s ?

This is a shortcut with original icon, and it doesn't work now.

PS C:\Users\stskyblade>  $s=(New-Object -COM WScript.Shell).CreateShortcut("C:\\Users\\stskyblade\\Desktop\\emacs-27.127.lnk"); $s


FullName         : C:\Users\stskyblade\Desktop\emacs-27.127.lnk
Arguments        : C:\\Users\\stskyblade\wslu\runHidden.vbs C:\\Users\\stskyblade\\AppData\\Local\\Microsoft\\WindowsApps\\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\\ubuntu2004.exe run export D
                   ISPLAY=172.21.128.1:0 LIBGL_ALWAYS_INDIRECT=1; /usr/share/wslu/wslusc-helper.sh "/usr/bin/emacs-27.127 "
Description      :
Hotkey           :
IconLocation     : C:\\Users\\stskyblade\wslu\wsl-gui.ico,0
RelativePath     :
TargetPath       : C:\Windows\System32\wscript.exe
WindowStyle      : 1
WorkingDirectory :

stskyblade avatar Apr 07 '22 07:04 stskyblade

Interesting... Since I see nothing wrong in this but only this part: export DISPLAY=172.21.128.1:0 LIBGL_ALWAYS_INDIRECT=1; Can you check your IP changed? Also /usr/share/wslu/wslusc-helper.sh (https://github.com/wslutilities/wslu/blob/master/src/etc/wslusc-helper.sh) should already handle DISPLAY part

patrick330602 avatar Apr 07 '22 08:04 patrick330602

I have confirmed there is a network adapter which has IP 172.21.128.1 in the Task Manager of Win10. And I can open an Emacs window successfully while using this command DISPLAY=172.21.128.1:0 emacs.

stskyblade avatar Apr 07 '22 11:04 stskyblade

Interesting... I am really unable to reproduce your bug. I will try to look for some other people who can help reproduce the bug so I can see what's wrong.

patrick330602 avatar Apr 09 '22 01:04 patrick330602