diff options
| author | jao <jao@gnu.org> | 2023-08-04 02:50:45 +0100 | 
|---|---|---|
| committer | jao <jao@gnu.org> | 2023-08-04 02:50:45 +0100 | 
| commit | a249429cb15c3aacdf1d44e68cd9dbb75b6d7fbf (patch) | |
| tree | d64c8f44c4d68dbd14d96a167e78c875dc3903e3 | |
| parent | c300eff998d758bf867abbb7f39bf6fdfecf7a2e (diff) | |
| download | xmobar-config-a249429cb15c3aacdf1d44e68cd9dbb75b6d7fbf.tar.gz xmobar-config-a249429cb15c3aacdf1d44e68cd9dbb75b6d7fbf.tar.bz2 | |
nits and test target
| -rw-r--r-- | lib/Monitors.hs | 8 | ||||
| -rw-r--r-- | src/Emacs.hs | 13 | ||||
| -rw-r--r-- | src/Single.hs | 23 | ||||
| -rw-r--r-- | src/Sway.hs | 4 | ||||
| -rw-r--r-- | src/Test.hs | 91 | ||||
| -rw-r--r-- | xmobar-config.cabal | 7 | 
6 files changed, 128 insertions, 18 deletions
| diff --git a/lib/Monitors.hs b/lib/Monitors.hs index ddff5b4..5438e53 100644 --- a/lib/Monitors.hs +++ b/lib/Monitors.hs @@ -21,6 +21,12 @@ wireless p n = Wireless n (p >~< ["-t", "<essid>"                                   -- <quality>\xf09e                                   , "-W", "5", "-M", "15" , "-m", "3"                                   , "-L", "20", "-H", "80"]) 20 +wirelessx p n = Wireless n (p >~< ["-t", "<essid>" ++ +                                        fn 1 "โ " ++ "<tx>  " ++ fn 1 "โ" ++ " <rx>" +                                 -- fc (pLow p) (fni "\xf1eb " ++ "<essid>") +                                 -- <quality>\xf09e +                                 , "-W", "5", "-M", "15" , "-m", "3" +                                 , "-L", "20", "-H", "80"]) 20  cpu p = MultiCpu (p <~> ["-t", "<total>"                          , "-S", "on", "-c", " " , "-L", "30", "-H", "70" @@ -67,7 +73,7 @@ weather' tmp st p =             , ("light snow", "๐จ๏ธ")             , ("snow", "โ๏ธ")             ] -           (mkArgs p ["-t", tmp , "-L", "10", "-H", "25" , "-T", "25", "-E", "โฆ"] +           (mkArgs p ["-t", tmp , "-L", "10", "-H", "25" , "-T", "20"]                       ["-w", ""])             18000 diff --git a/src/Emacs.hs b/src/Emacs.hs index 5c6cb26..315c29e 100644 --- a/src/Emacs.hs +++ b/src/Emacs.hs @@ -71,6 +71,7 @@ weath st p =  config p = (baseConfig p) {    position = TopSize C 100 22 +  , textOutput = True    , font = "Hack 10"    , commands = [ Run (topProcL p)                 , Run (batt0 p) @@ -81,7 +82,7 @@ config p = (baseConfig p) {                 , Run (diskIOS p)                 , Run (kbd p)                 , Run (coreTemp p) -               , Run (wireless p "wlp164s0") +               , Run (wireless p "wlan0")                 , Run (dynNetwork p)                 , Run (vpnMark "wg-mullvad")                 , Run tun0 @@ -90,15 +91,17 @@ config p = (baseConfig p) {                 , Run laTime                 , Run localTime                 , Run (weath "EGPH" p) +               , Run (NamedXPropertyLog "_EMACS_LOG" "elog")                 ]    , template = " |batt0| " -             ++ " ๐ง |wg-mullvad||tun0||wlp164s0wi|" -             -- ++ "  |wg-mullvad||tun0||wlp164s0wi|" +             ++ " ๐ง |wg-mullvad||tun0||wlan0wi|" +             -- ++ "  |wg-mullvad||tun0||wlan0wi|"               ++ " |dynnetwork| "               ++ "  |default:Master| ๐๏ธ |default:Capture|"               ++ "  |EGPH|" -             ++ "{*}" -             -- ++ "|kbd|" +             ++ " |elog|" +             ++ "{}" +             ++ "|kbd|"               ++ " |cpufreq|"               ++ " |multicpu|"               ++ " |multicoretemp|" diff --git a/src/Single.hs b/src/Single.hs index e7ecee6..166ceec 100644 --- a/src/Single.hs +++ b/src/Single.hs @@ -25,9 +25,10 @@ config p = (baseConfig p) {    , textOffsets = []    , textOffset = 0    , iconOffset = 0 -  -- , font = "Source Code Pro, Noto Color Emoji Regular 9, Italic 9" -  -- , font = "DejaVu Sans Mono, Noto Color Emoji 9, Regular 9" -  , font = "Hack, Noto Color Emoji Regular 9, Light 9" +  , dpi = 0 +  -- , font = "Source Code Pro, Noto Color Emoji Regular 9, Regular 9" +  , font = "DejaVu Sans Mono, Noto Color Emoji 9, Regular 9" +  -- , font = "Hack, Noto Color Emoji Regular 9, Light 9"    , commands = [ Run (topProcL p isXmonad)                 , Run (load p)                 , Run (iconBatt p) @@ -37,7 +38,7 @@ config p = (baseConfig p) {                 , Run (diskIOS p)                 , Run (kbd p)                 , Run (coreTemp p) -               , Run (wireless p "wlp164s0") +               , Run (wireless p "wlan0")                 , Run (dynNetwork p)                 , Run (vpnMark "wg-mullvad")                 , Run tun0 @@ -47,24 +48,23 @@ config p = (baseConfig p) {                 , Run localTime                 , Run (cpuFreq' p)                 , Run (weather "EGPH" p) -               -- , Run nmmail                 ] ++ extraCmds    , template = trayT               ++ " |batt0| "               ++ "<action=`toggle-app.sh nm-applet`>" -             ++ "  <fc=#000000>|wg-mullvad||tun0||wlp164s0wi|</fc>" +             ++ "  <fc=#000000>|wg-mullvad||tun0||wlan0wi|</fc>"               ++ "</action>"               ++ " |dynnetwork| "               ++ "<action=`toggle-app.sh pasystray`>"               ++ "  |default:Master| " ++ dimi "\xf130" ++ " |default:Capture|"               ++ "</action>"               ++ "    |EGPH|" -             -- ++ fc "sienna4" " |mail|" +             ++ mail               ++ " |kbd|" -             ++ "{"               ++ eLog p +             ++ "{"               ++ "}" -             ++ " |multicpu|" +             ++ "|multicpu|"               ++ "  |cpufreq|"               ++ " |multicoretemp|"               ++ "  |top|   " @@ -76,9 +76,12 @@ config p = (baseConfig p) {            isXmonad = pWm p == Just "xmonad"            trayT = if isXmonad then "|tray|" else ""            eLog p = if isXmonad then "|XMonadLog|" else fc (pHigh p) "|elog|" +          mail = if isXmonad then fc "sienna4" " |mail|" else ""            extraCmds = if isXmonad                        then [ Run (NamedXPropertyLog "_XMONAD_TRAYPAD" "tray") -                           , Run XMonadLog] +                           , Run XMonadLog +                           , Run nmmail +                           ]                        else [Run (NamedXPropertyLog "_EMACS_LOG" "elog")]  main :: IO () diff --git a/src/Sway.hs b/src/Sway.hs index 5c7ecc2..737c591 100644 --- a/src/Sway.hs +++ b/src/Sway.hs @@ -39,7 +39,7 @@ config p = (baseConfig p) {                 , Run brightness                 , Run (kbd p)                 , Run (coreTemp p) -               , Run (wireless p "wlp164s0") +               , Run (wireless p "wlan0")                 , Run (dynNetwork p)                 , Run (vpnMark "wg-mullvad")                 , Run tun0 @@ -55,7 +55,7 @@ config p = (baseConfig p) {               ++ " |batt0| "               ++ "   "               ++ "<action=`toggle-app.sh nm-applet --indicator`>" -             ++ " |wg-mullvad||tun0||wlp164s0wi|" +             ++ " |wg-mullvad||tun0||wlan0wi|"               ++ "</action>"               ++ " |dynnetwork| "               ++ "<hspace=3/>" diff --git a/src/Test.hs b/src/Test.hs new file mode 100644 index 0000000..84b38e5 --- /dev/null +++ b/src/Test.hs @@ -0,0 +1,91 @@ +import Xmobar +import Config +import Monitors + +topProcL p s = TopProc (p <~> args) 15 +  where temp | s = "<both1>  <both2>  <both3> ยท  <mboth1>  <mboth2>  <mboth3>" +             | otherwise = "<both1>  <both2>  <both3>  <both4> " +                            ++ "ยท  <mboth1>  <mboth2>  <mboth3>  <mboth4>" +        args = ["-t", temp, "-w", "12", "-L" , "10", "-H", "80"] + +diskIOS p = DiskIO [("/", "<read> <write>")] (diskArgs p) 10 + +cpuFreq' p = CpuFreq (p <~> args) 50 +  where args = ["-t" , "<avg>" , "-L", "1", "-H", "2", "-d", "2"] + +memory' = Memory args 20 +  where template = "<used> <available>" +        args = ["-t", template , "-p", "2", "-d", "1", "--", "--scale", "1024"] + +config p = (baseConfig p) { +  position = TopSize C 100 24 +  , bgColor = if pIsLight p then "#f0f0f0" else "black" +  , alpha = 255 -- 233 +  , border = FullB +  , textOffsets = [] +  , textOffset = 0 +  , iconOffset = 0 +  , iconRoot = "/home/jao/tmp" +  -- , font = "Source Code Pro, Noto Color Emoji Regular 9, Italic 9" +  , font = "DejaVu Sans Mono, Noto Color Emoji 9, Regular 9" +  , commands = [ Run (topProcL p isXmonad) +               , Run (load p) +               , Run (iconBatt p) +               , Run (cpuBars p) +               , Run memory' +               , Run (diskU p) +               , Run (diskIOS p) +               , Run (kbd p) +               , Run (coreTemp p) +               , Run (wireless p "wlan0") +               , Run (dynNetwork p) +               , Run (vpnMark "wg-mullvad") +               , Run tun0 +               , Run (masterVol p) +               , Run captureVol +               , Run laTime +               , Run localTime +               , Run (cpuFreq' p) +               , Run (weather "EGPH" p) +               , Run nmmail +               ] ++ extraCmds +  , template = "{something in the middle}" +  -- , template = trayT +  --            ++ " |batt0| " +  --            ++ "<action=`toggle-app.sh nm-applet`>" +  --            -- ++ "  <fc=#000000,#ffec8b55:1>|wg-mullvad||tun0||wlan0wi|</fc>" +  --            ++ "  <fc=#000000>|wg-mullvad||tun0||wlan0wi|</fc>" +  --            ++ "</action>" +  --            ++ " |dynnetwork| " +  --            ++ "<action=`toggle-app.sh pasystray`>" +  --            ++ "  |default:Master| " ++ dimi "\xf130" ++ " |default:Capture|" +  --            ++ "</action>" +  --            ++ "    |EGPH|" +  --            ++ fc "sienna4" " |mail|" +  --            ++ " |kbd|" +  --            ++ "{" +  --            ++ box "color=red width=1 mt=2 mb=2 ml=2 mr=2" "" +  --            -- "something in the middle something in the middle something in the middle something in the middle" +  --            ++ "<fc=red><icon=hbar_1.xbm/></fc>" +  --            ++ "}" +  --            ++ box "type=HBoth" " |multicpu|" +  --            ++ "  |cpufreq|" +  --            ++ box "type=VBoth mt=2 mb=2 color=green" " |multicoretemp|" +  --            ++ box "" " something loooooonger on the right side " -- "  |top| " +  --            ++ dimi "\xf080" ++ " |memory|  " +  --            ++ dimi "\xf0a0" ++ "|diskio| |disku| " +  --            ++ "  |datetime| " +  --            ++ " |laTime| " +  } where dimi = fc "grey40" . fn 1 +          box _ str = str +          -- box args str = "<box " ++ args ++ ">" ++ str ++ "</box>" +          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 ef64410..31aa799 100644 --- a/xmobar-config.cabal +++ b/xmobar-config.cabal @@ -47,3 +47,10 @@ executable xmobar-sway    ghc-options: -rtsopts -with-rtsopts=-V0 -threaded    build-depends: base, xmobar, xmobar-config    default-language: Haskell2010 + +executable xmobar-test +  main-is: Test.hs +  hs-source-dirs: src +  ghc-options: -rtsopts -with-rtsopts=-V0 -threaded +  build-depends: base, xmobar, xmobar-config +  default-language: Haskell2010 | 
