about summary refs log tree commit diff
path: root/src/lib/XMonad/Custom/Log.hs
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2022-08-16 01:46:04 +0300
committerAzat Bahawi <azat@bahawi.net>2022-08-16 01:46:04 +0300
commit3cd06b22069c009b8c5fea2d5fad5f996667d2e3 (patch)
tree4b5f1cb453de13c560bc8aa5a57952713cf360aa /src/lib/XMonad/Custom/Log.hs
parentabsolute garbage wtf (diff)
huge update-o
Diffstat (limited to 'src/lib/XMonad/Custom/Log.hs')
-rw-r--r--src/lib/XMonad/Custom/Log.hs78
1 files changed, 8 insertions, 70 deletions
diff --git a/src/lib/XMonad/Custom/Log.hs b/src/lib/XMonad/Custom/Log.hs
index e9d3c1a..5e1e1b1 100644
--- a/src/lib/XMonad/Custom/Log.hs
+++ b/src/lib/XMonad/Custom/Log.hs
@@ -1,82 +1,20 @@
 -- |
 -- Module                  : XMonad.Custom.Log
 -- Description             : Loggers and statusbar configuration
--- Copyright               : (c) Azat Bahawi 2018-2021
+-- Copyright               : (c) Azat Bahawi 2018-2022
 -- SPDX-License-Identifier : GPL-3.0-or-later
--- Maintainer              : azahi@teknik.io
+-- Maintainer              : azat@bahawi.net
 -- Stability               : experimental
 -- Portability             : non-portable
 --
 
 module XMonad.Custom.Log
-  ( logHook
+  ( ngLogHook
   ) where
 
-import           System.IO
-import           XMonad                  hiding ( logHook )
-import           XMonad.Actions.CopyWindow
-import           XMonad.Custom.Theme
-import           XMonad.Hooks.CurrentWorkspaceOnTop
-import           XMonad.Hooks.DynamicLog
-import           XMonad.Hooks.EwmhDesktops
-import           XMonad.Util.NamedScratchpad
-import           XMonad.Util.SpawnNamedPipe
-import           XMonad.Util.WorkspaceCompare
+import           XMonad                         ( X )
+import           XMonad.Hooks.DynamicLog        ( dynamicLog )
 
-xmobarFont :: Int -> String -> String
-xmobarFont f = wrap (concat ["<fn=", show f, ">"]) "</fn>"
-
-topBarPP :: PP
-topBarPP = def
-  { ppCurrent         = xmobarColor white2 "" . xmobarFont 2 . wrap "=" "="
-  , ppVisible         = xmobarColor white1 "" . wrap "~" "~"
-  , ppHidden          = xmobarColor white1 "" . wrap "-" "-"
-  , ppHiddenNoWindows = xmobarColor white1 "" . wrap "_" "_"
-  , ppUrgent          = xmobarColor red2 "" . wrap "!" "!"
-  , ppSep             = " / "
-  , ppWsSep           = " "
-  , ppTitle           = xmobarColor white1 "" . shorten 50
-  , ppTitleSanitize   = xmobarStrip
-  , ppLayout          = xmobarColor white1 ""
-  , ppOrder           = id
-  , ppSort            = (namedScratchpadFilterOutWorkspace .) <$> getSortByIndex
-  , ppExtras          = []
-  }
-
-botBarPP :: PP
-botBarPP = topBarPP { ppCurrent         = const ""
-                    , ppVisible         = const ""
-                    , ppHidden          = const ""
-                    , ppHiddenNoWindows = const ""
-                    , ppUrgent          = const ""
-                    , ppTitle           = const ""
-                    , ppLayout          = const ""
-                    }
-
-safePrintToPipe :: Maybe Handle -> String -> IO ()
-safePrintToPipe = maybe (\_ -> return ()) hPutStrLn
-
-logHook :: X ()
-logHook = do
-  currentWorkspaceOnTop
-  ewmhDesktopsLogHook
-  t <- getNamedPipe "xmobarTop"
-  b <- getNamedPipe "xmobarBot"
-  c <- wsContainingCopies
-  let copiesCurrent ws
-        | ws `elem` c
-        = xmobarColor yellow2 "" . xmobarFont 2 . wrap "*" "=" $ ws
-        | otherwise
-        = xmobarColor white2 "" . xmobarFont 2 . wrap "=" "=" $ ws
-  let copiesHidden ws
-        | ws `elem` c = xmobarColor yellow1 "" . wrap "*" "-" $ ws
-        | otherwise   = xmobarColor white1 "" . wrap "-" "-" $ ws
-  let copiesUrgent ws
-        | ws `elem` c = xmobarColor yellow2 "" . wrap "*" "!" $ ws
-        | otherwise   = xmobarColor white2 "" . wrap "!" "!" $ ws
-  dynamicLogWithPP $ topBarPP { ppCurrent = copiesCurrent
-                              , ppHidden  = copiesHidden
-                              , ppUrgent  = copiesUrgent
-                              , ppOutput  = safePrintToPipe t
-                              }
-  dynamicLogWithPP $ botBarPP { ppOutput = safePrintToPipe b }
+ngLogHook :: X ()
+ngLogHook = do
+  dynamicLog

Consider giving Nix/NixOS a try! <3