[solved] Win 7 + Trellis + WinNFSd + ConEmu - Run NFS in background tab?

I’m using Trellis on Windows 7, and I’ve enabled NFS per the instructions from another thread here (great suggestion btw, NFS totally fixed the speed of my Trellis). So when I run vagrant up, it starts a new tab and runs NFS in that tab.

What I’d like to do is have it somehow keep that tab in the background, or at least in the system tray rather than the taskbar. It’s just a bit annoying to have to keep this extra tab open for NFS, when I never really use it for anything or type anything into it, and it seems to just need to be open in order for NFS to run.

Any idea how I can tell ConEmu to run this tab in the background? Or tell Trellis to tell ConEmu, or whatever?

edit

I just realized this may seem like “not a trellis issue”. I guess I was hoping that there may be some trellis-specific way to instruct NFS to either run in the background, or always run on boot or something. I figured maybe there’s something I can set in the vagrantfile where I made the modification to enable NFS in the first place.

edit2

As usual, just after posting the question here I find the solution. At the top right of ConEmu, in it’s settings dropdown (“hamburger menu”), there’s an option to “Hide to TSA”. This indeed minimizes the window to the system tray area.

TL;DR:

On Windows with ConEmu, when you run vagrant up it will start a new tab with WinNFSd. You can move that tab to a new ConEmu window, and then hide that window in ConEmu’s main dropdown hamburger menu thing by clicking “Hide to TSA”.

See this discussion: https://github.com/winnfsd/vagrant-winnfsd/issues/77

That worked for me. Except I don’t much care for the batch file used by winnfsd or vagrant-winnfsd. Here’s my batch file…

@echo off
tasklist /nh /fi "imagename eq winnfsd.exe" | findstr -i winnfsd.exe
if errorlevel 1 set NFSDISABLED=true

if [%1]==[status] (
    printf "[NFS] Status: "
    if defined NFSDISABLED (
        printf "halted\n" 
        exit /b 1
    )
    printf "running\n"
    exit /b 0
)

if [%1]==[start] (
    printf "[NFS] Start: "
    if defined NFSDISABLED (
        start winnfsd -log off -pathFile %~dp0nfspaths
        printf "started\n"
    ) else (
        printf "already running\n"
    )
    
    exit /b 0
)

if [%1]==[halt] (
    printf "[NFS] Halt: "
    if defined NFSDISABLED (
        printf "not running\n"
    ) else (
        taskkill /f /im "winnfsd.exe" >nul
        printf "halt\n"
    )
    
    exit /b 0
)

exit 1

Feel free to edit the path file in the start block.

Edit
Alternatively, you could use a cli util like rbtray to right-click the minimize button to send any window to your system tray. Or you can use hidecon to hide the console window after it’s launched or hideexec to start the service as a hidden process (the latter of which can also be done in Ruby or VBS; both languages are already used in vagrant-winnfsd).

1 Like