1

Im working on a very simple GNOME extension with a click event that disables the keyboard (if you need to clean it or clean your desk).

Is there a way to disable all the keyboard output in JavaScript? I've tried to do

_onClicked(actor, event) {
    if ((event.type() !== Clutter.EventType.TOUCH_BEGIN && event.type() !== Clutter.EventType.BUTTON_PRESS)) {
        // Some other non-clicky event happened; bail
        return Clutter.EVENT_PROPAGATE;
    }

    if (this._icon.icon_name === TOGGLE_ON_ICON) {
        this._icon.icon_name = TOGGLE_OFF_ICON;
        Main.notify('Keyboard has been turned off!');
        Main.onkeydown = function (e) 
        {
        return false;
        }
    } else {
        this._icon.icon_name = TOGGLE_ON_ICON;
        Main.notify('Keyboard has been turned on!');
        Main.onkeydown = function (e) 
        {
        return false;
        }
        
    }

I also thought doing it through shell on JavaScript, but for that I would need the ID for xinput to work.

Any tips would be helpful.

PS: I'm a JS beginner so any tips you can give me are appreciated :D.

c.silva
  • 11
  • 2

0 Answers0