diff options
-rw-r--r-- | pkgs/haskell/xmonad-tv/src/main.hs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/pkgs/haskell/xmonad-tv/src/main.hs b/pkgs/haskell/xmonad-tv/src/main.hs index 7256963..1878d8e 100644 --- a/pkgs/haskell/xmonad-tv/src/main.hs +++ b/pkgs/haskell/xmonad-tv/src/main.hs @@ -1,4 +1,5 @@ {-# LANGUAGE LambdaCase #-} +{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE PatternSynonyms #-} module Main (main) where @@ -36,6 +37,7 @@ import XMonad.Hooks.UrgencyHook , RemindWhen(Dont) , SuppressWhen(Never) , UrgencyConfig(UrgencyConfig,remindWhen,suppressWhen) + , clearUrgents' , withUrgencyHookC ) import XMonad.Hooks.ManageHelpers (doCenterFloat,doRectFloat) @@ -89,6 +91,7 @@ mainNoArgs = do } $ def { terminal = {-pkg:alacritty-tv-}"alacritty" + , clientMask = clientMask def .|. focusChangeMask , modMask = mod4Mask , keys = myKeys myTermFont , layoutHook = @@ -116,12 +119,22 @@ mainNoArgs = do (\path -> forkFile path [] Nothing) , normalBorderColor = "#1c1c1c" , focusedBorderColor = "#f000b0" - , handleEventHook = handleShutdownEvent + , handleEventHook = handleFocusChangeEvent <> handleShutdownEvent } directories <- getDirectories launch config directories +handleFocusChangeEvent :: Event -> X All +handleFocusChangeEvent = \case + FocusChangeEvent{ev_event_type,ev_window} | ev_event_type == focusIn -> do + clearUrgents' [ev_window] + return (All True) + + _ -> + return (All True) + + forkFile :: FilePath -> [String] -> Maybe [(String, String)] -> X () forkFile path args env = xfork (executeFile path True args env) >> return () |