flyingpie / windows-terminal-quake

Enable Quake-style dropdown for (almost) any application.
https://wtq.flyingpie.nl
MIT License
594 stars 39 forks source link

Failed to find or start window for app 'PowerShell' #140

Closed tony1016 closed 1 week ago

tony1016 commented 3 months ago

image

flyingpie commented 3 months ago

@tony1016 Hey, thank you for reaching out!

Could you post your settings file?

tony1016 commented 3 months ago

No setting ,just start发自我的 iPhone在 2024年8月10日,下午9:08,Marco van den Oever @.***> 写道: @tony1016 Hey, thank you for reaching out! Could you post your settings file?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

flyingpie commented 3 months ago

@tony1016 Okay, what version of Windows are you using? And do you have Windows Terminal installed (which is optional)?

tony1016 commented 3 months ago

Windows 11 Professinal,And yes,wt is installed.

Marco van den Oever @.***> 于2024年8月11日周日 18:09写道:

@tony1016 https://github.com/tony1016 Okay, what version of Windows are you using? And do you have Windows Terminal installed (which is optional)?

— Reply to this email directly, view it on GitHub https://github.com/flyingpie/windows-terminal-quake/issues/140#issuecomment-2282705116, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQ5SSX7AZ3TVFROEOMJ75LZQ4Z4VAVCNFSM6AAAAABMH4QP32VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBSG4YDKMJRGY . You are receiving this because you were mentioned.Message ID: @.***>

flyingpie commented 3 months ago

@tony1016 Thank you for the additional information!

When WTQ starts for the first time, it will generate a wtq.jsonc file, based on whether you have Windows Terminal installed or not. It's a temporary solution to an annoying problem, that I want to solve with a GUI in an upcoming version.

However, you should have a wtq.jsonc file, either next to the wtq.exe file, or in your user folder, eg. "C:/users//wtq.jsonc".

Could you see if there's a jsonc file in either of those places, and post them if found?

boscodsouza82 commented 2 months ago

I too am facing this same issue, and these are the contents of the default wtq.jsonc

{
    // V2 WIP Discussion: https://github.com/flyingpie/windows-terminal-quake/discussions/119
    // Docs: https://wtq.flyingpie.nl
    "$schema": "../schema/wtq.schema.2.json",

    "Apps": [
        // Example with PowerShell
        {
            "Name": "PowerShell",
            "HotKeys": [{ "Modifiers": "Control", "Key": "D1" }],
            "FileName": "powershell"
        }

        // Added by me for quick reference: "FileName": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"

        // Example with Windows Terminal
        //{
        //  "Name": "Terminal",
        //  "HotKeys": [{ "Modifiers": "Control", "Key": "D1" }],
        //  "FileName": "wt",
        //  "ProcessName": "WindowsTerminal"
        //}
    ],

    // Hot keys that toggle the most recent app (or the first one if none has been active yet).
    "HotKeys": [ { "Modifiers": "Control", "Key": "Q" } ],

    // What monitor to preferably drop the terminal.
    // "WithCursor" (default), "Primary" or "AtIndex".
    // Can be overridden per app.
    "PreferMonitor": "WithCursor",

    // If "PreferMonitor" is set to "AtIndex", this setting determines what monitor to choose.
    // Zero based, eg. 0, 1, etc.
    // Defaults to "0".
    // Can be overridden per app.
    "MonitorIndex": 0,

    // Horizontal screen coverage, as a percentage (defaults to 95).
    "HorizontalScreenCoverage": 95,

    // Vertical screen coverage, as a percentage (defaults to 95).
    "VerticalScreenCoverage": 95
}

Please guide.

flyingpie commented 2 months ago

@boscodsouza82 Thank you for reporting the issue!

Could you post the logs, they should be in:

C:/users/username/appdata/local/temp/wtq/logs
boscodsouza82 commented 2 months ago

Hello @flyingpie,

Thank you for all your efforts in windows-terminal-quake. It's a very nice software. :)

