From 9d7ca49357a0f25af16af3bb13b43d63836487e4 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Sun, 1 Jan 2023 22:40:28 -0500 Subject: [PATCH] ADD logger for device listener --- lib/Xmobar/Plugins/Device.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Xmobar/Plugins/Device.hs b/lib/Xmobar/Plugins/Device.hs index 9a81261..3ce53fc 100644 --- a/lib/Xmobar/Plugins/Device.hs +++ b/lib/Xmobar/Plugins/Device.hs @@ -74,8 +74,8 @@ instance Exec Device where where logName = "device@" <> Utf8Builder (encodeUtf8Builder iface) listener sys path = do - rule <- matchPropertyFull sys networkManagerBus (Just path) - -- TODO warn the user here rather than silently drop the listener - forM_ rule $ \r -> - startListener r (getDeviceConnected path) matchStatus chooseColor' cb sys + res <- matchPropertyFull sys networkManagerBus (Just path) + case res of + Just rule -> startListener rule (getDeviceConnected path) matchStatus chooseColor' cb sys + Nothing -> logError "could not start listener" chooseColor' = return . (\s -> colorText colors s text) . (> 1)