From 0799e4a69a370250a67c3a0d8d7246f09d808caf Mon Sep 17 00:00:00 2001 From: mintty Date: Wed, 7 Aug 2019 23:48:03 +0200 Subject: [PATCH] revert using mkshortcut.c --- config-distros.sh | 36 ++++++++++++++++++++++++++---------- install.bat | 10 +++++----- makefile | 11 ++++++----- makewinx.cfg | 8 +------- mkshortcut.vbs | 15 ++++++++++++--- 5 files changed, 50 insertions(+), 30 deletions(-) diff --git a/config-distros.sh b/config-distros.sh index 534eb41..d375082 100755 --- a/config-distros.sh +++ b/config-distros.sh @@ -1,7 +1,7 @@ #! /bin/sh # set some paths; capital variables are for the mkshortcut.exe case, -# not for the (deprecated) mkshortcut.vbs case +# not for the mkshortcut.vbs case case "$installdir" in ?*) custominst=true;; @@ -121,10 +121,25 @@ fi if $custominst && $config && ! $remove then - mkshortcut.exe -n "add to context menu" -a "$installdir/config-distros.sh -contextmenu" "$installdir/bin/dash.exe" -i '%SystemRoot%\System32\filemgmt.dll' -s min -d "" -w "$installdir" - mkshortcut.exe -n "add default to context menu" -a "$installdir/config-distros.sh -contextmenu-default" "$installdir/bin/dash.exe" -i '%SystemRoot%\System32\filemgmt.dll' -s min -d "" -w "$installdir" - mkshortcut.exe -n "remove from context menu" -a "$installdir/config-distros.sh -contextmenu-remove" "$installdir/bin/dash.exe" -i '%SystemRoot%\System32\filemgmt.dll' -s min -d "" -w "$installdir" - mkshortcut.exe -n "configure WSL shortcuts" -a "$installdir/config-distros.sh" "$installdir/bin/dash.exe" -i '%SystemRoot%\System32\filemgmt.dll' -s min -d "" -w "$installdir" + #mkshortcut.exe -n "add to context menu" -a "$installdir/config-distros.sh -contextmenu" "$installdir/bin/dash.exe" -i '%SystemRoot%\System32\filemgmt.dll' -s min -d "" -w "$installdir" + #mkshortcut.exe -n "add default to context menu" -a "$installdir/config-distros.sh -contextmenu-default" "$installdir/bin/dash.exe" -i '%SystemRoot%\System32\filemgmt.dll' -s min -d "" -w "$installdir" + #mkshortcut.exe -n "remove from context menu" -a "$installdir/config-distros.sh -contextmenu-remove" "$installdir/bin/dash.exe" -i '%SystemRoot%\System32\filemgmt.dll' -s min -d "" -w "$installdir" + #mkshortcut.exe -n "configure WSL shortcuts" -a "$installdir/config-distros.sh" "$installdir/bin/dash.exe" -i '%SystemRoot%\System32\filemgmt.dll' -s min -d "" -w "$installdir" + + icon='%SystemRoot%\System32\filemgmt.dll' + wdir="$installdir" + target="$installdir/bin/dash.exe" + minttyargs="/config-distros.sh" + bridgeargs= + export icon wdir target minttyargs bridgeargs + cscript /nologo mkshortcut.vbs "/name:configure WSL shortcuts" "/min:true" + bridgeargs=-contextmenu + cscript /nologo mkshortcut.vbs "/name:add to context menu" "/min:true" + bridgeargs=-contextmenu-default + cscript /nologo mkshortcut.vbs "/name:add default to context menu" "/min:true" + bridgeargs=-contextmenu-remove + cscript /nologo mkshortcut.vbs "/name:remove from context menu" "/min:true" + cmd /C copy "add to context menu.lnk" "%APPDATA%\\Microsoft\\Windows\\Start Menu\\Programs\\WSLtty" cmd /C copy "add default to context menu.lnk" "%APPDATA%\\Microsoft\\Windows\\Start Menu\\Programs\\WSLtty" cmd /C copy "remove from context menu.lnk" "%APPDATA%\\Microsoft\\Windows\\Start Menu\\Programs\\WSLtty" @@ -221,6 +236,7 @@ config () { echoc "- icon $icon" echoc "- root $root" bridgeargs=" " # deprecated + wdir=%USERPROFILE% if $ok && [ -n "$distro" ] then # fix #163: backend missing +x with certain mount options @@ -232,7 +248,7 @@ config () { if $ok && $config then - export name target minttyargs bridgeargs icon + export wdir name target minttyargs bridgeargs icon if $contextmenu then @@ -261,8 +277,8 @@ config () { cmd /C del "%LOCALAPPDATA%\\Microsoft\\WindowsApps\\$name~.bat" else # desktop shortcut in %USERPROFILE% -> Start Menu - WSLtty - ##cscript /nologo mkshortcut.vbs "/name:$name Terminal %" - mkshortcut.exe -n "$name Terminal %" -i "$icon" "$TARGETPATH" -a "$MINTARGS" -d "" -w %USERPROFILE% + cscript /nologo mkshortcut.vbs "/name:$name Terminal %" + #mkshortcut.exe -n "$name Terminal %" -i "$icon" "$TARGETPATH" -a "$MINTARGS" -d "" -w %USERPROFILE% cmd /C copy "$name Terminal %.lnk" "%APPDATA%\\Microsoft\\Windows\\Start Menu\\Programs\\WSLtty" # launch script in . -> WSLtty home, WindowsApps launch folder @@ -276,8 +292,8 @@ config () { MINTARGS="$MINTARGS -~" # desktop shortcut in ~ -> Start Menu - ##cscript /nologo mkshortcut.vbs "/name:$name Terminal" - mkshortcut.exe -n "$name Terminal" -i "$icon" "$TARGETPATH" -a "$MINTARGS" -d "" -w %USERPROFILE% + cscript /nologo mkshortcut.vbs "/name:$name Terminal" + #mkshortcut.exe -n "$name Terminal" -i "$icon" "$TARGETPATH" -a "$MINTARGS" -d "" -w %USERPROFILE% cmd /C copy "$name Terminal.lnk" "%APPDATA%\\Microsoft\\Windows\\Start Menu\\Programs" # default desktop shortcut in ~ -> Desktop diff --git a/install.bat b/install.bat index 023ca04..ddfca0e 100755 --- a/install.bat +++ b/install.bat @@ -30,7 +30,7 @@ rem copy "WSL Terminal.lnk" "%installdir%" rem copy "WSL Terminal %%.lnk" "%installdir%" copy config-distros.sh "%installdir%" -rem copy mkshortcut.vbs "%installdir%" +copy mkshortcut.vbs "%installdir%" rem allow persistent customization of default icon: if not exist "%installdir%\wsl.ico" copy tux.ico "%installdir%\wsl.ico" @@ -59,10 +59,10 @@ copy dash.exe "%installdir%\bin" copy regtool.exe "%installdir%\bin" copy zoo.exe "%installdir%\bin" -copy mkshortcut.exe "%installdir%"\bin -copy cygpopt-0.dll "%installdir%"\bin -copy cygiconv-2.dll "%installdir%"\bin -copy cygintl-8.dll "%installdir%"\bin +rem copy mkshortcut.exe "%installdir%"\bin +rem copy cygpopt-0.dll "%installdir%"\bin +rem copy cygiconv-2.dll "%installdir%"\bin +rem copy cygintl-8.dll "%installdir%"\bin rem create system config directory and copy config archive mkdir "%installdir%\usr\share\mintty\lang" diff --git a/makefile b/makefile index 8e479cb..5b6bf47 100644 --- a/makefile +++ b/makefile @@ -193,7 +193,7 @@ mintty-appx: cd mintty-$(minttyver)/src; sh ./mknames cp mintty-$(minttyver)/src/charnames.txt usr/share/mintty/info/ -cygwin: mkshortcutexe +cygwin: # mkshortcutexe mkdir -p bin cp /bin/cygwin1.dll bin/ cp /bin/cygwin-console-helper.exe bin/ @@ -231,10 +231,11 @@ cop: ver cp charnames.txt rel/ cp bin/wslbridge.exe rel/ cp bin/wslbridge-backend rel/ - cp bin/mkshortcut.exe rel/ - cp bin/cygpopt-0.dll rel/ - cp bin/cygiconv-2.dll rel/ - cp bin/cygintl-8.dll rel/ + cp mkshortcut.vbs rel/ + #cp bin/mkshortcut.exe rel/ + #cp bin/cygpopt-0.dll rel/ + #cp bin/cygiconv-2.dll rel/ + #cp bin/cygintl-8.dll rel/ cp LICENSE.* rel/ cp VERSION rel/ cp *.lnk rel/ diff --git a/makewinx.cfg b/makewinx.cfg index 6212bff..46ed568 100644 --- a/makewinx.cfg +++ b/makewinx.cfg @@ -57,10 +57,7 @@ FILE21="lang.zoo" FILE22="themes.zoo" FILE23="sounds.zoo" FILE24="mintty.ico" -FILE25="mkshortcut.exe" -FILE26="cygpopt-0.dll" -FILE27="cygiconv-2.dll" -FILE28="cygintl-8.dll" +FILE25="mkshortcut.vbs" [SourceFiles] SourceFiles0=. @@ -92,7 +89,4 @@ SourceFiles0=. %FILE23%= %FILE24%= %FILE25%= -%FILE26%= -%FILE27%= -%FILE28%= diff --git a/mkshortcut.vbs b/mkshortcut.vbs index b87973d..c93ecbd 100755 --- a/mkshortcut.vbs +++ b/mkshortcut.vbs @@ -1,7 +1,7 @@ rem cscript mkshortcut.vbs [/param:arg] /target:link rem /target:%LOCALAPPDATA%\wsltty\bin\mintty.exe -rem /workingdir:%USERPROFILE% +rem /wdir:%USERPROFILE% rem /icon:%LOCALAPPDATA%\wsltty\wsl.ico rem deprecated: /icon:%LOCALAPPDATA%\lxss\bash.ico rem deprecated: % @@ -29,8 +29,13 @@ rem wscript.echo "minttyargs: " & minttyargs rem wscript.echo lnk.Arguments rem Start in: -rem lnk.WorkingDirectory = Wscript.Arguments.Named("workingdir") -lnk.WorkingDirectory = "%USERPROFILE%" +rem wdir = Wscript.Arguments.Named("wdir") +wdir = wshell.ExpandEnvironmentStrings("%wdir%") +if IsEmpty(wdir) then + lnk.WorkingDirectory = "%USERPROFILE%" +else + lnk.WorkingDirectory = wdir +end if rem Icon: rem icon = Wscript.Arguments.Named("icon") @@ -48,6 +53,10 @@ rem lnk.HotKey = "ALT+CTRL+W" rem Run: rem 1: Normal 7: Minimized 3: Maximized rem lnk.WindowStyle = 1 +min = Wscript.Arguments.Named("min") +if min then + lnk.WindowStyle = 7 +end if rem Comment: rem lnk.IconLocation = Wscript.Arguments.Named("desc")