Note, if it helps in some way to debug:

  1. Since wtq (aka 2.x) wasn't working, I installed windows-terminal-quake (aka 1.x), and 1.x works fine just like it does on my other Windows machine.
  2. As you will notice in the log below for 2.x, there are 5 attempts to open the PowerShell, which as per the log, end up failing. However, I can always see 5 terminals being opened on my screen. The rest of the 2.x functionality, however, doesn't work. for e.g. the Quake Console. Also, after I have closed these 5 terminals, the 2.x icon still remains in the task bar. It seems that the 2.x process is no longer aware of the 5 open terminals, post the exception.
  3. In contrast, 1.x uses Windows Terminal and not PowerShell. I tried 2.x with Windows Terminal instead of PowerShell, and the behaviour is much better, in that I get to use the Quake feature quite well. Also, only a single terminal opens up, and not 5 as was the case with PowerShell. The exit/shutdown however is still not clean and the 2.x icon continues to persist in the Taskbar. Later when I exit 2.x from the Taskbar, I get an exception. Is this TaskBar-Icon-Persistence the 'expected' behaviour for 2.x?
  4. Overall, 1.x is stable on both my machine(s).
  5. A separate thought/request: Might it be better to have an example config available in wtq.jsonc for 2.x, the way it is available in windows-terminal-json for 1.x? Would it make things easier for a beginner to configure?

Here's the log for wtq-lates (2.x)t:

2024-09-18 00:24:28.957 +05:30 [INF] No config file found at path 'C:\Users\Dip\scoop\apps\wtq-latest\current\wtq.json'
2024-09-18 00:24:28.997 +05:30 [INF] Found config file at path 'C:\Users\Dip\scoop\apps\wtq-latest\current\wtq.jsonc'
2024-09-18 00:24:29.073 +05:30 [DBG] Hosting starting
2024-09-18 00:24:29.123 +05:30 [INF] Updating apps
2024-09-18 00:24:29.125 +05:30 [INF] Missing app handle for PowerShell, creating one now
2024-09-18 00:24:29.128 +05:30 [INF] No process attached to app [App:PowerShell] <no process>, asking process factory for one now
2024-09-18 00:24:29.136 +05:30 [INF] Using find-or-start process attach mode for app with options PowerShell, looking for process
2024-09-18 00:24:29.142 +05:30 [INF] Looking up list of processes
2024-09-18 00:24:29.264 +05:30 [INF] Got no process for options PowerShell, attempting to create one
2024-09-18 00:24:29.266 +05:30 [INF] Creating process for app 'PowerShell'
2024-09-18 00:24:29.291 +05:30 [INF] Looking up list of processes
2024-09-18 00:24:29.434 +05:30 [WRN] [Attempt 1/5] Got exception Failed to find or start window for app 'PowerShell'.
Wtq.Exceptions.WtqException: Failed to find or start window for app 'PowerShell'.
   at Wtq.Services.WtqProcessFactory.<>c__DisplayClass5_0.<<GetProcessAsync>b__0>d.MoveNext() in D:\workspace\flyingpie\wtq\wtq\src\10-Core\Wtq\Services\WtqProcessFactory.cs:line 75
--- End of stack trace from previous location ---
   at Wtq.Utils.Retry.ExecuteAsync[TResult](Func`1 action) in D:\workspace\flyingpie\wtq\wtq\src\10-Core\Wtq\Utils\Retry.cs:line 55
2024-09-18 00:24:29.448 +05:30 [INF] Waiting '"00:00:00.5000000"' before next attempt
2024-09-18 00:24:29.958 +05:30 [INF] Using find-or-start process attach mode for app with options PowerShell, looking for process
2024-09-18 00:24:29.958 +05:30 [INF] Got no process for options PowerShell, attempting to create one
2024-09-18 00:24:29.959 +05:30 [INF] Creating process for app 'PowerShell'
2024-09-18 00:24:30.022 +05:30 [INF] Looking up list of processes
2024-09-18 00:24:30.561 +05:30 [WRN] [Attempt 2/5] Got exception Failed to find or start window for app 'PowerShell'.
Wtq.Exceptions.WtqException: Failed to find or start window for app 'PowerShell'.
   at Wtq.Services.WtqProcessFactory.<>c__DisplayClass5_0.<<GetProcessAsync>b__0>d.MoveNext() in D:\workspace\flyingpie\wtq\wtq\src\10-Core\Wtq\Services\WtqProcessFactory.cs:line 75
--- End of stack trace from previous location ---
   at Wtq.Utils.Retry.ExecuteAsync[TResult](Func`1 action) in D:\workspace\flyingpie\wtq\wtq\src\10-Core\Wtq\Utils\Retry.cs:line 55
