I am getting Clutter.Actor using:
let [x, y] = global.get_pointer();
let actor = global.get_stage().get_actor_at_pos(2, x, y);
How to get Meta.Window from this.
I am getting Clutter.Actor using:
let [x, y] = global.get_pointer();
let actor = global.get_stage().get_actor_at_pos(2, x, y);
How to get Meta.Window from this.
Not all ClutterActors have a corresponding window, only MetaWindowActor derived ones do. And for those you can get the window using the metaWindow property or get_meta_window() function.
I have a solution at this point
let window_actor = global.get_stage().get_actor_at_pos(Clutter.PickMode.NONE, x, y).get_parent();
let window = window_actor.get_meta_window();
However, I am having another problem as mentioned in https://stackoverflow.com/questions/79816476/how-to-programmatically-focus-a-window-under-the-pointer-on-workspace-change-in
If i call
window.activate(global.get_current_time());
Main.activateWindow(window);
let win_workspace = window.get_workspace();
win_workspace.activate_with_focus(window, 0);
within
GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
It is not working.
The whole code of the extension can be found in GitHub - blueray453/focus-on-hover-by-blueray453: Focus window when mouse moves over it.
This is a simple extension. The relevant code is around 40 lines (at the end).