flyingpie / windows-terminal-quake

Turn any app into a Quake-style toggleable app.
https://wtq.flyingpie.nl
MIT License
576 stars 38 forks source link

Doesnt play well with Tiling Windows Manager #144

Open Glutenberg opened 2 days ago

Glutenberg commented 2 days ago

Trying to use this with GlazeWM. The 2 Programs are fighting for control of the windows terminal instance. Ive tried ignoring windows terminal from GlazeWM but this means any secondary instances of windows terminal are not managed by GlazeWM and are therefor floating.

Is there a way to fix this. Or let me know what process/class I need to ignore to have this work with GlazeWM.

flyingpie commented 2 days ago

@Glutenberg Hey Josh, thank you for reaching out!

So if I'm understanding correctly, you may have more than 1 instance of WT open, and want 1 to be managed by WTQ, and the others by GlazeVM, correct?

If that's the case, I think that you'd need to get GlazeVM to ignore 1 of n instances. It seems that they have a process name, a class name and a window title to work with.

I'll test WT specifically when I get home, since it has some specific quirks going on with the process name. But some things that come to mind:

Here's some information on how WT handles window titles, which includes a config setting that allows you to override it (haven't tested this myself yet): https://learn.microsoft.com/en-us/windows/terminal/tutorials/tab-title

Let me know if either of these directions sound usable to you, I'd be happy to help out.

Glutenberg commented 1 day ago

@flyingpie Marco,

If the window title can be made constant (or have a prefix or suffix), maybe you could use that to ignore a single window in GlazeVM.

I've been experimenting with AHK to do this. Its not perfect since applications sometimes change their title. I also have to create and manage a script for each program. Can this maybe be a feature added to WTQuake. Since it launches the program/process it should be able to grab the hnwd or process id and monitor it to ensure its title is always prefixed with "wtq" or "WTQuake" or whatever someone defines in the config.

GlazeWM allows you to set "window rules" but it looks like you can only match to process name, window class or window title. I think controlling the title is probably the easiest approach.

I'm not a programmer. There's probably a better way. But just some ideas. Might also want to take a quick look at komorebi to see if theres a solution that would work for both.

flyingpie commented 1 day ago

@Glutenberg What shells do you use within WT? Just PowerShell?

Glutenberg commented 1 day ago

Windows Terminal. But would like use other apps like file explorer etc. Ideally id like to be able to launch secondary instances of these apps and they still tile.

flyingpie commented 1 day ago

Sorry, I meant the shell that runs inside of Windows Terminal, it usually shows by the icon: image

Can be a couple things:

Glutenberg commented 1 day ago

Powershell 5.1

image

flyingpie commented 1 day ago

What apps would you want to tile? I can take a look at if it's possible to control their window titles, but it seems that the ability to do that depends on the app.

flyingpie commented 23 hours ago

Any reason you're not on PowerShell 7?

I'll see if there's ways of controlling the window title, though it seems to be dependent on the app somewhat.

Glutenberg commented 21 hours ago

Honestly, I didn't realize the version that ships with Windows 10 was so outdated. I swapped to 7.

I'll see if there's ways of controlling the window title, though it seems to be dependent on the app somewhat.

That's kind of why it would be nice if wtq could handle it. Since it makes the call to launch the instance of the program its controlling. it could grab the window handle and watch it to ensure it always has a prefix or some kind of identifier that these Window Managers can search for.

This identifier could be defined by the user in the config file, that way users who don't want it can leave it blank.

flyingpie commented 11 hours ago

There's some old crusty stuff that's not supported in the newer Powershell versions, which is why they don't default to it yet. Just keep that in mind if you run into any issues.

Anyway, I've made a draft release: https://github.com/flyingpie/windows-terminal-quake/releases/tag/v2.0.12-pre1

This release adds a new setting to the "App" objects:

{
  "Apps": [
    {
      "Name": "Terminal",
      "HotKeys": [{ "Modifiers": "Control", "Key": "D1" }],
      "FileName": "wt",
      "ProcessName": "WindowsTerminal",

      // The new setting, attempts to set the window's title.
      // Note that this doesn't seem to work on all app
      "WindowTitleOverride": "WinTerm1"
    }
  ]
}

Then I've added this to the GlazeWM config:

window_rules:
  - command: "ignore"
    match_title: "WinTerm1.*"

So that any window having a title starting with "WinTerm1" is ignored.

That seems to work here, do you want to give it a spin?