diff options
author | jao <jao@gnu.org> | 2018-12-22 03:17:40 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2018-12-22 03:17:40 +0000 |
commit | 50c919f6db5e8c83e561639d8c29d79c3f302d42 (patch) | |
tree | c180defd5efbc8b56064c5ad9f90f8bb0f0f46ac | |
parent | 80c57d09cab1eaedc09b85d7c21e629e3a6a796f (diff) | |
download | xmobar-config-50c919f6db5e8c83e561639d8c29d79c3f302d42.tar.gz xmobar-config-50c919f6db5e8c83e561639d8c29d79c3f302d42.tar.bz2 |
Monitor reshuffling
-rw-r--r-- | src/Top.hs | 41 | ||||
-rw-r--r-- | src/lib/Bottom.hs | 81 | ||||
-rw-r--r-- | src/lib/Monitors.hs | 91 | ||||
-rw-r--r-- | xmobar-config.cabal | 2 |
4 files changed, 115 insertions, 100 deletions
@@ -1,44 +1,27 @@ import Xmobar import Config - -topProc p = TopProc (p <~> ["-t" , "<mboth3> <mboth2> <mboth1> \ - \· <both3> <both2> <both1>" - , "-w", "10", "-L" , "10", "-H", "80"]) 15 - -wireless p = Wireless "wlp2s0" (p <~> ["-t" , "<essid> <quality>" - , "-W", "5", "-M", "15" , "-m", "2" - , "-L", "20", "-H", "80"]) 20 - -multiCPU p = MultiCpu (p <~> ["-t", "<autototal>" - , "-S", "on", "-b", " ", "-f", "*" - , "-c", " " , "-L", "30", "-H", "70" - , "-p", "3", "-a", "l"]) 10 - -cpuFreq p = CpuFreq (p <~> ["-t" , "<cpu0> <cpu1> <cpu2> <cpu3>" - , "-L", "1", "-H", "2", "-S", "Off" , "-d", "2"]) 50 - -dynNetwork p = DynNetwork (p <~> ["-t", "↑ <tx> ↓ <rx>" - , "-L", "20", "-H", "1024000" - , "-m", "5", "-W", "10", "-S", "Off"]) 10 +import Monitors config p = (baseConfig p) { position = TopSize C 100 defaultHeight , textOffset = defaultHeight - 8 , border = BottomB , commands = [ Run (topProc p) - , Run (wireless p) , Run (multiCPU p) , Run (cpuFreq p) - , Run (dynNetwork p) + , Run memory + , Run (diskU p) + , Run (diskIO p) + , Run (coreTemp p) + , Run kbd , Run XMonadLog - , Run (Network "tun0" ["-t", "<dev>:", "-x", ""] 20) - , Run (DateZone "%H" "en_US" "US/Pacific" "laTime" 10) - , Run (Date "%R" "datetime" 10) + , Run laTime + , Run localTime ] - , template = " |top| {|XMonadLog|}\ - \ |cpufreq| |multicpu| |dynnetwork|\ - \ <action=`toggle-nm-applet.sh `>|tun0||wlp2s0wi|</action>\ - \ |datetime| |laTime| " + , template = "|kbd| |memory| |top| {|XMonadLog|}\ + \ |cpufreq| |multicpu|\ + \ |coretemp| |diskio| |disku| \ + \ |datetime| |laTime| " } main :: IO () diff --git a/src/lib/Bottom.hs b/src/lib/Bottom.hs index 087ba97..f6c474d 100644 --- a/src/lib/Bottom.hs +++ b/src/lib/Bottom.hs @@ -2,90 +2,31 @@ module Bottom (config) where import Xmobar import Config - -uptime p = Uptime (p <~> [ "-t" , "<days> <hours>", "-m", "3", "-c", "0", "-S" - , "On" , "-L", "10", "-H", "100"]) 600 - -weather st = - Weather st ["-t", "<tempC>° <rh>% <windKmh> <skyCondition> (<hour>)" - , "-L","10", "-H", "25", "--normal", "black", - "--high", "lightgoldenrod4", "--low", "darkseagreen4"] 18000 - -batt p = - BatteryN ["BAT0"] - ((p <~> ["-t", "<left>%<acstatus>" - , "-S", "Off", "-d", "0", "-m", "3" - , "-L", "10", "-H", "80", "-p", "3"]) - ++ [ "--" - , "-i", "", "-O", " <timeleft> <watts>" - , "-o", " <timeleft> <watts>" - , "-H", "16", "-L", "10" - , "-h", "sienna4", "-l", "gray20"]) 50 "b0" - -coreTemp p = - CoreTemp (p <~> ["-t", "<core1>° <core2>°" - , "-L", "50", "-H", "75", "-d", "0"]) 50 - -diskU p = - DiskU [("dm-1", "<used>") , ("/media/sdb", " s <used>")] - (p <~> ["-L", "20", "-H", "70", "-m", "1", "-p", "3"]) - 20 - -diskIO p = - DiskIO [("dm-1", "↑ <read> ↓ <write>")] - (p <~> ["-L", "20", "-H", "5000", "-m", "5", "-p", "3"]) 10 - -mbox = MBox [ ("I", "inbox", "darkseagreen4") - , ("B", "bigml.spool", "sienna4") - , ("S", "bigsup.spool", "sienna4") - , ("b", "bugml.spool", "sienna4") - , ("G", "geiser.spool", "darkseagreen4") - , ("X", "xmobar.spool", "darkseagreen4") - , ("g", "gnu.spool", "") - , ("k", "books.spool", "") - , ("h", "hacking.spool", "") - , ("c", "computers.spool", "") - , ("w", "words.spool", "") - , ("t", "think.spool", "") - ] ["-d", "/home/jao/var/mail", "-p", " ", "-s", ""] "mbox" - - -masterVol = - Volume "default" "Master" - ["-t", "<status> <volume>" - , "--", "-C", "black", "-c", "sienna4", "-O", "" - , "-o", " ×"] 10 - -captureVol = Volume "default" "Capture" ["-t", "<volume>"] 10 - -kbd = Kbd [("us", ""), ("us(intl)", "*")] - -brightness = Brightness ["--", "-D", "intel_backlight"] 10 - -memory = Memory ["-t","<available> M", "-p", "2"] 20 +import Monitors config cs tpl p = (baseConfig p) { position = BottomSize C 100 defaultHeight , textOffset = defaultHeight - 6 , textOffsets = [defaultHeight - 5] , border = TopB - , template = "|tray||kbd||default:Master| |default:Capture| " + , template = "|tray| \ + \<action=`toggle-nm-applet.sh `>|tun0||wlp2s0wi|</action> \ + \|dynnetwork| \ + \|default:Master| |default:Capture| " ++ tpl ++ " {} |mbox| |EGPH| \ - \|diskio| |disku| · |bright| · |coretemp| \ - \|memory| · |uptime| |b0| " + \ |bright| \ + \|uptime| |b0| " , commands = [ Run (uptime p) , Run brightness + , Run (wireless p) + , Run (dynNetwork p) + , Run tun0 , Run (weather "EGPH") -- LEGE, LEBL, KCV0 - , Run (Com "padding-icon.sh" [] "tray" 20) - , Run memory + , Run trayPadding , Run (batt p) - , Run (coreTemp p) - , Run (diskU p) - , Run (diskIO p) , Run mbox , Run masterVol , Run captureVol - , Run kbd ] ++ cs } diff --git a/src/lib/Monitors.hs b/src/lib/Monitors.hs new file mode 100644 index 0000000..e684a2f --- /dev/null +++ b/src/lib/Monitors.hs @@ -0,0 +1,91 @@ +module Monitors where + +import Xmobar +import Config + +topProc p = TopProc (p <~> ["-t" , "<mboth3> <mboth2> <mboth1> \ + \· <both3> <both2> <both1>" + , "-w", "10", "-L" , "10", "-H", "80"]) 15 + +wireless p = Wireless "wlp2s0" (p <~> ["-t" , "<essid> <quality>" + , "-W", "5", "-M", "15" , "-m", "2" + , "-L", "20", "-H", "80"]) 20 + +multiCPU p = MultiCpu (p <~> ["-t", "<autototal>" + , "-S", "on", "-b", " ", "-f", "*" + , "-c", " " , "-L", "30", "-H", "70" + , "-p", "3", "-a", "l"]) 10 + +cpuFreq p = CpuFreq (p <~> ["-t" , "<cpu0> <cpu1> <cpu2> <cpu3>" + , "-L", "1", "-H", "2", "-S", "Off" , "-d", "2"]) 50 + +dynNetwork p = DynNetwork (p <~> ["-t", "↑ <tx> ↓ <rx>" + , "-L", "20", "-H", "1024000" + , "-m", "5", "-W", "10", "-S", "Off"]) 10 + +uptime p = Uptime (p <~> [ "-t" , "<days> <hours>", "-m", "3", "-c", "0", "-S" + , "On" , "-L", "10", "-H", "100"]) 600 + +weather st = + Weather st ["-t", "<tempC>° <rh>% <windKmh> <skyCondition> (<hour>)" + , "-L","10", "-H", "25", "--normal", "black", + "--high", "lightgoldenrod4", "--low", "darkseagreen4"] 18000 + +batt p = + BatteryN ["BAT0"] + ((p <~> ["-t", "<left>%<acstatus>" + , "-S", "Off", "-d", "0", "-m", "3" + , "-L", "10", "-H", "80", "-p", "3"]) + ++ [ "--" + , "-i", "", "-O", " <timeleft> <watts>" + , "-o", " <timeleft> <watts>" + , "-H", "16", "-L", "10" + , "-h", "sienna4", "-l", "gray20"]) 50 "b0" + +coreTemp p = + CoreTemp (p <~> ["-t", "<core1>° <core2>°" + , "-L", "50", "-H", "75", "-d", "0"]) 50 + +diskU p = + DiskU [("dm-1", "<used>") , ("/media/sdb", " s <used>")] + (p <~> ["-L", "20", "-H", "70", "-m", "1", "-p", "3"]) + 20 + +diskIO p = + DiskIO [("dm-1", "↑ <read> ↓ <write>")] + (p <~> ["-L", "20", "-H", "5000", "-m", "5", "-p", "3"]) 10 + +mbox = MBox [ ("I", "inbox", "darkseagreen4") + , ("B", "bigml.spool", "sienna4") + , ("S", "bigsup.spool", "sienna4") + , ("b", "bugml.spool", "sienna4") + , ("G", "geiser.spool", "darkseagreen4") + , ("X", "xmobar.spool", "darkseagreen4") + , ("g", "gnu.spool", "") + , ("k", "books.spool", "") + , ("h", "hacking.spool", "") + , ("c", "computers.spool", "") + , ("w", "words.spool", "") + , ("t", "think.spool", "") + ] ["-d", "/home/jao/var/mail", "-p", " ", "-s", ""] "mbox" + +masterVol = + Volume "default" "Master" + ["-t", "<status> <volume>" + , "--", "-C", "black", "-c", "sienna4", "-O", "" + , "-o", " ×"] 10 + +captureVol = Volume "default" "Capture" ["-t", "<volume>"] 10 + +kbd = Kbd [("us", ""), ("us(intl)", "*")] + +brightness = Brightness ["--", "-D", "intel_backlight"] 10 + +memory = Memory ["-t","<available> M", "-p", "2"] 20 + +tun0 = Network "tun0" ["-t", "<dev>:", "-x", ""] 20 + +laTime = DateZone "%H" "en_US" "US/Pacific" "laTime" 10 +localTime = Date "%R" "datetime" 10 + +trayPadding = Com "padding-icon.sh" [] "tray" 20 diff --git a/xmobar-config.cabal b/xmobar-config.cabal index 4ab8d73..6876bf9 100644 --- a/xmobar-config.cabal +++ b/xmobar-config.cabal @@ -13,7 +13,7 @@ extra-source-files: library hs-source-dirs: src/lib - exposed-modules: Config, Bottom, Mpris, MPD + exposed-modules: Config, Monitors, Bottom, Mpris, MPD build-depends: base >=4.7 && <5, xmobar other-modules: Paths_xmobar_config |