From 01094993c9dc2e78044f96b7a1bfbd9e6e0fee82 Mon Sep 17 00:00:00 2001 From: jao Date: Tue, 9 Aug 2022 00:37:41 +0100 Subject: xmobar-emacs, for emacs' tab bar --- src/Emacs.hs | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++ xmobar-config.cabal | 27 ++++++++++------ 2 files changed, 110 insertions(+), 10 deletions(-) create mode 100644 src/Emacs.hs diff --git a/src/Emacs.hs b/src/Emacs.hs new file mode 100644 index 0000000..553b782 --- /dev/null +++ b/src/Emacs.hs @@ -0,0 +1,93 @@ +import Xmobar +import Config +import Monitors +import Music (mpris, gpmd, mpdt) + +topProcL p = TopProc (p <~> args) 15 + where template = " ยท " + args = ["-t", template, "-w", "12", "-L" , "10", "-H", "80"] + +diskIOS p = DiskIO [("/", "โŽ— โŽ˜")] (diskArgs p) 10 + +cpuFreq' p = CpuFreq (p <~> args) 50 + where args = ["-t" , "" , "-L", "1", "-H", "2", "-S", "Off" , "-d", "2"] + +memory' = Memory args 20 + where template = " " + args = ["-t", template , "-p", "2", "-d", "1", "--", "--scale", "1024"] + +master p = Volume "default" "Master" (args ++ ("--":ext)) 10 + where args = ["-t", " "] + ext = ["-C", pForeground p, "-c", "sienna4", "-O", "๐ŸŽผ", "-o", "๐Ÿ”‡"] + +capture = Volume "default" "Capture" ["-t", ""] 10 + +weath st p = + WeatherX st + [ ("", "") + , ("clear", "๐ŸŒฃ") + , ("sunny", fc (pHigh p) "๐ŸŒฃ") + , ("fair", "๐ŸŒฃ") + , ("mostly clear", "๐ŸŒค") + , ("mostly sunny", "๐ŸŒค") + , ("partly sunny", "โ›…") + , ("obscured", "๐ŸŒ") -- ๐ŸŒซ + , ("fog", "๐ŸŒ") -- ๐ŸŒซ + , ("foggy", "๐ŸŒ") -- ๐ŸŒซ + , ("cloudy", "โ˜๏ธ") + , ("overcast", "โ˜๏ธ") + , ("partly cloudy", "โ›…") + , ("mostly cloudy", "โ˜๏ธ") + , ("considerable cloudiness", "โ›ˆ") + , ("light rain", "๐ŸŒง") + , ("rain", "โ›†") + , ("ice crystals", "โ„") + , ("light snow", "๐ŸŒจ") + , ("snow", "โ„") + ] + (mkArgs p ["-t", " ยฐ " + , "-L", "10", "-H", "25" , "-T", "25", "-E", ".."] + ["-w", ""]) + 18000 + +config p = (baseConfig p) { + position = TopSize C 100 (defaultHeight - 2) + , font = "xft:DejaVu Sans Mono-8" + , commands = [ Run (topProcL p) + , Run (batt p) + , Run (cpu p) + , Run (cpuFreq' p) + , Run memory' + , Run (diskU p) + , Run (diskIOS p) + , Run (kbd p) + , Run (coreTemp p) + , Run (wireless p "wlp164s0") + , Run (dynNetwork p) + , Run (vpnMark "wg-mullvad") + , Run tun0 + , Run (master p) + , Run capture + , Run laTime + , Run localTime + , Run (weath "EGPH" p) + ] + , template = " |batt0|" + ++ " |EGPH| " + ++ " |wg-mullvad||tun0||wlp164s0wi|" + ++ " |dynnetwork| " + ++ " |default:Master| ๐Ÿ—ช |default:Capture|" + ++ " {} " + ++ "|kbd|" + ++ " |cpufreq|" + ++ " |multicpu|" + ++ " |multicoretemp|" + ++ " |top| " + ++ " โž |memory| " + ++ " |diskio| ๐Ÿ–ซ|disku| " -- ๐Ÿ“€ ๐Ÿ–ด + ++ " |datetime| " + ++ "|laTime| " + } + +main :: IO () +main = palette >>= configFromArgs . config >>= xmobar diff --git a/xmobar-config.cabal b/xmobar-config.cabal index d219a8d..d6554f5 100644 --- a/xmobar-config.cabal +++ b/xmobar-config.cabal @@ -20,13 +20,6 @@ library other-modules: Paths_xmobar_config default-language: Haskell2010 -executable xmobar-top - main-is: Top.hs - hs-source-dirs: src - ghc-options: -rtsopts -with-rtsopts=-V0 -threaded - build-depends: base, xmobar, xmobar-config - default-language: Haskell2010 - executable xmobar-exwm main-is: TopC.hs hs-source-dirs: src @@ -34,13 +27,27 @@ executable xmobar-exwm build-depends: base, xmobar, xmobar-config default-language: Haskell2010 -executable xmobar-bottom - main-is: Bottom.hs +executable xmobar-emacs + main-is: Emacs.hs hs-source-dirs: src - ghc-options: -rtsopts -with-rtsopts=-V0 -threaded + ghc-options: -rtsopts -with-rtsopts=-V0 -threaded build-depends: base, xmobar, xmobar-config default-language: Haskell2010 +-- executable xmobar-top +-- main-is: Top.hs +-- hs-source-dirs: src +-- ghc-options: -rtsopts -with-rtsopts=-V0 -threaded +-- build-depends: base, xmobar, xmobar-config +-- default-language: Haskell2010 + +-- executable xmobar-bottom +-- main-is: Bottom.hs +-- hs-source-dirs: src +-- ghc-options: -rtsopts -with-rtsopts=-V0 -threaded +-- build-depends: base, xmobar, xmobar-config +-- default-language: Haskell2010 + executable xmobar-sway main-is: Sway.hs hs-source-dirs: src -- cgit v1.2.3