LittleVaaty / VDesk

Launch programs on new virtual desktops.
GNU General Public License v3.0
31 stars 0 forks source link

Launching Windows Apps #16

Open jonmchan opened 2 months ago

jonmchan commented 2 months ago

Windows 11 has some apps that aren't standard .exe anymore. Had to do some googling, but to launch something like the LinkedIn app, you have to do something like:

start shell:appsFolder\7EE7776C.LinkedInforWindows_w1wdnht996qgy!App

When trying this in vdesk, it fails.

C:\Users\jonathan>vdesk run -o 4 shell:appsFolder\7EE7776C.LinkedInforWindows_w1wdnht996qgy!App
<3>VDesk.Commands.RunCommand[0] An error occurred trying to start process 'shell:appsFolder\7EE7776C.LinkedInforWindows_w1wdnht996qgy!App' with working directory 'C:\Users\jonathan'. The system cannot find the file specified.
        Windows version: 10.0.22631.3810

I have no idea what kind of reference this is, but can it be supported in vdesk?

jonmchan commented 2 months ago

Windows 10/11 is really missing a simple way to launch Windows Apps from command line... it should be something like windows-app-launcher (maybe i'll write one?)...

Anyways, to do this - you follow this methodology to figure out what the app exe is called:

https://answers.microsoft.com/en-us/windows/forum/windows_10-windows_store/starting-windows-10-store-app-from-the-command/836354c5-b5af-4d6c-b414-80e40ed14675

Then you can use explorer to launch it.

vdesk run -o 4 -a "shell:appsFolder\7EE7776C.LinkedInforWindows_w1wdnht996qgy!App" explorer.exe
jonmchan commented 2 months ago

Launching script successfully written. It is available at https://github.com/jonmchan/windows-app-cmdline-launcher.

Now you can simply launch Microsoft Store apps with the following:

.\launch.bat Slack

Vdesk command would be something like:

vdesk run -o 2 -a Slack launch.bat

This causes vdesk to unfortunately hang. My guess would be that the launch batch script doesn't have a window, but launches a subprocess. vdesk is monitoring for the launched process to spawn a window and move it to the right virtual desktop. Since no window is directly spawned, it hangs indefinitely. Any ideas how to workaround?

LittleVaaty commented 2 months ago

Hi, i will investigate but my guest is windows app don't work like regular exe and the process is managed differently. I will see what can i do about it.