From 010c094a0cffeb5cc6a52da30d6aa58765ccf2ec Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Sun, 22 Mar 2020 17:17:57 -0400 Subject: [PATCH] ENH renamed network manager to vpn --- bin/xmobar.hs | 35 ++++++++++++------- .../Plugins/{NetworkManager.hs => VPN.hs} | 12 +++---- my-xmonad.cabal | 2 +- 3 files changed, 30 insertions(+), 19 deletions(-) rename lib/Xmobar/Plugins/{NetworkManager.hs => VPN.hs} (75%) diff --git a/bin/xmobar.hs b/bin/xmobar.hs index 1895c12..325ae06 100644 --- a/bin/xmobar.hs +++ b/bin/xmobar.hs @@ -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", "\x1f13d" - , "-n", wrapColor T.backdropFgColor "\x1f13d" - , "-C", "\x1f132" - , "-c", wrapColor T.backdropFgColor "\x1f132" + [ "-N", "\x1f13d" + , "-n", wrapColor T.backdropFgColor "\x1f13d" + , "-C", "\x1f132" + , "-c", wrapColor T.backdropFgColor "\x1f132" , "-s", "" , "-S", "" - , "-d", " " + , "-d", " " ] , Run $ Date "%Y-%m-%d %H:%M" "date" 10 , Run $ Screensaver ("\xf254", T.fgColor, T.backdropFgColor) - , Run $ Bluetooth ("\xf293", T.fgColor, T.backdropFgColor) 5 + , Run $ Bluetooth ("\xf293", T.fgColor, T.backdropFgColor) 5 , Run UnsafeStdinReader - , Run $ NetworkManager ("VPN", T.fgColor, T.backdropFgColor) 5 + , Run $ VPN ("\xf023", T.fgColor, T.backdropFgColor) 5 ] } diff --git a/lib/Xmobar/Plugins/NetworkManager.hs b/lib/Xmobar/Plugins/VPN.hs similarity index 75% rename from lib/Xmobar/Plugins/NetworkManager.hs rename to lib/Xmobar/Plugins/VPN.hs index 91b51e2..c518e32 100644 --- a/lib/Xmobar/Plugins/NetworkManager.hs +++ b/lib/Xmobar/Plugins/VPN.hs @@ -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 diff --git a/my-xmonad.cabal b/my-xmonad.cabal index 7481919..0082ced 100644 --- a/my-xmonad.cabal +++ b/my-xmonad.cabal @@ -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