input.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // SPDX-FileCopyrightText: GSConnect Developers https://github.com/GSConnect
  2. //
  3. // SPDX-License-Identifier: GPL-2.0-or-later
  4. import Gio from 'gi://Gio';
  5. import Config from '../config.mjs';
  6. export class LockscreenRemoteAccess {
  7. constructor() {
  8. this._inhibitor = null;
  9. this._settings = new Gio.Settings({
  10. settings_schema: Config.GSCHEMA.lookup(
  11. 'org.gnome.Shell.Extensions.GSConnect',
  12. null
  13. ),
  14. path: '/org/gnome/shell/extensions/gsconnect/',
  15. });
  16. }
  17. patchInhibitor() {
  18. if (this._inhibitor)
  19. return;
  20. if (this._settings.get_boolean('keep-alive-when-locked')) {
  21. this._inhibitor = global.backend.get_remote_access_controller().inhibit_remote_access;
  22. global.backend.get_remote_access_controller().inhibit_remote_access = () => {};
  23. }
  24. }
  25. unpatchInhibitor() {
  26. if (!this._inhibitor)
  27. return;
  28. global.backend.get_remote_access_controller().inhibit_remote_access = this._inhibitor;
  29. this._inhibitor = null;
  30. }
  31. }