gui.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #
  2. # The Qubes OS Project, https://www.qubes-os.org/
  3. #
  4. # Copyright (C) 2010-2016 Joanna Rutkowska <joanna@invisiblethingslab.com>
  5. # Copyright (C) 2013-2016 Marek Marczykowski-Górecki
  6. # <marmarek@invisiblethingslab.com>
  7. # Copyright (C) 2014-2018 Wojtek Porczyk <woju@invisiblethingslab.com>
  8. #
  9. # This library is free software; you can redistribute it and/or
  10. # modify it under the terms of the GNU Lesser General Public
  11. # License as published by the Free Software Foundation; either
  12. # version 2.1 of the License, or (at your option) any later version.
  13. #
  14. # This library is distributed in the hope that it will be useful,
  15. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. # Lesser General Public License for more details.
  18. #
  19. # You should have received a copy of the GNU Lesser General Public
  20. # License along with this library; if not, see <https://www.gnu.org/licenses/>.
  21. #
  22. import qubes.config
  23. import qubes.ext
  24. class GUI(qubes.ext.Extension):
  25. # pylint: disable=too-few-public-methods
  26. # TODO put this somewhere...
  27. @staticmethod
  28. def send_gui_mode(vm):
  29. vm.run_service('qubes.SetGuiMode',
  30. input=('SEAMLESS'
  31. if vm.features.get('gui-seamless', False)
  32. else 'FULLSCREEN'))
  33. @qubes.ext.handler('domain-qdb-create')
  34. def on_domain_qdb_create(self, vm, event):
  35. # pylint: disable=unused-argument,no-self-use
  36. for feature in ('gui-videoram-overhead', 'gui-videoram-min'):
  37. try:
  38. vm.untrusted_qdb.write('/qubes-{}'.format(feature),
  39. vm.features.check_with_template_and_adminvm(feature))
  40. except KeyError:
  41. pass