Skip to content

Commit

Permalink
make "open terminal here" context menu work for directory background (m…
Browse files Browse the repository at this point in the history
…icrosoft#8638)

This commit makes "Open in Windows Terminal" Context menu work again for
directory background even on system that OS fix is not applied.

This is a fallback solution to OS fixes mentioned in microsoft#6414.
While OS fix is on its way, we need a fallback that works on existing OS
versions.

The approach to this is: when no item is selected (nullptr for
IShellItemArray*), we use shell api to query the path of current active
Explorer window. A special case is handled for Windows Desktop. Once
we are able to obtain the path, we launch Windows Terminal with it.

## Validation Steps Performed
1. Right click on desktop to bring up the Context menu, pick "Open in
   Windows Terminal", verify that a terminal is opened with correct
   initial path.

2. Open a few File Explorer windows, pick any window, navigate to a
   folder, click on "Background" to bring up the context menu, click
   "Open in Windows Terminal" verify that a terminal is opened with
   correct initial path.

Closes microsoft#6414
  • Loading branch information
hereafter authored and mpela81 committed Jan 28, 2021
1 parent a0cff78 commit a2faae7
Show file tree
Hide file tree
Showing 9 changed files with 135 additions and 72 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
checkboxes
CSIDL
csv
horiz
IDispatch
inlines
IWeb
Progman
reserialize
SHANDLE
SHGFP
udk
unfocus
WClass
40 changes: 0 additions & 40 deletions .github/actions/spell-check/expect/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ BOLDFONT
BOOLIFY
bools
boostorg
Bopomofo
Borland
BOTTOMLEFT
BOTTOMRIGHT
Expand Down Expand Up @@ -248,7 +247,6 @@ charset
CHARSETINFO
chcp
checkbox
Checkboxes
chh
Childitem
chk
Expand Down Expand Up @@ -384,7 +382,6 @@ CORESYSTEM
cotaskmem
countof
cout
CParams
CPG
cpinfo
CPINFOEX
Expand Down Expand Up @@ -413,7 +410,6 @@ csbi
csbiex
csharp
CSHORT
cso
csproj
Csr
csrmsg
Expand All @@ -426,7 +422,6 @@ cstdlib
cstr
cstring
cstyle
CSV
CSwitch
CText
ctime
Expand Down Expand Up @@ -628,7 +623,6 @@ doskey
dotnet
doubleclick
downlevel
DOWNSCALE
dpg
dpi
DPIAPI
Expand Down Expand Up @@ -841,7 +835,6 @@ gcy
gdi
gdip
gdirenderer
GENERATEPROJECTPRIFILE
geopol
GETALIAS
GETALIASES
Expand Down Expand Up @@ -957,7 +950,6 @@ hfont
hglobal
hh
hhh
hhhh
hhook
hhx
HIBYTE
Expand All @@ -984,7 +976,6 @@ hmod
hmodule
hmon
HMONITOR
Horiz
HORZ
hostable
hostlib
Expand Down Expand Up @@ -1097,10 +1088,8 @@ INITMENU
inkscape
inl
INLINEPREFIX
Inlines
INotify
inout
INPATHROOT
inproc
Inputkeyinfo
INPUTPROCESSORPROFILE
Expand All @@ -1113,7 +1102,6 @@ INTERCEPTCOPYPASTE
INTERNALNAME
interop
interoperability
intersectors
inthread
intptr
intsafe
Expand Down Expand Up @@ -1212,7 +1200,6 @@ KJ
KLF
KLMNOPQRST
KLMNOPQRSTQQQQQ
Kode
KU
KVM
KX
Expand Down Expand Up @@ -1344,7 +1331,6 @@ mailto
majorly
makeappx
MAKEINTRESOURCE
MAKEINTRESOURCEA
MAKEINTRESOURCEW
MAKELANGID
MAKELONG
Expand Down Expand Up @@ -1417,7 +1403,6 @@ monostate
MOUSEACTIVATE
MOUSEFIRST
MOUSEHWHEEL
mousemode
MOUSEMOVE
mousewheel
MOVESTART
Expand All @@ -1439,7 +1424,6 @@ MSGSELECTMODE
msiexec
MSIL
msix
msixbundle
msrc
msvcrt
MSVS
Expand Down Expand Up @@ -1842,7 +1826,6 @@ pshn
PSHNOTIFY
PSHORT
pshpack
psin
PSINGLE
psl
psldl
Expand Down Expand Up @@ -1962,16 +1945,13 @@ Replymessage
repositorypath
rescap
Resequence
Reserialize
RESETCONTENT
resheader
resizable
resmimetype
reso
restrictedcapabilities
resw
resx
RETROII
retval
rfa
rfc
Expand All @@ -1991,7 +1971,6 @@ rgpwsz
rgrc
rgs
rgui
rgus
rgw
rgwch
rhs
Expand Down Expand Up @@ -2042,14 +2021,11 @@ SBCSDBCS
sbi
sbiex
sbold
sbri
scanbri
scancode
scanline
schemename
SCL
scm
scol
scprintf
SCRBUF
SCRBUFSIZE
Expand Down Expand Up @@ -2128,7 +2104,6 @@ sfi
SFINAE
SFUI
sgr
SGRXY
SHCo
shcore
shellapi
Expand Down Expand Up @@ -2183,9 +2158,6 @@ SOURCESDIRECTORY
SPACEBAR
spammy
spand
spe
sph
spherefunctions
splashscreen
sprintf
sqlproj
Expand Down Expand Up @@ -2303,7 +2275,6 @@ TCI
tcome
tcommandline
tcommands
tcon
TDelegated
TDP
TEAMPROJECT
Expand Down Expand Up @@ -2449,8 +2420,6 @@ ucdxml
uch
UCHAR
ucs
UDK
UDKs
UDM
uer
uget
Expand All @@ -2473,7 +2442,6 @@ UNCPRIORITY
undef
Unescape
unexpand
Unfocus
unhighlighting
unhosted
unicode
Expand Down Expand Up @@ -2564,7 +2532,6 @@ vga
vgaoem
viewkind
viewports
Viginetting
Virt
VIRTTERM
Virtualizing
Expand Down Expand Up @@ -2781,7 +2748,6 @@ wwaproj
WWith
wx
wxh
wz
xa
xact
xamarin
Expand All @@ -2800,14 +2766,12 @@ XColors
xcopy
XCount
xdy
xe
XEncoding
xes
Xes
XES
xff
XFile
xlang
XManifest
XMath
XMFLOAT
Expand All @@ -2831,9 +2795,7 @@ xutr
xvalue
XVIRTUALSCREEN
XWalk
XWV
xy
xyw
Xzn
yact
YAML
Expand All @@ -2850,7 +2812,6 @@ YVIRTUALSCREEN
Yw
YWalk
yx
yzx
Zc
ZCmd
ZCtrl
Expand All @@ -2862,7 +2823,6 @@ zu
zxcvbnm
zy
AAAAABBBBBBCCC
AAAAA
BBBBBCCC
abcd
LPMINMAXINFO
Expand Down
9 changes: 2 additions & 7 deletions src/cascadia/CascadiaPackage/Package-Dev.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,9 @@
<desktop5:ItemType Type="Directory">
<desktop5:Verb Id="Command1" Clsid="9f156763-7844-4dc4-b2b1-901f640f5155" />
</desktop5:ItemType>
<!-- Due to a bug in the OS, this doesn't actually work right -
we'll get a nullptr in our implementation. So this is disabled
temporarily. See MSFT:24623699 for more details.
<desktop5:ItemType Type="Directory\Background">
<desktop5:Verb Id="Command2" Clsid="9f156763-7844-4dc4-b2b1-901f640f5155" />
</desktop5:ItemType>
-->
<desktop5:Verb Id="Command2" Clsid="9f156763-7844-4dc4-b2b1-901f640f5155" />
</desktop5:ItemType>
</desktop4:FileExplorerContextMenus>
</desktop4:Extension>

Expand Down
8 changes: 1 addition & 7 deletions src/cascadia/CascadiaPackage/Package-Pre.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,9 @@
<desktop5:ItemType Type="Directory">
<desktop5:Verb Id="Command1" Clsid="9f156763-7844-4dc4-b2b1-901f640f5155" />
</desktop5:ItemType>
<!-- Due to a bug in the OS, this doesn't actually work right -
we'll get a nullptr in our implementation. So this is disabled
temporarily. See MSFT:24623699 for more details.
<desktop5:ItemType Type="Directory\Background">
<desktop5:Verb Id="Command2" Clsid="9f156763-7844-4dc4-b2b1-901f640f5155" />
<desktop5:Verb Id="Command2" Clsid="9f156763-7844-4dc4-b2b1-901f640f5155" />
</desktop5:ItemType>
-->

</desktop4:FileExplorerContextMenus>
</desktop4:Extension>

Expand Down
7 changes: 1 addition & 6 deletions src/cascadia/CascadiaPackage/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,9 @@
<desktop5:ItemType Type="Directory">
<desktop5:Verb Id="Command1" Clsid="9f156763-7844-4dc4-b2b1-901f640f5155" />
</desktop5:ItemType>
<!-- Due to a bug in the OS, this doesn't actually work right -
we'll get a nullptr in our implementation. So this is disabled
temporarily. See MSFT:24623699 for more details.
<desktop5:ItemType Type="Directory\Background">
<desktop5:Verb Id="Command2" Clsid="9f156763-7844-4dc4-b2b1-901f640f5155" />
<desktop5:Verb Id="Command2" Clsid="9f156763-7844-4dc4-b2b1-901f640f5155" />
</desktop5:ItemType>
-->
</desktop4:FileExplorerContextMenus>
</desktop4:Extension>

Expand Down
Loading

0 comments on commit a2faae7

Please sign in to comment.