REF make common xmobar directory
This commit is contained in:
parent
9879d7f43c
commit
a9468ef3dd
|
@ -1,17 +1,18 @@
|
|||
import Xmobar.Plugins.Bluetooth
|
||||
import Xmobar.Plugins.IntelBacklight
|
||||
import Xmobar.Plugins.Screensaver
|
||||
import Xmobar.Plugins.VPN
|
||||
import Xmobar.Plugins.Bluetooth
|
||||
import Xmobar.Plugins.IntelBacklight
|
||||
import Xmobar.Plugins.Screensaver
|
||||
import Xmobar.Plugins.VPN
|
||||
|
||||
import qualified Theme as T
|
||||
import qualified Theme as T
|
||||
|
||||
import Data.List
|
||||
import Data.List
|
||||
|
||||
import Xmobar
|
||||
import XMonad (getXMonadDir)
|
||||
import Xmobar
|
||||
import Xmobar.Common
|
||||
import XMonad (getXMonadDir)
|
||||
|
||||
wrapColor :: String -> String -> String
|
||||
wrapColor c s = "<fc=" ++ c ++ ">" ++ s ++ "</fc>"
|
||||
-- wrapColor :: String -> String -> String
|
||||
-- wrapColor c s = "<fc=" ++ c ++ ">" ++ s ++ "</fc>"
|
||||
|
||||
sep :: String
|
||||
sep = wrapColor T.backdropFgColor " : "
|
||||
|
|
|
@ -54,13 +54,14 @@ import System.Process.Internals
|
|||
|
||||
import Text.Read (readMaybe)
|
||||
|
||||
import Xmobar.Common
|
||||
|
||||
import XMonad
|
||||
import XMonad.Actions.CopyWindow
|
||||
import XMonad.Actions.CycleWS
|
||||
import XMonad.Actions.DynamicWorkspaces
|
||||
import XMonad.Actions.PhysicalScreens
|
||||
import XMonad.Actions.Volume
|
||||
import XMonad.Hooks.DynamicLog
|
||||
import XMonad.Hooks.EwmhDesktops
|
||||
import XMonad.Hooks.ManageDocks
|
||||
import XMonad.Hooks.ManageHelpers
|
||||
|
@ -170,17 +171,17 @@ myWindowSetXinerama
|
|||
W.StackSet String (layout a1) a2 ScreenId ScreenDetail -> String
|
||||
myWindowSetXinerama ws = wsString ++ sep ++ layout
|
||||
where
|
||||
wsString = xmobarColor T.backdropFgColor "" $ onscreen ++ offscreen'
|
||||
wsString = wrapColorBg T.backdropFgColor "" $ onscreen ++ offscreen'
|
||||
offscreen' = if null offscreen then "" else " " ++ offscreen
|
||||
sep = xmobarColor T.backdropFgColor "" " : "
|
||||
onscreen = xmobarColor hilightFgColor hilightBgColor
|
||||
$ wrap " " " "
|
||||
sep = wrapColorBg T.backdropFgColor "" " : "
|
||||
onscreen = wrapColorBg hilightFgColor hilightBgColor
|
||||
$ (\s -> " " ++ s ++ " ")
|
||||
$ unwords
|
||||
$ map (fmtTags . W.tag . W.workspace)
|
||||
. sortBy compareXCoord
|
||||
$ W.current ws : W.visible ws
|
||||
fmtTags t = if t == W.currentTag ws
|
||||
then xmobarColor T.fgColor hilightBgColor t
|
||||
then wrapColorBg T.fgColor hilightBgColor t
|
||||
else t
|
||||
offscreen = unwords
|
||||
$ map W.tag
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
module Xmobar.Common where
|
||||
|
||||
import XMonad.Hooks.DynamicLog (xmobarColor)
|
||||
|
||||
wrapColor :: String -> String -> String
|
||||
wrapColor fg = wrapColorBg fg ""
|
||||
|
||||
wrapColorBg :: String -> String -> String -> String
|
||||
wrapColorBg = xmobarColor
|
|
@ -3,10 +3,11 @@
|
|||
|
||||
module Xmobar.Plugins.Bluetooth where
|
||||
|
||||
import DBus
|
||||
import DBus.Client
|
||||
import DBus
|
||||
import DBus.Client
|
||||
|
||||
import Xmobar
|
||||
import Xmobar
|
||||
import Xmobar.Common
|
||||
|
||||
data Bluetooth = Bluetooth (String, String, String) Int
|
||||
deriving (Read, Show)
|
||||
|
@ -30,6 +31,5 @@ instance Exec Bluetooth where
|
|||
Right r -> fromVariant r
|
||||
Left _ -> Nothing
|
||||
fmtState = \case
|
||||
Just s -> wrapColor text $ if s then colorOn else colorOff
|
||||
Just s -> wrapColor (if s then colorOn else colorOff) text
|
||||
Nothing -> "N/A"
|
||||
wrapColor s c = "<fc=" ++ c ++ ">" ++ s ++ "</fc>"
|
||||
|
|
|
@ -2,14 +2,15 @@
|
|||
|
||||
module Xmobar.Plugins.Screensaver where
|
||||
|
||||
import Control.Concurrent
|
||||
import Control.Monad
|
||||
import Control.Concurrent
|
||||
import Control.Monad
|
||||
|
||||
import DBus.Screensaver
|
||||
import DBus.Screensaver
|
||||
|
||||
import Xmobar
|
||||
import Xmobar
|
||||
import Xmobar.Common
|
||||
|
||||
data Screensaver = Screensaver (String, String, String)
|
||||
newtype Screensaver = Screensaver (String, String, String)
|
||||
deriving (Read, Show)
|
||||
|
||||
instance Exec Screensaver where
|
||||
|
@ -20,7 +21,6 @@ instance Exec Screensaver where
|
|||
forever (threadDelay 5000000)
|
||||
where
|
||||
fmtState = \case
|
||||
Just s -> wrapColor text $ if s then colorOn else colorOff
|
||||
Just s -> wrapColor (if s then colorOn else colorOff) text
|
||||
Nothing -> "N/A"
|
||||
wrapColor s c = "<fc=" ++ c ++ ">" ++ s ++ "</fc>"
|
||||
|
||||
|
|
|
@ -3,10 +3,11 @@
|
|||
|
||||
module Xmobar.Plugins.VPN where
|
||||
|
||||
import DBus
|
||||
import DBus.Client
|
||||
import DBus
|
||||
import DBus.Client
|
||||
|
||||
import Xmobar
|
||||
import Xmobar
|
||||
import Xmobar.Common
|
||||
|
||||
data VPN = VPN (String, String, String) Int
|
||||
deriving (Read, Show)
|
||||
|
@ -30,6 +31,5 @@ instance Exec VPN where
|
|||
Right r -> (fromVariant r :: Maybe String)
|
||||
Left _ -> Nothing
|
||||
fmtState = \case
|
||||
Just s -> wrapColor text $ if s == "vpn" then colorOn else colorOff
|
||||
Just s -> wrapColor (if s == "vpn" then colorOn else colorOff) text
|
||||
Nothing -> "N/A"
|
||||
wrapColor s c = "<fc=" ++ c ++ ">" ++ s ++ "</fc>"
|
||||
|
|
|
@ -15,6 +15,7 @@ library
|
|||
, DBus.IntelBacklight
|
||||
, DBus.Internal
|
||||
, DBus.Screensaver
|
||||
, Xmobar.Common
|
||||
, Xmobar.Plugins.Bluetooth
|
||||
, Xmobar.Plugins.IntelBacklight
|
||||
, Xmobar.Plugins.Screensaver
|
||||
|
|
Loading…
Reference in New Issue