Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Don't fail when powershell.exe is missing #67

Merged
merged 2 commits into from
Feb 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions conf.d/done.fish
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,17 @@ if test -z "$SSH_CLIENT" # not over ssh
echo -e "\a" # bell sound
end

else if uname -a | string match --quiet --regex Microsoft
if powershell.exe -command "Import-Module -Name BurntToast" 2>/dev/null
if test "$__done_notify_sound" -eq 1
set soundopt "-Sound Default"
end
powershell.exe -command New-BurntToastNotification -Text \""$title"\",\""$message"\" $soundopt
else if uname -a | string match --quiet --regex Microsoft; \
and set -l powershell_exe (command -v "powershell.exe"); \
or set -l powershell_exe \
(wslpath (wslvar windir)/System32/WindowsPowerShell/v1.0/powershell.exe); \
and test -x "$powershell_exe"; \
and "$powershell_exe" -command "Import-Module -Name BurntToast" 2>/dev/null

if test "$__done_notify_sound" -eq 1
set soundopt "-Sound Default"
end
command "$powershell_exe" -command New-BurntToastNotification -Text \""$title"\",\""$message"\" $soundopt

else # anything else
echo -e "\a" # bell sound
Expand Down