2024-09-18 00:24:30.562 +05:30 [INF] Waiting '"00:00:00.5000000"' before next attempt
2024-09-18 00:24:31.062 +05:30 [INF] Using find-or-start process attach mode for app with options PowerShell, looking for process
2024-09-18 00:24:31.063 +05:30 [INF] Got no process for options PowerShell, attempting to create one
2024-09-18 00:24:31.063 +05:30 [INF] Creating process for app 'PowerShell'
2024-09-18 00:24:31.074 +05:30 [INF] Looking up list of processes
2024-09-18 00:24:31.228 +05:30 [WRN] [Attempt 3/5] Got exception Failed to find or start window for app 'PowerShell'.
Wtq.Exceptions.WtqException: Failed to find or start window for app 'PowerShell'.
   at Wtq.Services.WtqProcessFactory.<>c__DisplayClass5_0.<<GetProcessAsync>b__0>d.MoveNext() in D:\workspace\flyingpie\wtq\wtq\src\10-Core\Wtq\Services\WtqProcessFactory.cs:line 75
--- End of stack trace from previous location ---
   at Wtq.Utils.Retry.ExecuteAsync[TResult](Func`1 action) in D:\workspace\flyingpie\wtq\wtq\src\10-Core\Wtq\Utils\Retry.cs:line 55
2024-09-18 00:24:31.229 +05:30 [INF] Waiting '"00:00:00.5000000"' before next attempt
2024-09-18 00:24:31.741 +05:30 [INF] Using find-or-start process attach mode for app with options PowerShell, looking for process
2024-09-18 00:24:31.741 +05:30 [INF] Got no process for options PowerShell, attempting to create one
2024-09-18 00:24:31.741 +05:30 [INF] Creating process for app 'PowerShell'
2024-09-18 00:24:31.750 +05:30 [INF] Looking up list of processes
2024-09-18 00:24:32.063 +05:30 [WRN] [Attempt 4/5] Got exception Failed to find or start window for app 'PowerShell'.
Wtq.Exceptions.WtqException: Failed to find or start window for app 'PowerShell'.
   at Wtq.Services.WtqProcessFactory.<>c__DisplayClass5_0.<<GetProcessAsync>b__0>d.MoveNext() in D:\workspace\flyingpie\wtq\wtq\src\10-Core\Wtq\Services\WtqProcessFactory.cs:line 75
--- End of stack trace from previous location ---
   at Wtq.Utils.Retry.ExecuteAsync[TResult](Func`1 action) in D:\workspace\flyingpie\wtq\wtq\src\10-Core\Wtq\Utils\Retry.cs:line 55
2024-09-18 00:24:32.064 +05:30 [INF] Waiting '"00:00:00.5000000"' before next attempt
2024-09-18 00:24:32.573 +05:30 [INF] Using find-or-start process attach mode for app with options PowerShell, looking for process
2024-09-18 00:24:32.573 +05:30 [INF] Got no process for options PowerShell, attempting to create one
2024-09-18 00:24:32.573 +05:30 [INF] Creating process for app 'PowerShell'
2024-09-18 00:24:32.584 +05:30 [INF] Looking up list of processes
2024-09-18 00:24:32.773 +05:30 [WRN] [Attempt 5/5] Got exception Failed to find or start window for app 'PowerShell'.
Wtq.Exceptions.WtqException: Failed to find or start window for app 'PowerShell'.
   at Wtq.Services.WtqProcessFactory.<>c__DisplayClass5_0.<<GetProcessAsync>b__0>d.MoveNext() in D:\workspace\flyingpie\wtq\wtq\src\10-Core\Wtq\Services\WtqProcessFactory.cs:line 75
