diff --git a/src/plugins/stickykeys/stickykeys.cpp b/src/plugins/stickykeys/stickykeys.cpp index c9d1bdf056..887fb0ff45 100644 --- a/src/plugins/stickykeys/stickykeys.cpp +++ b/src/plugins/stickykeys/stickykeys.cpp @@ -5,6 +5,7 @@ */ #include "stickykeys.h" +#include "effect/effecthandler.h" #include "keyboard_input.h" #include "xkb.h" @@ -67,6 +68,7 @@ void StickyKeysFilter::loadConfig(const KConfigGroup &group) m_lockKeys = group.readEntry("StickyKeysLatch", true); m_showNotificationForLockedKeys = group.readEntry("kNotifyModifiers", false); m_disableOnTwoKeys = group.readEntry("StickyKeysAutoOff", false); + m_ringBell = group.readEntry("StickyKeysBeep", false); if (!m_lockKeys) { // locking keys is deactivated, unlock all locked keys @@ -105,6 +107,12 @@ bool StickyKeysFilter::keyEvent(KWin::KeyEvent *event) auto keyState = m_keyStates.find(event->key()); + if (m_ringBell && event->type() == QEvent::KeyRelease) { + if (auto effect = KWin::effects->provides(KWin::Effect::SystemBell)) { + effect->perform(KWin::Effect::SystemBell, {}); + } + } + if (keyState != m_keyStates.end()) { if (event->type() == QKeyEvent::KeyPress) { // An unlatched modifier was pressed, latch it diff --git a/src/plugins/stickykeys/stickykeys.h b/src/plugins/stickykeys/stickykeys.h index db1b1fb807..cb737baad2 100644 --- a/src/plugins/stickykeys/stickykeys.h +++ b/src/plugins/stickykeys/stickykeys.h @@ -36,4 +36,5 @@ private: bool m_showNotificationForLockedKeys = false; bool m_disableOnTwoKeys = false; QSet m_pressedModifiers; + bool m_ringBell = false; };