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.IntelBacklight
import Xmobar.Plugins.NetworkManager
import Xmobar.Plugins.Screensaver
import Xmobar.Plugins.VPN
import qualified Theme as T
@ -25,12 +25,12 @@ myTemplate = formatTemplate left right
++ " "
left = [ "%UnsafeStdinReader%" ]
right = [ "%wlp0s20f3wi%"
, "%vpn%"
, "%bluetooth%"
, "%alsa:default:Master%"
, "%battery%"
, "%intelbacklight%"
, "%bluetooth%"
, "%screensaver%"
, "%networkmanager%"
, "%locks%"
, "%date%"
]
@ -49,6 +49,13 @@ iconFont = T.fmtFontXFT T.font
, T.pixelsize = Just 13
}
iconFontLarge :: String
iconFontLarge = T.fmtFontXFT T.font
{ T.family = "FontAwesome"
, T.size = Nothing
, T.pixelsize = Just 15
}
blockFont :: String
blockFont = T.fmtFontXFT T.font
{ T.family = "Symbola"
@ -59,9 +66,13 @@ blockFont = T.fmtFontXFT T.font
config :: String -> Config
config confDir = defaultConfig
{ font = barFont
, additionalFonts = [ iconFont, blockFont ]
, additionalFonts =
[ iconFont
, iconFontLarge
, blockFont
]
, textOffset = 16
, textOffsets = [ 16, 17 ]
, textOffsets = [ 16, 17, 17 ]
, bgColor = T.bgColor
, fgColor = T.fgColor
, position = BottomSize C 100 24
@ -112,24 +123,24 @@ config confDir = defaultConfig
] 5
, Run $ Locks
[ "-N", "<fn=2>\x1f13d</fn>"
, "-n", wrapColor T.backdropFgColor "<fn=2>\x1f13d</fn>"
, "-C", "<fn=2>\x1f132</fn>"
, "-c", wrapColor T.backdropFgColor "<fn=2>\x1f132</fn>"
[ "-N", "<fn=3>\x1f13d</fn>"
, "-n", wrapColor T.backdropFgColor "<fn=3>\x1f13d</fn>"
, "-C", "<fn=3>\x1f132</fn>"
, "-c", wrapColor T.backdropFgColor "<fn=3>\x1f132</fn>"
, "-s", ""
, "-S", ""
, "-d", "<fn=2> </fn>"
, "-d", "<fn=3> </fn>"
]
, Run $ Date "%Y-%m-%d %H:%M" "date" 10
, 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 $ 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 OverloadedStrings #-}
module Xmobar.Plugins.NetworkManager where
module Xmobar.Plugins.VPN where
import DBus
import DBus.Client
import Xmobar
data NetworkManager = NetworkManager (String, String, String) Int
data VPN = VPN (String, String, String) Int
deriving (Read, Show)
callConnectionType :: Client -> IO (Either MethodError Variant)
@ -17,10 +17,10 @@ callConnectionType client =
"org.freedesktop.NetworkManager" "PrimaryConnectionType")
{ methodCallDestination = Just "org.freedesktop.NetworkManager" }
instance Exec NetworkManager where
alias (NetworkManager _ _) = "networkmanager"
rate (NetworkManager _ r) = r
run (NetworkManager (text, colorOn, colorOff) _) = do
instance Exec VPN where
alias (VPN _ _) = "vpn"
rate (VPN _ r) = r
run (VPN (text, colorOn, colorOff) _) = do
client <- connectSystem
reply <- callConnectionType client
disconnect client

View File

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