feat(oniri): Implement opt-in tiling layout mode #33
Conversation
|
need to update docs... can you take care of that? |
Yeah I will, no worries :) Thanks! |
|
Hmmm, not sure why opening nautilus for the first time doesn't trigger any actions. It works for subsequent opens, and also works with the python script. Let me check why this is the case. |
|
so its because of fefb66c, although I'm not too sure why. It could be a Nautilus quirk. |
Yeah I think it is, I guess the first event's maximize seems to be deferred until it finished loading so it ends up being negated. |
diff --git a/src/main.rs b/src/main.rs
index fe8c74f95a08..ae693fecffb4 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -86,6 +86,10 @@ fn main() -> anyhow::Result<()> {
continue;
}
+ if window.app_id.unwrap_or_default() == "org.gnome.Nautilus" && window.title.unwrap_or_default() == "Loading…" {
+ continue;
+ }
+
debug!("Trigger Event: Window Opened Or Changed");
let id = window.id;This works, but its more of a hack than anything. Any ideas on how to solve it? edit: Okay, one idea is to move all the logic outside of the match arm and handle it separately like in the python script. Not sure how elegant this is though |
No, not at the moment... I'm not using Nautilus myself but given what you describe, it indeed seems like a race condition with Nautilus first loading. Maybe adding a slight delay to the maximize action to hopefully cover it? Although might probably be even more of a hack?
Hum, yeah. Although probably more elegant then a hack specific to Nautilus? I don't know... |
|
I don't necessarily mind one hack for a specific application if this is a somewhat isolated case for what it's worth. But I'd ideally like to avoid applying too much downstream hacks to workaround such upstream quirks (assuming it's indeed an upstream thing). |
I decided to go with this for now, since the suggestion I made above would require rewriting quite a bit and potentially make things uglier. |
Alright, fine by me. |
Yeah. If maximizing noops when the window is already maximized, then this shouldn't be an issue. |
Alright, so the race condition is obviously an unfortunate issue but it only actually hits us because of a limitation from the niri IPC then. Hopefully this will be addressed at some point (the related PR are already opened on the niri upstream side, I'll send a friendly ping there). |
|
May I ask if we can ship 9ff707c in a separate PR? 👼 It's not actually linked to this the new tiling mode feature, I'd rather have it being shipped as a separate "fix:" commit if you don't mind 🙏 |
e538162 to
948f10c
Compare
948f10c to
8826093
Compare
Checking if there is only one window in a workspace is the whole point of the program. Therefore, bring that logic to the front and not abstract it away. As a consequence of this, we now truly have a function that does only one thing: maximize a window. Signed-off-by: Eric Naim <dnaim@cachyos.org>
Introduce commandline arguments {-T, --tiling-layout} for a tiling mode,
where opening a second window in the workspace will collapse the first
one if maximized.
This brings more familiarity to users coming from a traditional tiling
environment, but still leveraging the infinite horizontal workspace.
Signed-off-by: Eric Naim <dnaim@cachyos.org>
Currently we are doing two iterations: 1. Get the workspace id by iterating through workspace_windows 2. Getting the workspace vec from the workspace_id After d89abbf, we don't need workspace_id anymore, so we can save some iterations by directly getting the workspace vec. Signed-off-by: Eric Naim <dnaim@cachyos.org> Signed-off-by: Eric Naim <dnaim@cachyos.org>
Signed-off-by: Eric Naim <dnaim@cachyos.org>
|
Another thing I noticed is that this won't work well for workspaces with tabbed columns. I'm not sure how to go about doing that. I guess its low priority because this is opt-in and tabbed columns don't necessarily have to be used anyway. |
Ah right good catch, thanks for the heads up. I don't think it's worth blocking this new (optional) feature for this indeed. If we ever find an elegant fix for that later, that's great. But let's ship this anyway :) |
Description
Introduce commandline arguments {-T, --tiling-layout} for a tiling mode,
where opening a second window in the workspace will collapse the first
one if maximized.
This brings more familiarity to users coming from a traditional tiling
environment, but still leveraging the infinite horizontal workspace.
Screenshots / Logs
recording_20260420_211817.mp4
Fixed bug
Fixes "issue_URL" (if any)
Addressed feature request
Closes "issue_URL" (if any)