[GH-ISSUE #35] Custom j2-template seems not to be working #31

Closed
opened 2026-03-04 12:24:05 +03:00 by kerem · 2 comments
Owner

Originally created by @NorseJedi on GitHub (Feb 18, 2021).
Original GitHub issue: https://github.com/cascadium/wsl-windows-toolbar-launcher/issues/35

I'm trying to make this use zsh rather than bash, and found a closed issue (#32) where it was explained you have to make use of a custom template for that. So I made this template where I only changed the first line:

#!/bin/zsh -i

source {{rcfile}}

{% if exec_dir is defined and exec_dir != "" %}

cd "{{exec_dir}}"

{% endif %}

{% if run_in_terminal is defined and run_in_terminal == True %}

{{command}}

{% else %}

{{command}} > /dev/null 2>&1 &
disown

{% endif %}

I then run this command:
wsl-windows-toolbar -r ~/.zshrc -J ~/etc/wslmenu-template.sh.j2

The output of the command indicates that the file is being used:

2021-02-18 20:50:28,843[INFO]: jinja_template_shell = /home/roy/etc/wslmenu-template.sh.j2

There are no errors in the output, just a warning about it not finding an icon-file for windows, which I assume isn't relevant.

However, the shortcut scripts created in %USERPROFILE%/.config/wsl-windows-toolbar-launcher/metadata/ do not reflect this, they're created with #!/bin/bash -i at the first line.

Originally created by @NorseJedi on GitHub (Feb 18, 2021). Original GitHub issue: https://github.com/cascadium/wsl-windows-toolbar-launcher/issues/35 I'm trying to make this use zsh rather than bash, and found a closed issue (#32) where it was explained you have to make use of a custom template for that. So I made this template where I only changed the first line: > #!/bin/zsh -i > > source {{rcfile}} > > {% if exec_dir is defined and exec_dir != "" %} > > cd "{{exec_dir}}" > > {% endif %} > > {% if run_in_terminal is defined and run_in_terminal == True %} > > {{command}} > > {% else %} > > {{command}} > /dev/null 2>&1 & > disown > > {% endif %} I then run this command: `wsl-windows-toolbar -r ~/.zshrc -J ~/etc/wslmenu-template.sh.j2` The output of the command indicates that the file is being used: > 2021-02-18 20:50:28,843[INFO]: jinja_template_shell = /home/roy/etc/wslmenu-template.sh.j2 There are no errors in the output, just a warning about it not finding an icon-file for windows, which I assume isn't relevant. However, the shortcut scripts created in `%USERPROFILE%/.config/wsl-windows-toolbar-launcher/metadata/` do not reflect this, they're created with `#!/bin/bash -i` at the first line.
kerem closed this issue 2026-03-04 12:24:06 +03:00
Author
Owner

@fquinner commented on GitHub (Feb 18, 2021):

Thanks yeah this looks like a bug. It will only work if values for both -J (shell template) and -j (batch template) are provided - will need to fix that. In the meantime try providing both and it should work.

<!-- gh-comment-id:781609741 --> @fquinner commented on GitHub (Feb 18, 2021): Thanks yeah this looks like a bug. It will only work if values for both `-J` (shell template) *and* `-j` (batch template) are provided - will need to fix that. In the meantime try providing both and it should work.
Author
Owner

@NorseJedi commented on GitHub (Feb 18, 2021):

Thank you, yes, that works :)

<!-- gh-comment-id:781621138 --> @NorseJedi commented on GitHub (Feb 18, 2021): Thank you, yes, that works :)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/wsl-windows-toolbar-launcher#31
No description provided.