Cache la barre en fullscreen

This commit is contained in:
Martin Potier 2017-07-23 14:27:58 +02:00
parent b8a24863ed
commit 90eae7d744

View file

@ -1,9 +1,12 @@
import Codec.Binary.UTF8.String import Codec.Binary.UTF8.String
import Graphics.X11.ExtraTypes.XF86 import Graphics.X11.ExtraTypes.XF86
import LemonBar
import qualified Solarized as S
import qualified Data.Map as M import qualified Data.Map as M
import qualified XMonad.StackSet as W import qualified XMonad.StackSet as W
import System.Exit import System.Exit
import System.IO import System.IO
import Text.Printf
import XMonad import XMonad
import XMonad.Actions.CycleWS import XMonad.Actions.CycleWS
import XMonad.Config.Desktop import XMonad.Config.Desktop
@ -18,11 +21,11 @@ import XMonad.Prompt
import XMonad.Prompt.Shell(shellPrompt) import XMonad.Prompt.Shell(shellPrompt)
import XMonad.Util.Font import XMonad.Util.Font
import XMonad.Util.Loggers import XMonad.Util.Loggers
import XMonad.Util.Run -- import XMonad.Util.Run
main = do main = do
spawn bar spawn bar
xmonad $ ewmh desktopConfig xmonad $ docks $ ewmh desktopConfig
{ manageHook = myManageHook <+> manageDocks <+> manageHook defaultConfig { manageHook = myManageHook <+> manageDocks <+> manageHook defaultConfig
, layoutHook = myLayout , layoutHook = myLayout
, logHook = maLogouk , logHook = maLogouk
@ -34,33 +37,6 @@ main = do
, handleEventHook = handleEventHook defaultConfig <+> fullscreenEventHook , handleEventHook = handleEventHook defaultConfig <+> fullscreenEventHook
} }
cBase03 = "#002b36"
cBase02 = "#073642"
cBase01 = "#586e75"
cBase00 = "#657b83"
cBase0 = "#839496"
cBase1 = "#93a1a1"
cBase2 = "#eee8d5"
cBase3 = "#fdf6e3"
cYellow = "#b58900"
cOrange = "#cb4b16"
cRed = "#dc322f"
cMagenta = "#d33682"
cViolet = "#6c71c4"
cBlue = "#268bd2"
cCyan = "#3aa198"
cGreen = "#859900"
-- Micro lemonbar lib
lbTag t v = foldl (++) "" ["%{",t,v,"}"]
lbBlock t o c s = (lbTag t o) ++ s ++ (lbTag t c)
lbUnderline = lbBlock "" "+u" "-u"
lbOverline = lbBlock "" "+o" "-o"
lbFColor f = lbBlock "F" f "-"
lbBColor b = lbBlock "B" b "-"
lbUColor u = lbBlock "U" u "-"
lbColor f b = lbFColor f . lbBColor b . lbUColor f
sym "Tall" = "|" sym "Tall" = "|"
sym "Mirror Tall" = "-" sym "Mirror Tall" = "-"
sym "Full" = "F" sym "Full" = "F"
@ -68,12 +44,12 @@ sym _ = "◓"
maLogouk = dynamicLogWithPP $ defaultPP maLogouk = dynamicLogWithPP $ defaultPP
{ ppOutput = printToFile { ppOutput = printToFile
, ppCurrent = lbColor cOrange cBase03 . lbUnderline -- . sym , ppCurrent = LemonBar.color S.orange S.base03 . LemonBar.underline -- . sym
, ppVisible = lbColor cYellow cBase03 . lbUnderline -- . sym , ppVisible = LemonBar.color S.yellow S.base03 . LemonBar.underline -- . sym
, ppHidden = lbColor cBase2 cBase03 . lbUnderline -- . sym , ppHidden = LemonBar.color S.base2 S.base03 . LemonBar.underline -- . sym
, ppHiddenNoWindows = lbColor cBase01 cBase03 -- . sym , ppHiddenNoWindows = LemonBar.color S.base01 S.base03 -- . sym
, ppLayout = sym , ppLayout = sym
, ppTitle = lbFColor cViolet . shorten 70 , ppTitle = LemonBar.fColor S.violet . shorten 70
, ppSep = " " , ppSep = " "
} }
@ -109,29 +85,22 @@ myManageHook = composeAll
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- StatusBar. Call lemonbar -- StatusBar. Call lemonbar
-- start only if no already started --bar = "pgrep lemonbar > /dev/null || /home/eeva/prefix/bin/mkstatus.sh | /home/eeva/prefix/bin/bar"
bar = "pgrep lemonbar > /dev/null || /home/eeva/prefix/bin/mkstatus.sh | /home/eeva/prefix/bin/bar" bar = printf
"pkill lemonbar; /home/eeva/bin/mkstatus.sh | \
\ lemonbar -g 1920x24+0+0 \
\ -f '%s' \
\ -f '%s' \
\ -u %d -B '%s' -F '%s' -U '%s'"
--"tewi:style=Regular:antialias=false:autohint=false"
"Iosevka:size=12"
"DejaVu Sans Mono:size=12"
(2 :: Int)
S.base03
S.base0
S.violet
------------------------------------------------------------------------ myLayout = (avoidStruts $ tiled ||| Mirror tiled) ||| Full
-- StatusBar. Call dzen
--
-- callLeftDzen = "dzen2 -ta 'l' -fn '"
-- ++ dzenFont
-- ++ "' -w 500 -h '24' -fg '#657b83' -bg '#eee8d5' -e 'button3='"
-- ++ scrNum
--
-- callRightDzen = "conky | dzen2 -ta 'r' -fn '"
-- ++ dzenFont
-- ++ "' -x 500 -h '24' -fg '#657b83' -bg '#eee8d5' -e 'onnewinput=;button3='"
-- ++ scrNum
--
-- dzenFont = "Hack:size=10:antialias=true:bold"
-- scrNum = " -xs '1' -dock"
------------------------------------------------------------------------
-- Layouts. First three ones are struted for status bar and last one can hide
-- it.
--
myLayout = avoidStruts $ tiled ||| Mirror tiled ||| Full
where where
tiled = Tall 1 (3/100) (1/2) tiled = Tall 1 (3/100) (1/2)
@ -141,11 +110,11 @@ myXPConfig = defaultXPConfig {
promptBorderWidth = 5, promptBorderWidth = 5,
font = "xft:tewi:style=Regular:antialias=false:autohint=false", font = "xft:tewi:style=Regular:antialias=false:autohint=false",
height = 24, height = 24,
borderColor = cBase03, borderColor = S.base03,
bgHLight = cBase02, bgHLight = S.base02,
fgHLight = cMagenta, fgHLight = S.magenta,
bgColor = cBase03, bgColor = S.base03,
fgColor = cBase0, fgColor = S.base0,
defaultText = "" defaultText = ""
} }