Gnome extension development, how to draw a border like when pressing Alt+esc

So I have decided to make a gnome extension that draws a border around all open windows as if border-width: 0px 1px 1px 1px; was set in gtk.css. While that sounds quite boring the plan is to evolve it into a plugin that would allow Qubes os to render colored VM borders.

After going though a bunch of extensions and gnome code I got to the point where I got something working but running get_allocation_box() on the window actors returns a box inconsistently larger then the window so that probably not what I want I’m wondering wheres the code for alt+esc in gnome or what should I be calling to get the height/width of window as you see it on the screen and not the actor object.

Code is here. it’s pretty hacked together, just a experiment at this point.

what it looks like

1 Like

I think I see my issue. I’m looking at the clutter api and not mutter. I’m going to use actor.get_meta_window() to get the window and play around with the stuff in there to get the coordinates I need.

In case you haven’t found it yet, this is the code of the AltEsc outline.

What you want is MetaWindow’s get_frame_rect() method, which gives you the extents of the visible window (without shadows or invisible borders).

3 Likes

Thanks, That was what I ended up using. I have since decided to evolve it to try and add a GTK css provider to the windows so I can take advantage of GTK’s css classes much like how the GTK inspector works. https://gitlab.gnome.org/GNOME/gtk/-/blob/master/gtk/inspector/css-editor.c#L267

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.