From bc1b2d6defbd9dc7cf8a5a103e9672fdb9a715f0 Mon Sep 17 00:00:00 2001 From: jao Date: Tue, 9 Aug 2022 22:50:48 +0100 Subject: xmobar-exwm -> xmobar-single --- cabal.project | 2 - readme.md | 10 +++-- src/Single.hs | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/TopC.hs | 110 ---------------------------------------------------- xmobar-config.cabal | 28 ++++++------- 5 files changed, 131 insertions(+), 129 deletions(-) create mode 100644 src/Single.hs delete mode 100644 src/TopC.hs diff --git a/cabal.project b/cabal.project index 7d6bef1..4c9d10e 100644 --- a/cabal.project +++ b/cabal.project @@ -1,4 +1,2 @@ packages: ., ../xmobar flags: +all_extensions -targets: ex:xmobar-exwm - diff --git a/readme.md b/readme.md index 873a19a..c725aaa 100644 --- a/readme.md +++ b/readme.md @@ -2,14 +2,18 @@ Configurations for xmobar, as Haskell programs. -Here's `xmobar-top`: +Here's (an old version of) `xmobar-top`: ![xmobar at the top of my screen](img/xmobar-top.png) -a screnshot of `xmobar-bottom`: +and an (equally outdated) screnshot of `xmobar-bottom`: ![xmobar at the bottom of my screen](img/xmobar-bottom.png) -and `xmobar-exwm` (sort of) combining the two: +which are meant to be used together; `xmobar-single` combines the two, +*mutatis mutandis*: ![xmobar when i'm using exwm](img/xmobar-exwm.png) + +There is also a couple of bars that output text, for use within an emacs tab +bar (`xmobar-emacs`) and with swaybar (`xmobar-sway`). diff --git a/src/Single.hs b/src/Single.hs new file mode 100644 index 0000000..c8e5115 --- /dev/null +++ b/src/Single.hs @@ -0,0 +1,110 @@ +import Xmobar +import Config +import Monitors +import Music (mpris, gpmd, mpdt) + +memoratio = Memory ["-t","%", "-p", "2", "-W", "3"] 20 + +topProcL p = TopProc (p <~> ["-t" + , memTemp + ++ " · " + , "-w", "12", "-L" , "10", "-H", "80"]) 15 + where memTemp = if pIsLight p + then " " + else " " + +diskIOL p = DiskIO [("/", ""), ("/home", "")] + (diskArgs p) 10 + +diskIOS p = DiskIO [("/", " ")] (diskArgs p) 10 + +mpd a p i = + MPDX [ "-W", "12", "-b", "░", "-f", "▒", "-t", " " + , "--", "-p", p, "-P", fni "\xf144", "-Z", fni i, "-S", fni i] 20 a + +mpdMon = mpd "mpd" "6600" "\xf001" +mopMon = mpd "mopidy" "6669" "\xf1bc" + +cpuFreq' p = CpuFreq (p <~> ["-t" , "" + , "-L", "1", "-H", "2", "-S", "Off" , "-d", "2"]) 50 + +cpus p = MultiCpu (mkArgs p + ["--template" , " %" + , "-L", "50", "-H", "85", "-W", "0", "-w", "3" + , "-f", "0123456789"] + ["--fallback-icon-pattern", ""]) 10 + + +memory' = Memory [ "-t" ," " + , "-p", "2", "-W", "0","-d", "1", "-f", "0123456789" + , "--", "--scale", "1024"] 20 + + +config p = (baseConfig p) { + position = TopSize C 100 (defaultHeight - 2) + , font = "xft:Hack-8" + , textOffset = defaultHeight - 8 + , textOffsets = [defaultHeight - 9, defaultHeight - 9, + defaultHeight - 6, defaultHeight - 8, + defaultHeight - 8, defaultHeight - 8] + , alpha = if pIsLight p then 192 else 230 + , border = FullB + , commands = [ Run (topProcL p) + , Run (load p) + , Run (iconBatt p) + , Run (cpu p) +-- , Run (cpus p) + , Run memory + , Run (diskU p) + , Run (diskIOS p) + , Run brightness + , Run (kbd p) + , Run (coreTemp p) + , Run (wireless p "wlp164s0") + , Run (dynNetwork p) + , Run (vpnMark "wg-mullvad") + , Run tun0 + , Run (masterVol p) + , Run captureVol + , Run laTime + , Run localTime + , Run (cpuFreq' p) + , Run w -- LEGE, LEBL, KCV0 + ] ++ extraCmds + , template = trayT + ++ " |batt0|" ++ sep + -- ++ dimi "\xf26c" ++ sep + ++ "|bright|" ++ sep + ++ "" + ++ " |wg-mullvad||tun0||wlp164s0wi|" + ++ "" + ++ " |dynnetwork| " ++ sep + ++ "" + ++ " |default:Master| " ++ dimi "\xf130" ++ " |default:Capture|" + ++ "" ++ sep + ++ " |EGPH| " ++ sep + ++ eLog p + ++ " {} " + ++ "|kbd|" ++ sep + ++ "|load|" ++ sep + ++ "|cpufreq|" ++ sep + ++ "|multicpu|" ++ sep + ++ "|multicoretemp|" ++ sep + ++ " |top| " ++ sep + ++ " " ++ fni "\xf0c9" ++ " |memory| " + ++ " |diskio| |disku| " ++ sep + ++ " |datetime| " + ++ "|laTime| " + } where dimi = fc (pDim p) . fni + sep = " " + w = weather' " ° " "EGPH" p + isXmonad = pWm p == Just "xmonad" + trayT = if isXmonad then "|tray|" else "" + eLog p = if isXmonad then "|XMonadLog|" else fc (pHigh p) "|elog|" + extraCmds = if isXmonad + then [ Run (NamedXPropertyLog "_XMONAD_TRAYPAD" "tray") + , Run XMonadLog] + else [Run (NamedXPropertyLog "_EMACS_LOG" "elog")] + +main :: IO () +main = palette >>= configFromArgs . config >>= xmobar diff --git a/src/TopC.hs b/src/TopC.hs deleted file mode 100644 index c8e5115..0000000 --- a/src/TopC.hs +++ /dev/null @@ -1,110 +0,0 @@ -import Xmobar -import Config -import Monitors -import Music (mpris, gpmd, mpdt) - -memoratio = Memory ["-t","%", "-p", "2", "-W", "3"] 20 - -topProcL p = TopProc (p <~> ["-t" - , memTemp - ++ " · " - , "-w", "12", "-L" , "10", "-H", "80"]) 15 - where memTemp = if pIsLight p - then " " - else " " - -diskIOL p = DiskIO [("/", ""), ("/home", "")] - (diskArgs p) 10 - -diskIOS p = DiskIO [("/", " ")] (diskArgs p) 10 - -mpd a p i = - MPDX [ "-W", "12", "-b", "░", "-f", "▒", "-t", " " - , "--", "-p", p, "-P", fni "\xf144", "-Z", fni i, "-S", fni i] 20 a - -mpdMon = mpd "mpd" "6600" "\xf001" -mopMon = mpd "mopidy" "6669" "\xf1bc" - -cpuFreq' p = CpuFreq (p <~> ["-t" , "" - , "-L", "1", "-H", "2", "-S", "Off" , "-d", "2"]) 50 - -cpus p = MultiCpu (mkArgs p - ["--template" , " %" - , "-L", "50", "-H", "85", "-W", "0", "-w", "3" - , "-f", "0123456789"] - ["--fallback-icon-pattern", ""]) 10 - - -memory' = Memory [ "-t" ," " - , "-p", "2", "-W", "0","-d", "1", "-f", "0123456789" - , "--", "--scale", "1024"] 20 - - -config p = (baseConfig p) { - position = TopSize C 100 (defaultHeight - 2) - , font = "xft:Hack-8" - , textOffset = defaultHeight - 8 - , textOffsets = [defaultHeight - 9, defaultHeight - 9, - defaultHeight - 6, defaultHeight - 8, - defaultHeight - 8, defaultHeight - 8] - , alpha = if pIsLight p then 192 else 230 - , border = FullB - , commands = [ Run (topProcL p) - , Run (load p) - , Run (iconBatt p) - , Run (cpu p) --- , Run (cpus p) - , Run memory - , Run (diskU p) - , Run (diskIOS p) - , Run brightness - , Run (kbd p) - , Run (coreTemp p) - , Run (wireless p "wlp164s0") - , Run (dynNetwork p) - , Run (vpnMark "wg-mullvad") - , Run tun0 - , Run (masterVol p) - , Run captureVol - , Run laTime - , Run localTime - , Run (cpuFreq' p) - , Run w -- LEGE, LEBL, KCV0 - ] ++ extraCmds - , template = trayT - ++ " |batt0|" ++ sep - -- ++ dimi "\xf26c" ++ sep - ++ "|bright|" ++ sep - ++ "" - ++ " |wg-mullvad||tun0||wlp164s0wi|" - ++ "" - ++ " |dynnetwork| " ++ sep - ++ "" - ++ " |default:Master| " ++ dimi "\xf130" ++ " |default:Capture|" - ++ "" ++ sep - ++ " |EGPH| " ++ sep - ++ eLog p - ++ " {} " - ++ "|kbd|" ++ sep - ++ "|load|" ++ sep - ++ "|cpufreq|" ++ sep - ++ "|multicpu|" ++ sep - ++ "|multicoretemp|" ++ sep - ++ " |top| " ++ sep - ++ " " ++ fni "\xf0c9" ++ " |memory| " - ++ " |diskio| |disku| " ++ sep - ++ " |datetime| " - ++ "|laTime| " - } where dimi = fc (pDim p) . fni - sep = " " - w = weather' " ° " "EGPH" p - isXmonad = pWm p == Just "xmonad" - trayT = if isXmonad then "|tray|" else "" - eLog p = if isXmonad then "|XMonadLog|" else fc (pHigh p) "|elog|" - extraCmds = if isXmonad - then [ Run (NamedXPropertyLog "_XMONAD_TRAYPAD" "tray") - , Run XMonadLog] - else [Run (NamedXPropertyLog "_EMACS_LOG" "elog")] - -main :: IO () -main = palette >>= configFromArgs . config >>= xmobar diff --git a/xmobar-config.cabal b/xmobar-config.cabal index d6554f5..f83f74a 100644 --- a/xmobar-config.cabal +++ b/xmobar-config.cabal @@ -20,8 +20,8 @@ library other-modules: Paths_xmobar_config default-language: Haskell2010 -executable xmobar-exwm - main-is: TopC.hs +executable xmobar-single + main-is: Single.hs hs-source-dirs: src ghc-options: -rtsopts -with-rtsopts=-V0 -threaded build-depends: base, xmobar, xmobar-config @@ -34,19 +34,19 @@ executable xmobar-emacs 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-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-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 -- cgit v1.2.3