franciscolourenco / done

A fish-shell package to automatically receive notifications when long processes finish.
MIT License
767 stars 70 forks source link

Not doing anything on WSL 2 with burnt toast installed #85

Open noahgaertner opened 4 years ago

noahgaertner commented 4 years ago

When I run sleep 6 like in the readme.md, no burnt toast output is displayed. Burnt toast does work when the New-BurntToastNotification command is run in both PowerShell 5 (default windows) and PowerShell 7 (the new open source one), which means it isn't a executionpolicy issue.

ammgws commented 4 years ago

Does it still do nothing if you minimise the window while it's sleeping?

noahgaertner commented 4 years ago

Yes, it does. I'm using the new windows terminal, if that matters at all.

noahgaertner commented 4 years ago

I just also tested it in the ubuntu app and it also doesn't work, so it shouldn't be an emulator issue

ammgws commented 4 years ago

There were recent changes made regarding WSL, to rule those out perhaps try an older release such as https://github.com/franciscolourenco/done/releases/tag/1.14.5 and see if it still reproduces?

noahgaertner commented 4 years ago

I just tried the old version, it does the same thing.

noahgaertner commented 4 years ago

Is the issue perhaps that done needs to be running a custom command? I do not have one set at the moment.

ammgws commented 4 years ago

For troubleshooting you could try setting a custom command to see if it even tries to run it or not. I don't have access to WSL2 so can't try it myself. Can you see if it works on WSL1?

noahgaertner commented 4 years ago

Okay, so I just tried the normal command in WSL 1 by cloning a large git repo (sleep doesn't work in wsl 1 apparently) and it still did not work. I'll try a couple custom commands tomorrow morning.

archilkarchava commented 3 years ago

The issue for me was this chunk of code uname -a | string match --quiet --regex Microsoft on lines 57 and 204. Unlike WSL1, WSL2 comes bundled with a real linux kernel, here's the output of uname -a: Linux DESKTOP-RDMPIAF 4.19.104-microsoft-standard #1 SMP Wed Feb 19 06:37:35 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux. We could try matching both microsoft and Microsoft, but WSL2 can use custom kernels without microsoft included in the name.

ammgws commented 3 years ago

There's an active issue on the WSL issue tracker about detection but I can't find it at the moment.

franciscolourenco commented 3 years ago

Does this improve detection for custom kernels? https://stackoverflow.com/a/43618657

archilkarchava commented 3 years ago

Here's fork with a quick fix https://github.com/archilkarchava/done, custom kernel detection is not supported.

ammgws commented 3 years ago

Found the thread: https://github.com/Microsoft/WSL/issues/423

eugene-babichenko commented 3 years ago

I did a simple fix for that in #88, but a better way may be to rely on WSL specific variables being set (for instance, WSLENV). I am not sure it will work for custom kernels though.

❯ env | rg WSL
WSLENV=WT_SESSION::WT_PROFILE_ID
WSL_DISTRO_NAME=Ubuntu-20.04
WSL_INTEROP=/run/WSL/25821_interop
franciscolourenco commented 3 years ago

@noahgaertner can you check if this is fixed in v1.14.10?

franciscolourenco commented 3 years ago

@noahgaertner ping

noahgaertner commented 3 years ago

@noahgaertner ping

My laptop is currently with {manufacturer} to get fixed, I'll take a look at this when I get it back.

franciscolourenco commented 3 years ago

@noahgaertner

Pitasi commented 3 years ago

@franciscolourenco i'm using ubuntu on wsl2 and nothing seems to happen to me too.

$ echo $__done_version
1.16.1

$ uname -a
Linux DESKTOP-XXX 4.19.128-microsoft-standard #1 SMP Tue Jun 23 12:58:10 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

launching __done_windows_notification test notif manually seems to be working fine.

I'll be happy to provide more info since this plugin was really part of my workflow on linux (and thanks btw!) 😁

Pitasi commented 3 years ago

hah, I may have found my issue.

I have a X org server running (VcXsrv) so that I can use xorg apps in windows, and the problem seems to be here: https://github.com/franciscolourenco/done/blob/8fd2bc5c95a93b65452281459a167f1bbfb58990/conf.d/done.fish#L84-L85 that returns true.

Swapping this if with the windows one at https://github.com/franciscolourenco/done/blob/8fd2bc5c95a93b65452281459a167f1bbfb58990/conf.d/done.fish#L89 is sufficient, personally tested.

std4453 commented 2 years ago

WSL systems might have Linux desktop utililies like notify-send that come installed with other packages, but Linux systems should not (normally) contain 'microsoft' in their uname -a, so I think it might be preferrable to put WSL-specific checks before the others.