--- End of stack trace from previous location ---
   at Wtq.Utils.Retry.ExecuteAsync[TResult](Func`1 action) in D:\workspace\flyingpie\wtq\wtq\src\10-Core\Wtq\Utils\Retry.cs:line 55
2024-09-18 00:24:32.775 +05:30 [ERR] Hosting failed to start
Wtq.Exceptions.WtqException: Failed to find or start window for app 'PowerShell'.
   at Wtq.Services.WtqProcessFactory.<>c__DisplayClass5_0.<<GetProcessAsync>b__0>d.MoveNext() in D:\workspace\flyingpie\wtq\wtq\src\10-Core\Wtq\Services\WtqProcessFactory.cs:line 75
--- End of stack trace from previous location ---
   at Wtq.Utils.Retry.ExecuteAsync[TResult](Func`1 action) in D:\workspace\flyingpie\wtq\wtq\src\10-Core\Wtq\Utils\Retry.cs:line 55
   at Wtq.Utils.Retry.ExecuteAsync[TResult](Func`1 action) in D:\workspace\flyingpie\wtq\wtq\src\10-Core\Wtq\Utils\Retry.cs:line 68
   at Wtq.Services.WtqProcessFactory.GetProcessAsync(WtqAppOptions opts) in D:\workspace\flyingpie\wtq\wtq\src\10-Core\Wtq\Services\WtqProcessFactory.cs:line 57
   at Wtq.WtqApp.UpdateProcessAsync() in D:\workspace\flyingpie\wtq\wtq\src\10-Core\Wtq\WtqApp.cs:line 232
   at Wtq.Services.WtqAppRepo.UpdateAppsAsync() in D:\workspace\flyingpie\wtq\wtq\src\10-Core\Wtq\Services\WtqAppRepo.cs:line 50
   at Wtq.Services.WtqAppRepo.StartAsync(CancellationToken cancellationToken) in D:\workspace\flyingpie\wtq\wtq\src\10-Core\Wtq\Services\WtqAppRepo.cs:line 108
   at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__15_1(IHostedService service, CancellationToken token)
   at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)

Thank you.

flyingpie commented 2 months ago

@boscodsouza82 Thank you for the detailed explanation and the kind words! <3

I'm having a little trouble with getting v2 into shape due to a couple reasons, but reports like yours go a long way in finding a path that works, so I really appreciate it.

When Powershell is started 5 times, does that mean individual Powershell windows, or do they manifest as tabs in Windows Terminal?

Regarding your point about example config, my intent is to do something like that, in the form of a GUI that guides the user through setting up their configuration. Do you think that would have helped in this case?

boscodsouza82 commented 2 months ago

Hi @flyingpie 🙂

...but reports like yours go a long way in finding a path that works, so I really appreciate it. It's the least I can do to help. I am not yet at a level where I can contribute by creating software. Hope to get there soon. ✌️

When Powershell is started 5 times, does that mean individual Powershell windows, or do they manifest as tabs in Windows Terminal? 5 individual PowerShell windows. 5 corresponds to the number of exceptions in the log. Sometimes it's even 2, 3 or 4, especially on subsequent attempt when the wtq(2.x) is present in the Taskbar. But on a fresh attempt, it's always 5.

...Do you think that would have helped in this case? No, I asked for it as a convenience, because as a beginner it is very helpful to have the correct syntax for Configuration, and not have to copy-paste from the Docs, and inadvertently make some mistake while doing so. I am quite capable of doing this.🤦 However in our current situation, the wtq(2.x) software needs some Debugging, and hence an extremely minimal Configuration is always better.

Let me know as and when you need any further information.

flyingpie commented 2 months ago

@boscodsouza82 Thanks so much, I appreciate the quick responses!

Could you drop a screenshot of the multiple powershell windows perhaps? I'm really confused why that's happening.

I totally agree though that the stability of v1 hasn't been reached yet, still some ways to go.

flyingpie commented 2 weeks ago

Version v2.0.11 has an updated method of starting processes, I'm pretty sure this shouldn't happen anymore.

boscodsouza82 commented 2 weeks ago

Yes @flyingpie. This mutliple-window-spawning doesn't happen anymore in wtq v2.0.11.

Also the PowerShell issue mentioned in the OP is resolved too.

Thank you.