2626import asyncio
2727import functools
2828import pathlib
29+ import logging
2930from typing import Iterable , Callable , Optional , List
3031
3132import qubesadmin
3233import qubesadmin .devices
3334import qubesadmin .vm
35+ from qubesadmin import exc
3436
3537import gi
3638
4042from . import backend
4143import time
4244
45+ logger = logging .getLogger (__name__ )
46+
4347
4448def load_icon (icon_name : str , backup_name : str , size : int = 24 ):
4549 """Load icon from provided name/path, if available. If not, load backup
@@ -324,6 +328,19 @@ async def widget_action(self, *_args):
324328
325329 self .device .attach_to_vm (backend .VM (new_dispvm ))
326330
331+ if self .device .device_class == "block" :
332+ try :
333+ new_dispvm .run_service (
334+ "qubes.StartApp+qubes-open-file-manager" ,
335+ wait = False ,
336+ )
337+ except exc .QubesException as ex :
338+ new_dispvm .log .exception (
339+ "Failed to open file manager in %s: %s" ,
340+ new_dispvm .name ,
341+ ex ,
342+ )
343+
327344
328345class DetachAndAttachDisposableWidget (ActionableWidget , VMWithIcon ):
329346 """Detach from all current attachments and attach to new disposable"""
@@ -340,6 +357,19 @@ async def widget_action(self, *_args):
340357
341358 self .device .attach_to_vm (backend .VM (new_dispvm ))
342359
360+ if self .device .device_class == "block" :
361+ try :
362+ new_dispvm .run_service (
363+ "qubes.StartApp+qubes-open-file-manager" ,
364+ wait = False ,
365+ )
366+ except exc .QubesException as ex :
367+ new_dispvm .log .exception (
368+ "Failed to open file manager in %s: %s" ,
369+ new_dispvm .name ,
370+ ex ,
371+ )
372+
343373
344374class ToggleFeatureItem (ActionableWidget , SimpleActionWidget ):
345375 def __init__ (
0 commit comments