From 583546f067deac4e07a67c43557ab2a28b2f3c57 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 10 Jun 2014 23:11:17 +0200 Subject: [PATCH] Print nicer message when Qt xkb plugin is missing --- TODO | 2 -- qutebrowser/utils/log.py | 12 ++++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/TODO b/TODO index 42d0bf94d..ff5683d34 100644 --- a/TODO +++ b/TODO @@ -39,8 +39,6 @@ New big features Improvements / minor features ============================= -- Print some meaningful message (via qInstallMsgHandler) when platform plugins - are missing, especially with xcb (on Arch: libxkbcommon-x11) - Reimplement tabbar to paint it by ourselves to look like dwb - Save cookies in Netscape format so it can be used by wget. (see notes) - Zoom with ctrl + mousewheel diff --git a/qutebrowser/utils/log.py b/qutebrowser/utils/log.py index 2466be5ca..4c97206ba 100644 --- a/qutebrowser/utils/log.py +++ b/qutebrowser/utils/log.py @@ -192,6 +192,18 @@ def qt_message_handler(msg_type, context, msg): else: func = context.function name = 'qt' if context.category == 'default' else 'qt-' + context.category + if msg.splitlines()[0] == ('This application failed to start because it ' + 'could not find or load the Qt platform plugin ' + '"xcb".'): + # Handle this message specially. + msg += ("\n\nOn Archlinux, this should fix the problem:\n" + " pacman -S libxkbcommon-x11") + try: + import faulthandler + except ImportError: + pass + else: + faulthandler.disable() record = qt.makeRecord(name, level, context.file, context.line, msg, None, None, func) qt.handle(record)