Adding color to borders gnome windows

Nevermind, your comment was more than enough to solve the problem thank you!

The new code

extension.js

const { GObject, St, Meta, GLib } = imports.gi;

const Main = imports.ui.main;

const Me = imports.misc.extensionUtils.getCurrentExtension();
const Window = Me.imports.window;

class Extension {
    constructor(uuid) {
        this._uuid = uuid;
        this.winCreatedHandlerID = null
        this.restackHandlerID = null
        this.windows = {}
    }

    windowCreated(display, metaWindow) {
        log("Window Created")

        this.windows[metaWindow.get_description()] = new Window.Window(metaWindow)
    }

    restack(display){
        global.window_group.get_children().forEach(
            (child) => {
                let metaWindow = this.checkMetaWindow(child)

                if (!metaWindow) return;
                
                let window = this.windows[metaWindow.get_description()]
                
                global.window_group.set_child_above_sibling(window.border, child)
            }
        )
    }

    checkMetaWindow(child){
        let metaWindow = null
        try {
            metaWindow = child.get_meta_window()
        } catch (error) {
            log(error)
        }

        if(!metaWindow) return false;

        let type = metaWindow.get_window_type()

        if (
            type != Meta.WindowType.NORMAL &&
            type != Meta.WindowType.DIALOG &&
            type != Meta.WindowType.MODAL_DIALOG
        ) return false;

        return metaWindow
    }

    enable() {
        log("Enabled")
        
        this.winCreatedHandlerID = global.display.connect('window-created', this.windowCreated.bind(this))
        this.restackHandlerID = global.display.connect('restacked', this.restack.bind(this))

        global.window_group.get_children().forEach(
            (child) => {
                let metaWindow = this.checkMetaWindow(child)

                if (!metaWindow) return;

                log(Window.Window)
                let window = new Window.Window(metaWindow)
                
                this.windows[metaWindow.get_description()] = window
                global.window_group.add_child(window.border)
                global.window_group.set_child_above_sibling(window.border, child)
            }
        )
    }

    disable() {
        log("Disabled")

        for (let windowKey in this.windows){
            this.windows[windowKey].windowClosed()
            global.window_group.remove_child(this.windows[windowKey].border)
            delete this.windows[windowKey]
        }

        global.display.disconnect(this.winCreatedHandlerID)
        global.display.disconnect(this.restackHandlerID)
    }
}

function init(meta) {
    return new Extension(meta.uuid);
}

window.js

const { GObject, St } = imports.gi;

const BORDERSIZE = 3;

class Window{
    constructor(metaWindow){
        this.metaWindow = metaWindow

        this.border = new St.Bin({style_class: 'border'});
        
        let rect = this.metaWindow.get_frame_rect()
        this.border.set_position(rect.x, rect.y)
        this.border.set_size(rect.width + BORDERSIZE, rect.height+ BORDERSIZE)

        this.sizeChangedID = this.metaWindow.connect('size-changed', this.updateBorderLayout.bind(this))
        this.positionChangedID = this.metaWindow.connect('position-changed', this.updateBorderLayout.bind(this))
    }

    updateBorderLayout(){
        log("Update Window Border")
        let rect = this.metaWindow.get_frame_rect()
        this.border.set_position(rect.x, rect.y)
        this.border.set_size(rect.width + BORDERSIZE, rect.height + BORDERSIZE)
    }

    windowClosed(){
        log("Window Closed")
        
        log("Window ID = "+this.metaWindow.get_description())
        log("workspace-changed ID = "+this.workspaceChangedID)
        log("size-changed ID = "+this.sizeChangedID)
        log("position-changed ID = "+this.positionChangedID)

        this.metaWindow.disconnect(this.workspaceChangedID)
        this.metaWindow.disconnect(this.sizeChangeID)
        this.metaWindow.disconnect(this.positionChangedID)
    }
}