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