Skip to content

Commit d440e18

Browse files
committed
Skip confusing buttons from dom0 and disp template
- Dom0: hide shutdown and pause, technically, shutdown can be used by GUIVMs in the future if the action was modified, currently, qubesd logs a failure. - There is no possibility to differentiate between "APPS" and "TEMPLATES" tabs, this means that disposable template "Start qube" is hidden from both tabs, that is not the intended behavior though but would require a redesign to fix. Current behavior though, allows searching for "default-dvm" and not have the "Start qube" button appear. Therefore, to start the disposable template from the app menu, select an application in the "TEMPLATES" tab. Fixes: QubesOS/qubes-issues#10288 For: QubesOS/qubes-issues#1512
1 parent a4c3ac3 commit d440e18

1 file changed

Lines changed: 23 additions & 3 deletions

File tree

qubes_menu/custom_widgets.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,22 @@ def update_state(self, state):
466466
Update own state (visibility/text/sensitivity) based on provided VM
467467
state.
468468
"""
469+
vm_entry: VMEntry = (
470+
self.get_toplevel().get_application().get_currently_selected_vm()
471+
)
472+
vm_name = vm_entry.vm_name
473+
is_dispvm_template = vm_entry.is_dispvm_template
469474
self.state = state
475+
476+
if vm_name == 'dom0' or (is_dispvm_template and state != "Running"):
477+
self.row_label.set_label(' ')
478+
self.set_sensitive(False)
479+
self.command = None
480+
self.icon.hide()
481+
return
482+
483+
self.set_sensitive(True)
484+
self.icon.show()
470485
if state == 'Running':
471486
self.row_label.set_label('Shutdown qube')
472487
self.command = 'qvm-shutdown'
@@ -479,12 +494,11 @@ def update_state(self, state):
479494
self.icon.set_from_pixbuf(load_icon("qappmenu-shutdown", size=None,
480495
pixel_size=15))
481496
return
482-
if state == 'Halted':
497+
if state == 'Halted' and not is_dispvm_template:
483498
self.row_label.set_label('Start qube')
484499
self.command = 'qvm-start'
485500
self.icon.set_from_pixbuf(load_icon("qappmenu-start", size=None,
486501
pixel_size=15))
487-
488502
return
489503
if state == 'Paused':
490504
self.row_label.set_label('Unpause qube')
@@ -509,8 +523,14 @@ def update_state(self, state):
509523
Update own state (visibility/text/sensitivity) based on provided VM
510524
state.
511525
"""
526+
vm_entry: VMEntry = (
527+
self.get_toplevel().get_application().get_currently_selected_vm()
528+
)
529+
vm_name = vm_entry.vm_name
530+
512531
self.state = state
513-
if state == 'Running':
532+
533+
if state == 'Running' and vm_name != 'dom0':
514534
self.row_label.set_label('Pause qube')
515535
self.set_sensitive(True)
516536
self.command = 'qvm-pause'

0 commit comments

Comments
 (0)