mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-01-11 14:40:25 +01:00
Manipulate windows by hwnd #58
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @oHaiyang on GitHub (Nov 19, 2021).
First of all, I have to say surely komorebi is the best implementation of Windows tilling window manager so far (I have tried another two before ).
I use i3 on Linux a lot, sometimes I switch to windows 11. I strongly rely on the Scratchpad feature of i3(to call out or hide my terminal), and I am trying to implement an AHK script to mimic Scratchpad on komorebi. Then I found a window managed by komorebi can only be manipulated if it is focused. In my case, it should be wonderful if I can use komorebi commands to manipulate a specific window identified by hwnd.
I am not an experienced rust developer and haven't learned the source code yet, but I still want to ask If that is possible for komorebi, is it very hard or relatively easy, should I as a newbie 😅 rust developer to diving into the problem?
Thanks!
@LGUG2Z commented on GitHub (Nov 19, 2021):
I'm not very familiar with i3 or scratchpads but after Googling a little I found this video which gave me a pretty good idea of how this works.
I think it should be possible to expose commands to Show, Hide (and probably Minimize) windows based on either their HWND or their titles.
Given that the main use of the scratchpad seems to revolve around terminal windows, and that Windows Terminal has the possibility to explicitly name terminal instances and prevent processes from overriding the window title, it would probably be more ergonomic to focus on doing this using titles than requiring the user to use the title to look up the HWND themselves.
I'm not sure how to go about storing references to these scratchpad windows in the window manager state; given that they are never part of the tiling layout hierarchy, they could possibly be stored as floating windows, though there is currently an assumption that floating windows are by default always visible on the workspace they are associated with.
I will spend some time thinking about how to approach this under the hood a little bit more. Any suggestions on how to integrate something like this cleanly are welcome!
@oHaiyang commented on GitHub (Nov 22, 2021):
Hi LGUG2Z, I am glad to share that I found a way to roughly mimic ScratchPad behavior 😄 .
I checked the link you posted which set the Windows Terminal title suppressed. however, that does not work, the command line arguments only set Tab Title, not Windows Title which can be used to set komorebic rules.
But I got the idea that to set Window Title using AHK WinSetTitle API, here is what I did:
Run, komorebic.exe float-rule title "Windows Terminal ScratchPad", , HidequakeModeaction1to update the window2to summon/hide the terminalI'm not sure step 0 is required or not. Because, in my test, the rule has no effect when the title is updated on the fly, I have to manually toggle float in step 1 shortcuts.
@oHaiyang commented on GitHub (Nov 23, 2021):
Okay, there is a problem with the steps above. Whenever switching back to the workspace Quake Window is initially created, the Quake Window is always active, even I have made it hidden in the previous workspace.
Update:
Found the solution for the problem above: make the Quake Window be created in a workspace that is barely used(eg. the 10th workspace).
@neondeex commented on GitHub (Nov 21, 2023):
@oHaiyang Do you think i will be able to do this with the file explorer?
@ECon65 commented on GitHub (Sep 5, 2024):
would be nice to see a komorebi native scratchpad implementation. scratchpads are not just about terminals. you can place any window which you want to access quickly into scratchpad. That way you don't need to switch workspaces if you just want to make small adjustment in that window.