HUD freezes the system when used with Chromium based apps

Hello!
I've been having this issue for quite a while on my Debian stable, with mate-hud version 22.10.3-2. Furthermore, downgrading the mate-hud didn't solve the issue.

To have the problem, open Chromium web browser (including Chrome, Brave, Edge, Chromium web apps, and their Flatpak/Snap/AppImage variations), and press the HUD activation button. Then, the keyboard completely freezes and the mouse cursor moves but doesn't click. The only solution is to switch to another TTY and restart the system.

Other apps work perfect with the HUD. It only happens on Chromium web browsers.

After looking for an error in the dmesg, journalctl, and x logs, I found the error.

Here what mate-hud python script gives when you try to activate [or accidentally press :(( ] the HUD:

Traceback (most recent call last):
  File "/usr/lib/mate-hud/mate-hud, line 870, in hud
    appmenu_success = try_appmenu_interface(int(window_id, 16))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/mate-hud/mate-hud", line 616, in try_appmenu_interface
    expanse_all_menu_with_dbus(dbusmenu_root_item[1], True, "")
  File "/usr/lib/mate-hud/mate-hud", line 592, in expanse_all_menu_with_dbus
    dbusmenu_object_iface.AboutToShow(item_id)
  File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 141, in __call__ 
    return self._connection.call_blocking(self._named_service,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 634, in call_blocking 
    reply_message = self.send_message_with_reply_and_block(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.Failed: error occurred in AboutToShow

*edit: corrected typos

1 Like

Let's hope this provides the info the developers need to fix it. I've been having this issue for a long time with no solution, very annoying. Is this a result of Microsoft "embracing" Linux?

1 Like

As a workaround, you can make the hud key the menu key (but not all keyboards have this) until the issue is solved.

I think this issue solved on latest Ubuntu MATE release. But we still have it on Debian stable and even on unstable. I just found a basic fix for this issue.

Open /usr/lib/mate-hud/mate-hud with the admin privilege, and find expanse_all_menu_with_dbus(item, root, path). Then change the whole function with:

def expanse_all_menu_with_dbus(item, root, path):
    item_id = item[0]
    item_props = item[1]
    blacklist = []

    try:
        if 'children-display' in item_props:
            try:
                # Attempt menu expansion with timeout
                dbusmenu_object_iface.AboutToShow(item_id, timeout=1)
            except dbus.exceptions.DBusException as e:
                if "org.freedesktop.DBus.Error.NoReply" in e.get_dbus_message():
                    logging.error("Menu expansion timed out for item %s", item_id)
                    return
                logging.error("DBus error in AboutToShow: %s", str(e))
                return

        # Safely get layout with error handling
        try:
            item = dbusmenu_object_iface.GetLayout(item_id, 1, ["label", "children-display"], timeout=2)[1]
        except dbus.exceptions.DBusException as e:
            logging.error("Failed to get menu layout: %s", str(e))
            return

        item_children = item[2]

        # Rest of the function remains the same but wrapped in try-except
        try:
            if 'label' in item_props:
                new_path = path + " > " + item_props['label']
            else:
                new_path = path

            if len(item_children) == 0:
                if new_path not in blacklist:
                    menu_item = format_path(new_path)
                    dbusmenu_item_dict[menu_item] = item_id
                    write_menuitem(menu_item)
            else:
                blacklist.append(new_path)
                for child in item_children:
                    expanse_all_menu_with_dbus(child, False, new_path)
                    
        except Exception as e:
            logging.error("Error processing menu items: %s", str(e))

    except Exception as fatal_error:
        logging.critical("Critical failure in menu processing: %s", str(fatal_error))
        # Emergency exit to prevent freeze
        if STORE.rofi_process:
            STORE.rofi_process.terminate()
        raise SystemExit(1)

This will show a blank HUD if it couldn't get the values instead of freezing the whole system.

1 Like