summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xicons/gen-load-icons.sh10
-rw-r--r--lib/Bottom.hs (renamed from src/lib/Bottom.hs)0
-rw-r--r--lib/Config.hs (renamed from src/lib/Config.hs)0
-rw-r--r--lib/Monitors.hs (renamed from src/lib/Monitors.hs)36
-rw-r--r--lib/Music.hs (renamed from src/lib/Music.hs)1
-rw-r--r--setup.hs (renamed from Setup.hs)0
-rw-r--r--src/lib/GMPDP.hs95
-rw-r--r--xmobar-config.cabal4
8 files changed, 19 insertions, 127 deletions
diff --git a/icons/gen-load-icons.sh b/icons/gen-load-icons.sh
index 8f346b6..b5d0473 100755
--- a/icons/gen-load-icons.sh
+++ b/icons/gen-load-icons.sh
@@ -13,11 +13,11 @@ my $color_bg = "white";
# my $color_fg = "darkseagreen";
my $color_fg = "grey90";
-$color_bg = "#2B2B2B";
-$color_bg = "#1f1f1f"; # zenburn
-$color_bg = "#22242b"; # doom
-$color_fg = "#999999";
-$color_bg = "#eeeeee";
+# $color_bg = "#2B2B2B";
+# $color_bg = "#1f1f1f"; # zenburn
+# $color_bg = "#22242b"; # doom
+# $color_fg = "#999999";
+# $color_bg = "#eeeeee";
for ( my $file_num = 0; $file_num <= 8; $file_num++ ) {
diff --git a/src/lib/Bottom.hs b/lib/Bottom.hs
index 5b2b6c9..5b2b6c9 100644
--- a/src/lib/Bottom.hs
+++ b/lib/Bottom.hs
diff --git a/src/lib/Config.hs b/lib/Config.hs
index 7e1b2bb..7e1b2bb 100644
--- a/src/lib/Config.hs
+++ b/lib/Config.hs
diff --git a/src/lib/Monitors.hs b/lib/Monitors.hs
index f09631b..e617697 100644
--- a/src/lib/Monitors.hs
+++ b/lib/Monitors.hs
@@ -75,17 +75,12 @@ cpuBars p = MultiCpu (mkArgs p
cpuFreq p = CpuFreq (p <~> ["-t" , "<avg> <max> <min> <cpu0> <cpu1> <cpu2> <cpu3>"
, "-L", "1", "-H", "2", "-S", "Off" , "-d", "2"]) 50
--- ⤒⤊⍐ ⊼ ⇧ ⇩ ⎗ ⎘
-dynNetwork p = DynNetwork (p <~> ["-t", fn 1 "↑ " ++ "<tx> " ++ fn 1 "↓" ++ " <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' tmp st p =
WeatherX st
- [ ("", fc (pDim p) "") -- "🧚"
+ [ ("", fc (pDim p) (fn 4 "🌡"))
, ("clear", fn 4 "🌣")
, ("sunny", fc (pHigh p) $ fn 4 "🌣")
, ("fair", fn 4 "🌣")
@@ -94,12 +89,10 @@ weather' tmp st p =
, ("partly sunny", fn 3 "⛅")
, ("obscured", fn 4 "🌁") -- 🌫
, ("cloudy", fn 3 "☁")
- -- , ("overcast", fn 3 "☁")
, ("overcast", fn 3 "☁️")
, ("partly cloudy", fn 3 "⛅")
- -- , ("mostly cloudy", fn 3 "☁")
, ("mostly cloudy", fn 3 "☁️")
- , ("considerable cloudiness", fn 4 "⛈")
+ , ("considerable cloudiness", fn 3 "☁️")
, ("light rain", fn 4 "🌧")
, ("rain", fn 4 "⛆")
, ("ice crystals", snow)
@@ -143,8 +136,8 @@ batt p =
iconBatt p =
BatteryN ["BAT0"]
["-t", "<acstatus>"
- , "-S", "Off", "-d", "0", "-m", "3"
- , "-L", "10", "-H", "90", "-p", "3"
+ , "-S", "Off", "-d", "0", "-m", "2"
+ , "-L", "10", "-H", "90", "-p", "2"
, "-W", "0", "-f",
"\xf244\xf243\xf243\xf243\xf242\xf242\xf242\xf241\xf241\xf240"
, "--low", pHigh p, "--normal", pNormal p, "--high", pLow p
@@ -153,8 +146,8 @@ iconBatt p =
, "-a", "notify-send -u critical 'Battery running out!!!!!!'"
, "-A", "5"
, "-i", fni "\xf1e6"
- , "-O", fni "<leftbar> \xf1e6" ++ " <watts> <timeleft>"
- , "-o", fni "<leftbar>" ++ " <watts> <timeleft>"
+ , "-O", fni "<leftbar> \xf1e6" ++ " <left> <watts> <timeleft>"
+ , "-o", fni "<leftbar>" ++ " <left> <watts> <timeleft>"
, "-H", "10", "-L", "7"
, "-h", pHigh p, "-l", pLow p] 50 "batt0"
@@ -192,8 +185,6 @@ diskArgs p = mkArgs p
diskIO p =
DiskIO [("rivendell-vg/root", "<readb> <writeb> <totalbipat>")] (diskArgs p) 10
--- <fn=1>📨 🖅 🖃 📩 ✉ </fn>
--- (fni "\xf01c \xf03a \xf1fa \xf0e0 \xf1d8 ")
mail p = MailX [ ("I", "jao/inbox", pHigh p)
, ("b", "bigml/bugs", pHigh p)
, ("B", "bigml/inbox", "")
@@ -207,19 +198,13 @@ mail p = MailX [ ("I", "jao/inbox", pHigh p)
, ("B", "jao/bills", pDim p)
, ("L", "bigml/lists", pDim p)
]
- [ "-d", "~/var/mail"
- -- , "-p", fc (pHigh p) $ fn 1 "⎘ " -- fc (pLow p) (fni "\xf01c" ++ " ")
- , "-s", " "
- ]
+ [ "-d", "~/var/mail", "-s", " "]
"mail"
masterVol p =
Volume "default" "Master"
["-t", "<status> <volume>"
- -- "<status> " ++ fni "<volumebar>" ++ " <volume>"
- -- , "-W", "0", "-f", "\xf026\xf026\xf027\xf027\xf028\xf028\xf028"
, "--", "-C", pForeground p, "-c", "sienna4"
- -- , "-O", ""
, "-O", fni "\xf025" -- "\xf130" -- fn 2 "🎧"
, "-o", fn 4 "🔇"
] 10
@@ -236,8 +221,11 @@ memory = Memory [ "-t" ,"<used>:<available>"
, "-p", "2", "-W", "4","-d", "1"
, "--", "--scale", "1024"] 20
-netdev name icon =
- Network name ["-t", "<up>", "-x", "", "--", "--up", icon] 20 -- fn 2 "🔐 "
+dynNetwork p = DynNetwork (p <~> ["-t", fn 1 "↑ " ++ "<tx> " ++ fn 1 "↓" ++ " <rx>"
+ , "-L", "20", "-H", "1024000"
+ , "-m", "5", "-W", "10", "-S", "Off"]) 10
+
+netdev name icon = Network name ["-t", "<up>", "-x", "", "--", "--up", icon] 20
vpnMark n = netdev n $ fn 2 "🔒 " -- fni "\xf0e8 "
proton0 = vpnMark "proton0"
tun0 = vpnMark "tun0"
diff --git a/src/lib/Music.hs b/lib/Music.hs
index a2698c9..dc7375c 100644
--- a/src/lib/Music.hs
+++ b/lib/Music.hs
@@ -4,7 +4,6 @@ import Xmobar
import Monitors
import qualified Bottom
import Config (defaultHeight, pIsLight, pHigh, fc, fni)
-import GMPDP (GMPDP(..))
mpris p client width =
Mpris2 client
diff --git a/Setup.hs b/setup.hs
index 9a994af..9a994af 100644
--- a/Setup.hs
+++ b/setup.hs
diff --git a/src/lib/GMPDP.hs b/src/lib/GMPDP.hs
deleted file mode 100644
index 6c8ad17..0000000
--- a/src/lib/GMPDP.hs
+++ /dev/null
@@ -1,95 +0,0 @@
-{-# LANGUAGE OverloadedStrings, DeriveGeneric #-}
-
--- https://www.schoolofhaskell.com/school/starting-with-haskell/libraries-and-frameworks/text-manipulation/json
-
-module GMPDP where
-
-import Data.Aeson
-
-
-import qualified Data.ByteString.Lazy as B
-
-import GHC.Generics
-
-import Xmobar
-
-import Control.Monad (when, guard)
-import Control.Concurrent.STM
-
-
-import System.INotify (Event(..), EventVariety(..), initINotify, addWatch)
-
-import qualified Data.ByteString.Char8 as BS (ByteString, pack)
-
-
--- | Type of each JSON entry in record syntax.
-data Song =
- Song { title :: !String
- , artist :: !String
- , album :: !String
- } deriving (Eq,Show,Generic)
-
-data PlayTime =
- PlayTime { current :: !Int
- , total :: !Int
- } deriving (Eq,Show,Generic)
-
-data GMPDPStatus =
- GMPDPStatus { song :: Song
- , time :: PlayTime
- } deriving (Eq,Show,Generic)
-
--- Instances to convert our type to/from JSON.
-
-instance FromJSON Song
-instance FromJSON PlayTime
-instance FromJSON GMPDPStatus
-
--- | Location of the local copy, in case you have it,
--- of the JSON file.
-jsonFile :: FilePath
-jsonFile = "/home/jao/.config/Google Play Music Desktop Player/json_store/playback.json"
-
-getJSON :: IO B.ByteString
-getJSON = B.readFile jsonFile
-
-getGMPDPStatus :: IO (Maybe GMPDPStatus)
-getGMPDPStatus = do
- s <- (eitherDecode <$> getJSON) :: IO (Either String GMPDPStatus)
- case s of
- Left _ -> return Nothing
- Right r -> return $ Just r
-
-newtype GMPDP = GMPDP String deriving (Show,Read,Generic)
-
-handleNotification :: TVar (Maybe GMPDPStatus) -> Event -> IO ()
-handleNotification v _ =
- getGMPDPStatus >>= \s -> atomically $ writeTVar v s
-
-formatStatus Nothing = ""
-formatStatus (Just s) =
- fmtt (current $ time s) ++ "/" ++ fmtt (total $ time s) ++
- " " ++ title (song s) ++ " <fc=sienna4>" ++ album (song s) ++ "</fc>" ++
- " " ++ artist (song s)
- where fmtt ms = let s = ms `div` 1000
- sr x = if x < 10 then "0" ++ show x else show x
- in sr (s `div` 60) ++ ":" ++ sr (s `mod` 60)
-
-changeLoop :: Eq a => STM a -> (a -> IO ()) -> IO ()
-changeLoop s f = atomically s >>= go
- where
- go old = do
- f old
- go =<< atomically (do
- new <- s
- guard (new /= old)
- return new)
-
-instance Exec GMPDP where
- alias (GMPDP a) = a
- start (GMPDP _) cb = do
- i <- initINotify
- s <- getGMPDPStatus
- v <- newTVarIO s
- addWatch i [CloseWrite] (BS.pack jsonFile) (handleNotification v)
- changeLoop (readTVar v) $ \s -> cb (formatStatus s)
diff --git a/xmobar-config.cabal b/xmobar-config.cabal
index f83f74a..f1dccac 100644
--- a/xmobar-config.cabal
+++ b/xmobar-config.cabal
@@ -12,8 +12,8 @@ extra-source-files:
readme.md
library
- hs-source-dirs: src/lib
- exposed-modules: Config, Monitors, Bottom, Music, GMPDP
+ hs-source-dirs: lib
+ 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