It appears that QT.Alt no longer works in QGIS 2.12. The correct reference is QT.Key_Alt. Enlightened by the link to the QT Key reference in this [answer][1]. The code below works with QGIS 2.12.1 from functools import partial from qgis.utils import iface from PyQt4.QtCore import * from PyQt4.QtGui import * mappings = {"Layers": Qt.Key_Alt + Qt.Key_1, "Browser": Qt.Key_Alt + Qt.Key_2} shortcuts = [] def activated(dock): dock = iface.mainWindow().findChild(QDockWidget, dock) visible = dock.isVisible() dock.setVisible(not visible) def bind(): for dock, keys in mappings.iteritems(): short = QShortcut(QKeySequence(keys), iface.mainWindow()) short.setContext(Qt.ApplicationShortcut) short.activated.connect(partial(activated, dock)) shortcuts.append(short) bind() [1]: http://gis.stackexchange.com/a/168739/62159