Skip to content

Commit b8fbc63

Browse files
committed
devices widget: open file manager on dispvm block attach
Uses new_dispvm.log for logging, consistent with existing patterns in the codebase. Fixes QubesOS/qubes-issues#10709
1 parent d56bb9e commit b8fbc63

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

qui/devices/actionable_widgets.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import qubesadmin
3232
import qubesadmin.devices
3333
import qubesadmin.vm
34+
from qubesadmin import exc
3435

3536
import gi
3637

@@ -41,6 +42,7 @@
4142
import time
4243

4344

45+
4446
def load_icon(icon_name: str, backup_name: str, size: int = 24):
4547
"""Load icon from provided name/path, if available. If not, load backup
4648
icon. If icon not found in any of the above ways, load a blank icon of
@@ -324,6 +326,19 @@ async def widget_action(self, *_args):
324326

325327
self.device.attach_to_vm(backend.VM(new_dispvm))
326328

329+
if self.device.device_class == "block":
330+
try:
331+
new_dispvm.run_service(
332+
"qubes.StartApp+qubes-open-file-manager",
333+
wait=False,
334+
)
335+
except exc.QubesException as ex:
336+
new_dispvm.log.exception(
337+
"Failed to open file manager in %s: %s",
338+
new_dispvm.name,
339+
ex,
340+
)
341+
327342

328343
class DetachAndAttachDisposableWidget(ActionableWidget, VMWithIcon):
329344
"""Detach from all current attachments and attach to new disposable"""
@@ -340,6 +355,19 @@ async def widget_action(self, *_args):
340355

341356
self.device.attach_to_vm(backend.VM(new_dispvm))
342357

358+
if self.device.device_class == "block":
359+
try:
360+
new_dispvm.run_service(
361+
"qubes.StartApp+qubes-open-file-manager",
362+
wait=False,
363+
)
364+
except exc.QubesException as ex:
365+
new_dispvm.log.exception(
366+
"Failed to open file manager in %s: %s",
367+
new_dispvm.name,
368+
ex,
369+
)
370+
343371

344372
class ToggleFeatureItem(ActionableWidget, SimpleActionWidget):
345373
def __init__(

0 commit comments

Comments
 (0)