diff options
author | tv <tv@krebsco.de> | 2024-04-23 02:50:34 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2024-04-23 02:50:34 +0200 |
commit | d72178c471ac31f52be3646294094b98d88d3252 (patch) | |
tree | 48ae9256f15677c6b7f7b4d929d6063092ab5cab | |
parent | 8c8661f0ec0812e4c2fcd9935e390bcd0eae5e31 (diff) |
xmonad: clear urgency on focus in
-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 () |