-
-
Notifications
You must be signed in to change notification settings - Fork 73
new lib: niri #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
new lib: niri #70
Conversation
happy to help test output tracking once you get there; have niri + multiple monitors. |
d450129
to
259946c
Compare
@sameoldlab Great work, thank you! Are you planning to continue working on this? I think a read-only view of windows (and maybe workspaces) would already be very useful to create some bars, even if actions and state management were still missing IMO. |
@phaer thanks, yes. I could mark what I have now as ready for review if that would be useful to people. I avoided it earlier because I wasn't sure if the variable names would change, but I think future updates should be possible now without any breaking changes |
Posting object issues here in case anyone with better Vala knowledge has an idea. This is how to track the current title currently: const Current = () => {
const niri = Niri.get_default()
const current_title: Variable<string> = Variable(niri.get_window(niri.focused_window_id)?.title ?? '')
niri.connect('window-focus-changed', (_, w_id /* number */) => current_title
.set(niri.get_window(w_id)?.title ?? ''))
return new Widget.Label({ label: current_title().as(t => t.slice(0, 150)) })
} Ideally it could be something similar to: const Current = () => {
const niri = Niri.get_default()
return new Widget.Label({ label: niri.focused_window.title() })
} While testing I still needed a variable and signal to track I don't think it'd be worth the extra code if using it still needed a variable and signal, but would like to know if there's anything that might work better. |
How do you plan on tackling multi-monitor setups in GTK3? Niri identifies monitors by connector name (eg. |
@bandithedoge need to look at this more. The The full object would make comparisons possible. For most people with just |
We really need this! @Aylur, when do you plan to merge it? |
Hi, @sameoldlab i've been testing this out and im getting a problem where if i call I dont' really know what it could be to be honest, since calling Any help is appreciated :) |
@viceav I think that's (somewhat) normal for using the libraries in javascript.
|
c2c12ed
to
3887b18
Compare
added nix for niri
@sameoldlab found this Error: Can't convert non-null pointer to JS value , await suppress(import("gi://AstalNiri"), ({ Niri }) => {
patch(Niri.prototype, "workspaces")
patch(Niri.prototype, "windows")
patch(Niri.prototype, "outputs")
}) Edit: It works :) |
Thanks! Do you want to make a PR @viceav? I'll just copy it in a few hours if not |
@sameoldlab Thanks! I'm gonna check if there's any other property that should be added and i'll make the PR |
fix(gjs): add workarounds for AstalNiri
fix(niri): notify when windows or workspaces change
…focused_window handle all window focus logic
- For the `on_windows_changed` function ensure `focused_window` gets updated - For the `update_focused_window` handle when the `new_focused` window is `null`
Adds support for niri's ipc (closes #8). I took the library started by @spazzylemons, included event values in the signals, and added active and focused window/workspace tracking as properties. This covers all current messages in the event-stream but still planning to add: