summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--lib/Config.hs3
-rw-r--r--lib/Monitors.hs73
-rw-r--r--lib/Music.hs4
-rw-r--r--src/Single.hs14
-rw-r--r--xmobar-config.cabal4
5 files changed, 67 insertions, 31 deletions
diff --git a/lib/Config.hs b/lib/Config.hs
index a388e1e..248cd97 100644
--- a/lib/Config.hs
+++ b/lib/Config.hs
@@ -85,7 +85,8 @@ baseConfig p = defaultConfig {
, borderColor = pBorder p
, fgColor = pForeground p
, bgColor = pBackground p
- , additionalFonts = ["FontAwesome 9"]
+ , additionalFonts = ["FontAwesome 9", "Weather Icons 10"]
+ , textOffsets = [0, -1]
, border = NoBorder
, alpha = pAlpha p
, overrideRedirect = True
diff --git a/lib/Monitors.hs b/lib/Monitors.hs
index 0b65af0..7f1c772 100644
--- a/lib/Monitors.hs
+++ b/lib/Monitors.hs
@@ -50,39 +50,65 @@ cpuFreq p = CpuFreq (p <~> ["-t" , "<avg> <max> <min> <cpu0> <cpu1> <cpu2> <cpu3
uptime p = Uptime (p <~> [ "-t" , "<days> <hours>", "-m", "3", "-c", "0", "-S"
, "On" , "-L", "10", "-H", "100"]) 600
+-- https://erikflowers.github.io/weather-icons/
weather' tmp st p =
WeatherX st
- [ ("", "\129695")
- , ("clear", "๐Ÿ”†")
- , ("sunny", "๐Ÿ”†")
- , ("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", "โ„๏ธ")
+ [ -- ("", "\129695")
+ -- , ("clear", "๐Ÿ”†")
+ -- , ("sunny", "๐Ÿ”†")
+ -- , ("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", "โ„๏ธ")
+ -- ("", "\xf054")
+ ("clear", "1 \xf00d")
+ , ("sunny", "2 \xf00d")
+ , ("fair", "3 \xf00d")
+ , ("mostly clear", "\xf00c")
+ , ("mostly sunny", "5 \xf00c")
+ , ("partly sunny", "6 \xf00c")
+ , ("obscured", "\xf063")
+ , ("haze", "\xf063")
+ , ("fog", "\xf04a")
+ , ("foggy", "\xf014")
+ , ("mist", "\xf014")
+ , ("fog in the vicinity", "\xf014")
+ , ("shallow fog", "\xf04a")
+ , ("cloudy", "10 \xf041")
+ , ("overcast", "\xf041")
+ , ("partly cloudy", "\xf083")
+ , ("mostly cloudy", "\xf013")
+ , ("considerable cloudiness", "14 \xf002")
+ , ("light rain", "\xf01c")
+ , ("rain", "\xf019")
+ , ("ice crystals", "17 \xf077")
+ , ("light snow", "18 \xf01b")
+ , ("snow", "19 \xf01b")
]
(mkArgs p ["-t", tmp , "-L", "10", "-H", "25" , "-T", "20"]
["-w", ""])
18000
-weather = weather' "<skyConditionS> <tempC>ยฐ <windKmh> <weather>"
+weather = weather' $ fn 2 "<weatherS>" ++ " <tempC>ยฐ <windKmh>"
-- "https://wttr.in?format=" ++ fnn 3 "%c" ++ "+%t+%C+%w++" ++ fnn 1 "%m"
-- , Run (ComX "curl" [wttrURL "Edinburgh"] "" "wttr" 18000)
wttrURL l = "https://wttr.in/" ++ l ++ "?format=" ++ fmt
- where fmt = fnn 2 "+%c+" ++ "+%t+%C+" ++ fn 5 "%w"
+ where -- fmt = fnn 2 "+%c+" ++ "+%t+%C+" ++ fn 5 "%w"
+ fmt = fnn 0 "%c%t+%w"
fnn n x = urlEncode ("<fn=" ++ show n ++ ">") ++ x ++ urlEncode "</fn>"
encode c
| c == ' ' = "+"
@@ -90,6 +116,8 @@ wttrURL l = "https://wttr.in/" ++ l ++ "?format=" ++ fmt
| otherwise = Printf.printf "%%%02X" c
urlEncode = concatMap encode
+edinWeather = Run (ComX "curl" [wttrURL "Edinburgh"] "" "wttr" 18000)
+
batt p =
BatteryN ["BAT0"]
["-t", "<acstatus> <left>"
@@ -198,6 +226,7 @@ masterAlsa p =
captureAlsa = Alsa "default" "Capture" ["-t", "<volume>"]
+-- kbd p = Kbd [("us", "us"), ("us(intl)", "es")] -- kbi pDim
kbd p = Kbd [("us", ""), ("us(intl)", kbi pHigh)] -- kbi pDim
where kbi a = fc (a p) (fn 1 " \xf11c")
diff --git a/lib/Music.hs b/lib/Music.hs
index 3b7bec4..7b712dc 100644
--- a/lib/Music.hs
+++ b/lib/Music.hs
@@ -3,7 +3,9 @@ module Music where
import Xmobar
import Monitors
import qualified Bottom
-import Config (defaultHeight, pIsLight, pHigh, fc, fni)
+import Config (defaultHeight, pIsLight, pHigh, fc, fn)
+
+fni = fn 1
mpris p client width =
Mpris2 client
diff --git a/src/Single.hs b/src/Single.hs
index 2119c6d..707cc15 100644
--- a/src/Single.hs
+++ b/src/Single.hs
@@ -1,6 +1,7 @@
import Xmobar
import Config
import Monitors
+import Music (mpdMon)
topProcL p s = TopProc (p <~> args) 15
where temp | s = "<both1> <both2> <both3> ยท <mboth1> <mboth2> <mboth3>"
@@ -27,13 +28,12 @@ config p = (baseConfig p) {
, bgColor = if pIsLight p then "#f0f0f0" else "black"
, alpha = 233
, border = FullB
- , textOffsets = []
, textOffset = 0
, iconOffset = 0
, 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"
+ -- , 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)
@@ -51,10 +51,12 @@ config p = (baseConfig p) {
-- , Run captureVol
, Run (masterAlsa p)
, Run captureAlsa
- , Run laTime
+-- , Run laTime
, Run localTime
, Run (cpuFreq' p)
, Run (weather "EGPH" p)
+ , Run mpdMon
+-- , edinWeather
] ++ extraCmds
, template = trayT
++ " |batt0| "
@@ -67,6 +69,8 @@ config p = (baseConfig p) {
++ " |alsa:default:Master| " ++ dimi "\xf130" ++ " |alsa:default:Capture|"
++ "</action>"
++ " |EGPH|"
+ ++ " |mpd|"
+-- ++ " |wttr|"
++ mail
++ " |kbd| "
++ eLog p
@@ -79,7 +83,7 @@ config p = (baseConfig p) {
++ dimi "\xf080" ++ " |memory| "
++ dimi "\xf0a0" ++ "|diskio| |disku| "
++ " |datetime| "
- ++ " |laTime| "
+-- ++ " |laTime| "
} where dimi = fc "grey40" . fn 1
isXmonad = pWm p == Just "xmonad"
trayT = if isXmonad then "|tray|" else ""
diff --git a/xmobar-config.cabal b/xmobar-config.cabal
index 4538d8f..2160f21 100644
--- a/xmobar-config.cabal
+++ b/xmobar-config.cabal
@@ -3,7 +3,7 @@ version: 0.1
description: xmobar configs
author: jao
maintainer: jao@gnu.org
-copyright: 2018, 2019, 2020, 2022, 2023 Jose A Ortega Ruiz
+copyright: 2018, 2019, 2020, 2022, 2023, 2025 Jose A Ortega Ruiz
license: GPL-3
build-type: Simple
cabal-version: >= 1.10
@@ -13,7 +13,7 @@ extra-source-files:
library
hs-source-dirs: lib
- exposed-modules: Config, Monitors, Bottom
+ exposed-modules: Config, Monitors, Bottom, Music
build-depends: base >=4.7 && <5, async > 2.2, stm >= 2.5,
aeson, text, bytestring, http-conduit,
hinotify, xmobar