extension.js 974 B

12345678910111213141516171819202122232425262728
  1. import * as KeyboardUI from 'resource:///org/gnome/shell/ui/keyboard.js';
  2. function _modifiedLastDeviceIsTouchscreen() {
  3. return false;
  4. }
  5. export default class BlockCaribou {
  6. constructor() {
  7. this._originalLastDeviceIsTouchscreen = null;
  8. }
  9. enable() {
  10. this._originalLastDeviceIsTouchscreen = KeyboardUI.KeyboardManager.prototype._lastDeviceIsTouchscreen;
  11. KeyboardUI.KeyboardManager.prototype._lastDeviceIsTouchscreen = _modifiedLastDeviceIsTouchscreen;
  12. }
  13. /*
  14. * In the lock screen, the on-screen keyboard (Caribou) also pops up by
  15. * default. So this extension requires the "unlock-dialog" session mode to
  16. * block Caribou in lock screen.
  17. */
  18. disable() {
  19. if (this._originalLastDeviceIsTouchscreen !== null) {
  20. KeyboardUI.KeyboardManager.prototype._lastDeviceIsTouchscreen = this._originalLastDeviceIsTouchscreen;
  21. this._originalLastDeviceIsTouchscreen = null;
  22. }
  23. }
  24. }