wezterm
wezterm copied to clipboard
Bring "Open Wezterm Here" menu item on Windows 11 context menu
Describe the solution you'd like
Windows 11 brings a new context menu and if you want you can switch to old Windows 11 context menu. On new windows 11 context menu Windows Terminal comes by default. But after installing Wezterm, Open Wezterm Here context menu item only appears in old win10 context menu.
Here is a gif:
Is there a way to bring wezterm to Win11 context menu. Can you make it default when we install wezterm.
Thank you.
Anyone can bring old windows 10 menu by using this by using this reg file:
https://gitlab.com/-/snippets/2547911
But I do not want that. I want wezterm menu item on windows 11 context menu. Thank you.
If you (or someone else) can find out what APIs and/or registry stuff is needed to make it show up there, then that gives us a starting point for this.
In my next free time, I will look for this 👍
After doing some digging, it seems an app must either be packaged in the MSIX format, or granted identity (1) via other methods to appear on the condensed Windows 11 context menu. I was able to easily bundle the existing WezTerm installer (2) as an MSIX package with the MSIX Packaging Tool (3) as a test, but I believe to appear on the context menu it needs to implement a shell extension as the registry is virtualized for MSIX apps.
If you package your Windows app using MSIX, the registry is virtualized, and therefore your app can't register File Explorer extensions via the registry. (4)
Either packaging method would likely require a shell extension implementation for anything other than a file type association. Definitely not a trivial task just to save one button click!
(1) Grant package identity to non (MSIX) packaged apps (2) Create an MSIX package from any desktop installer (3) MSIX Packaging Tool (4) Integrate with File Explorer
If a COM shell extension is required for this, it seems like it would make sense to also consider registering as a default terminal at the same time, which AFAIU, also requires a COM shell extension:
- https://github.com/wez/wezterm/issues/2416
im willing to create if people are still interested in this if you like @wez
@modz2014 I would love to see a PR for this, yes!
@wez I will work on this also for the msix package you will need to get it signed I can make an external package spare package or msix package with the full software in it If you would like to chat about it please DM on Discord modz2014#4684
I'd prefer that the solution to this gets deployed as part of the existing iss installer. re: code signing, we don't have that in place yet. Maybe https://github.com/Azure/trusted-signing-action/issues/10 will have a path for that.
@wez possibly but this section will be yours as its your project also if you create the full msix package and upload it to the Microsoft store they sign it for us
@wez here is an example for i just created now but I need to create a msix package project in visual studio or I can make a batch script to build the msix package and sign it for testing it
@wez i have made it in C++ is that ok no
https://github.com/user-attachments/assets/a70ce01e-ecf3-46ed-a0ca-343541f1ef81
https://github.com/user-attachments/assets/568408da-bc61-4bd2-9a15-879f77b5f2e3
To have these in you explorer follow the below steps:
- Install nilsoft shell
- Run it as administrator
- Click Register
- Shift + Right click in taskbar
- shell > config
- Before the lastline (i.e. import/taskbar) insert the below code snippet
item(title="nvim" tip=tip_run_admin admin=has_admin cmd='wezterm.exe' args='start --cwd "@sel.dir" nvim')
item(title="wezterm" tip=tip_run_admin admin=has_admin cmd='wezterm.exe' args='start --cwd "@sel.dir"')
- Save the file
- Shift + Right click taskbar
- shell > manager
- Click Restart Explorer
If you need logo like mine and the below logos in "~ \documents\logo'
Change the code to
item(title="nvim" tip=tip_run_admin admin=has_admin image="C:\\Users\\{Username}\\Documents\\logo\\nvim.png" cmd='wezterm.exe' args='start --cwd "@sel.dir" nvim')
item(title="wezterm" tip=tip_run_admin admin=has_admin image="C:\\Users\\{Username}\\Documents\\logo\\wezterm.png" cmd='wezterm.exe' args='start --cwd "@sel.dir"')
[Note from wez: this is handled already by the setup.exe installer of wezterm, and wez doesn't recommend doing this "by hand". This is NOT what is being requested in this thread, so I'm going to hide this particular comment.]
Add WezTerm on Windows context menu (right click)
- Open Registry Editor:
- Press
Win + R, typeregedit, and hitEnter. - (or find Registry Editor)
- Press
- Navigate to the Right Registry Key:
Go to:
Computer\HKEY_CLASSES_ROOT\Directory\Background\shell
(This is for adding it to the right-click menu when clicking on empty space in a folder.)
- Create a New Key:
- Right-click
shell, select New → Key, and name it:
- Right-click
Open with WezTerm
- Modify the Default Value (Optional):
- Select the newly created key (
Open with WezTerm). - In the right panel, double-click (Default) and set its value to:
- Select the newly created key (
Open in WezTerm
(This is the text that will appear in the context menu.)
- Add an Icon (Optional):
- Right-click on
Open with WezTerm, select New → String Value, and name itIcon. - Double-click
Iconand set its value to the path of WezTerm's executable, for example:
- Right-click on
C:\Program Files\WezTerm\wezterm-gui.exe
- Create the Command Key:
- Right-click
Open with WezTerm, select New → Key, and name it:
command- In the right panel, double-click (Default) and set its value to: default:
- Right-click
"C:\Program Files\WezTerm\wezterm-gui.exe" start --no-auto-connect --cwd "%V
or:
"C:\Program Files\WezTerm\wezterm.exe" start --cwd "%V
(Adjust the path if WezTerm is installed in a different location.)
Result:
this isn't for the new context menu @YaroslavShilov
On Windows 11, i use:
item(title='Wezterm' image='wezterm-gui.exe' tip=tip_run_admin admin=has_admin cmd='wezterm-gui.exe' args='start --cwd "@sel.path"').
But it always opens in my home directory (C:\Users\MYUSER), no matter where I start the context menu from.
@modz2014 Did you actually make a COM shell extension? how?
@nichoj10 @blue-devil @wez i have created a pull request WezTerm Shell #6756
You can do this without using nilshell press windows +r and enter notepad and paste the following according to your path
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\WezTerm Here] @="Open WezTerm Here" "Icon"="C:\Program Files\WezTerm\wezterm-gui.exe"
[HKEY_CLASSES_ROOT\Directory\Background\shell\WezTerm Here\command] @=""C:\Program Files\WezTerm\wezterm-gui.exe" start --cwd "%V""
save the file as a .reg file it will give you the option to merge this with the register(click yes)
if it doesnt give you the option by default go to where you saved the file and double click it , now you will get a 2 popups ,just click yes and it will work for you
now you can go in any folder and yu will get open wezterm here as an option
the new windows 11 context menu can open be done using IExploreerCommand in msix package
I just think think the other method is simpler but yeah ,in the end just do whatever works for your pc and is convenient tou you