ENH renamed network manager to vpn

This commit is contained in:
Nathan Dwarshuis 2020-03-22 17:17:57 -04:00
parent ecd7d0183b
commit 010c094a0c
3 changed files with 30 additions and 19 deletions

View File

@ -1,7 +1,7 @@
import Xmobar.Plugins.Bluetooth import Xmobar.Plugins.Bluetooth
import Xmobar.Plugins.IntelBacklight import Xmobar.Plugins.IntelBacklight
import Xmobar.Plugins.NetworkManager
import Xmobar.Plugins.Screensaver import Xmobar.Plugins.Screensaver
import Xmobar.Plugins.VPN
import qualified Theme as T import qualified Theme as T
@ -25,12 +25,12 @@ myTemplate = formatTemplate left right
++ " " ++ " "
left = [ "%UnsafeStdinReader%" ] left = [ "%UnsafeStdinReader%" ]
right = [ "%wlp0s20f3wi%" right = [ "%wlp0s20f3wi%"
, "%vpn%"
, "%bluetooth%"
, "%alsa:default:Master%" , "%alsa:default:Master%"
, "%battery%" , "%battery%"
, "%intelbacklight%" , "%intelbacklight%"
, "%bluetooth%"
, "%screensaver%" , "%screensaver%"
, "%networkmanager%"
, "%locks%" , "%locks%"
, "%date%" , "%date%"
] ]
@ -49,6 +49,13 @@ iconFont = T.fmtFontXFT T.font
, T.pixelsize = Just 13 , T.pixelsize = Just 13
} }
iconFontLarge :: String
iconFontLarge = T.fmtFontXFT T.font
{ T.family = "FontAwesome"
, T.size = Nothing
, T.pixelsize = Just 15
}
blockFont :: String blockFont :: String
blockFont = T.fmtFontXFT T.font blockFont = T.fmtFontXFT T.font
{ T.family = "Symbola" { T.family = "Symbola"
@ -59,9 +66,13 @@ blockFont = T.fmtFontXFT T.font
config :: String -> Config config :: String -> Config
config confDir = defaultConfig config confDir = defaultConfig
{ font = barFont { font = barFont
, additionalFonts = [ iconFont, blockFont ] , additionalFonts =
[ iconFont
, iconFontLarge
, blockFont
]
, textOffset = 16 , textOffset = 16
, textOffsets = [ 16, 17 ] , textOffsets = [ 16, 17, 17 ]
, bgColor = T.bgColor , bgColor = T.bgColor
, fgColor = T.fgColor , fgColor = T.fgColor
, position = BottomSize C 100 24 , position = BottomSize C 100 24
@ -112,24 +123,24 @@ config confDir = defaultConfig
] 5 ] 5
, Run $ Locks , Run $ Locks
[ "-N", "<fn=2>\x1f13d</fn>" [ "-N", "<fn=3>\x1f13d</fn>"
, "-n", wrapColor T.backdropFgColor "<fn=2>\x1f13d</fn>" , "-n", wrapColor T.backdropFgColor "<fn=3>\x1f13d</fn>"
, "-C", "<fn=2>\x1f132</fn>" , "-C", "<fn=3>\x1f132</fn>"
, "-c", wrapColor T.backdropFgColor "<fn=2>\x1f132</fn>" , "-c", wrapColor T.backdropFgColor "<fn=3>\x1f132</fn>"
, "-s", "" , "-s", ""
, "-S", "" , "-S", ""
, "-d", "<fn=2> </fn>" , "-d", "<fn=3> </fn>"
] ]
, Run $ Date "%Y-%m-%d %H:%M" "date" 10 , Run $ Date "%Y-%m-%d %H:%M" "date" 10
, Run $ Screensaver ("<fn=1>\xf254</fn>", T.fgColor, T.backdropFgColor) , Run $ Screensaver ("<fn=1>\xf254</fn>", T.fgColor, T.backdropFgColor)
, Run $ Bluetooth ("<fn=1>\xf293</fn>", T.fgColor, T.backdropFgColor) 5 , Run $ Bluetooth ("<fn=2>\xf293</fn>", T.fgColor, T.backdropFgColor) 5
, Run UnsafeStdinReader , Run UnsafeStdinReader
, Run $ NetworkManager ("VPN", T.fgColor, T.backdropFgColor) 5 , Run $ VPN ("<fn=2>\xf023</fn>", T.fgColor, T.backdropFgColor) 5
] ]
} }

View File

@ -1,14 +1,14 @@
{-# LANGUAGE LambdaCase #-} {-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
module Xmobar.Plugins.NetworkManager where module Xmobar.Plugins.VPN where
import DBus import DBus
import DBus.Client import DBus.Client
import Xmobar import Xmobar
data NetworkManager = NetworkManager (String, String, String) Int data VPN = VPN (String, String, String) Int
deriving (Read, Show) deriving (Read, Show)
callConnectionType :: Client -> IO (Either MethodError Variant) callConnectionType :: Client -> IO (Either MethodError Variant)
@ -17,10 +17,10 @@ callConnectionType client =
"org.freedesktop.NetworkManager" "PrimaryConnectionType") "org.freedesktop.NetworkManager" "PrimaryConnectionType")
{ methodCallDestination = Just "org.freedesktop.NetworkManager" } { methodCallDestination = Just "org.freedesktop.NetworkManager" }
instance Exec NetworkManager where instance Exec VPN where
alias (NetworkManager _ _) = "networkmanager" alias (VPN _ _) = "vpn"
rate (NetworkManager _ r) = r rate (VPN _ r) = r
run (NetworkManager (text, colorOn, colorOff) _) = do run (VPN (text, colorOn, colorOff) _) = do
client <- connectSystem client <- connectSystem
reply <- callConnectionType client reply <- callConnectionType client
disconnect client disconnect client

View File

@ -16,8 +16,8 @@ library
, DBus.Screensaver , DBus.Screensaver
, Xmobar.Plugins.Bluetooth , Xmobar.Plugins.Bluetooth
, Xmobar.Plugins.IntelBacklight , Xmobar.Plugins.IntelBacklight
, Xmobar.Plugins.NetworkManager
, Xmobar.Plugins.Screensaver , Xmobar.Plugins.Screensaver
, Xmobar.Plugins.VPN
build-depends: base build-depends: base
, X11 >= 1.9.1 , X11 >= 1.9.1
, colour >= 2.3.5 , colour >= 2.3.5