Skip to content

Conversation

@3v1n0
Copy link
Collaborator

@3v1n0 3v1n0 commented Sep 9, 2025

Backport fixes for 49 from ubuntu-dock branch and handle the dock app icons clicks issues.

Note that this may not yet work properly in not-fully updated GNOME setups.

Close: #2434

It works properly for now, not changing it upstream yet though, as it
may still be a temporary case
Otherwise we could still type on the search entry and focus it
These have been removed as part of clutter refactor
@3v1n0 3v1n0 changed the title GNOME 49 support GNOME 49 support and misc fixes Sep 9, 2025
@3v1n0
Copy link
Collaborator Author

3v1n0 commented Sep 9, 2025

/cc @aleasto

@aleasto
Copy link
Contributor

aleasto commented Sep 9, 2025

vfunc_touch_event needs the same treatment as vfunc_button_press_event

We need to re-implement this as it does not seem possible to re-use
upstream code here
We can avoid having this delta downstream, so let's just use the same
code upstream as this would work in both cases
@3v1n0
Copy link
Collaborator Author

3v1n0 commented Sep 9, 2025

vfunc_touch_event needs the same treatment as vfunc_button_press_event

Yeah, right... Done.

Copy link
Contributor

@aleasto aleasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch on the appSpread focus thing.
LGTM

@3v1n0 3v1n0 merged commit 3f4fa4d into micheleg:master Sep 9, 2025
1 check passed
@fulalas
Copy link

fulalas commented Sep 9, 2025

Note that this may not yet work properly in #2434 (comment) setups

Tested from official link on GNOME 49 rc (most recent from their Git):

Screenshot From 2025-09-09 19-38-10

@3v1n0
Copy link
Collaborator Author

3v1n0 commented Sep 9, 2025

Note that this may not yet work properly in #2434 (comment) setups

Tested from official link on GNOME 49 rc (most recent from their Git):
Screenshot From 2025-09-09 19-38-10

Sure, that's normal as said you need all the GNOME stack being updated, see #2434 (comment)

@fulalas
Copy link

fulalas commented Sep 9, 2025

Hmmm... I have glib 2.86.0, but gjs is still 1.84.2. Is there any workaround?

@3v1n0
Copy link
Collaborator Author

3v1n0 commented Sep 9, 2025

Hmmm... I have glib 2.86.0, but gjs is still 1.84.2. Is there any workaround?

You can add this to the extension.js file:

import Gio from 'gi://Gio';
import GioUnix from 'gi://GioUnix';

// [ ... ]


if (!GioUnix.DesktopAppInfo.prototype.has_key) {
    const reservedNames = ['$gtype', 'prototype', 'length', 'name']
    Object.getOwnPropertyNames(GioUnix.DesktopAppInfo).forEach(prop => {
        if (reservedNames.includes(prop))
            return;

        if (prop.startsWith('new'))
            return;

        if (GioUnix.DesktopAppInfo.prototype[prop] !== undefined)
            return;

        GioUnix.DesktopAppInfo.prototype[prop] = function (...args) {
            return GioUnix.DesktopAppInfo[prop](this, ...args);
        };
    });
}

Object.entries(Object.getOwnPropertyDescriptors(GioUnix)).forEach(([prop, desc]) => {
    if (Object.hasOwn(Gio, prop)) {
        console.debug(`Gio already contains property ${prop}`);
        return;
    }

    const newDesc = {
        enumerable: true,
        configurable: false,
        get() {
            if (!newDesc._deprecationWarningDone) {
                console.warn(`Gio.${prop} is deprecated, please use ` +
                    `${GioUnix.__name__}.${prop} instead`);
                newDesc._deprecationWarningDone = true;
            }
            return desc.get?.() ?? desc.value;
        },
    };
    Object.defineProperty(Gio, prop, newDesc);
});

@fulalas
Copy link

fulalas commented Sep 9, 2025

So the whole file would be like this?

import { DockManager } from './docking.js';
import { Extension } from './dependencies/shell/extensions/extension.js';
import Gio from 'gi://Gio';
import GioUnix from 'gi://GioUnix';

// We export this so it can be accessed by other extensions
export let dockManager;

export default class DashToDockExtension extends Extension.Extension {
    enable() {
        dockManager = new DockManager(this);
    }

    disable() {
        dockManager?.destroy();
        dockManager = null;
    }
}

if (!GioUnix.DesktopAppInfo.prototype.has_key) {
    const reservedNames = ['$gtype', 'prototype', 'length', 'name']
    Object.getOwnPropertyNames(GioUnix.DesktopAppInfo).forEach(prop => {
        if (reservedNames.includes(prop))
            return;

        if (prop.startsWith('new'))
            return;

        if (GioUnix.DesktopAppInfo.prototype[prop] !== undefined)
            return;

        GioUnix.DesktopAppInfo.prototype[prop] = function (...args) {
            return GioUnix.DesktopAppInfo[prop](this, ...args);
        };
    });
}

Object.entries(Object.getOwnPropertyDescriptors(GioUnix)).forEach(([prop, desc]) => {
    if (Object.hasOwn(Gio, prop)) {
        console.debug(`Gio already contains property ${prop}`);
        return;
    }

    const newDesc = {
        enumerable: true,
        configurable: false,
        get() {
            if (!newDesc._deprecationWarningDone) {
                console.warn(`Gio.${prop} is deprecated, please use ` +
                    `${GioUnix.__name__}.${prop} instead`);
                newDesc._deprecationWarningDone = true;
            }
            return desc.get?.() ?? desc.value;
        },
    };
    Object.defineProperty(Gio, prop, newDesc);
});

@3v1n0
Copy link
Collaborator Author

3v1n0 commented Sep 9, 2025

Oh, one line was left there, I've edited your comment so that the whole file is fine.

@fulalas
Copy link

fulalas commented Sep 9, 2025

Thanks a lot, but I'm still having the same error as I showed in the screenshot here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Context Menu 49.rc

3 participants