Skip to content

Instantly share code, notes, and snippets.

@anekos
Created August 18, 2018 01:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anekos/0406625b4730b3287af42e4dc37735f7 to your computer and use it in GitHub Desktop.
Save anekos/0406625b4730b3287af42e4dc37735f7 to your computer and use it in GitHub Desktop.
avoidStruts が上手くいかないので、強引にステータスバーの領域をあける
{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, DeriveDataTypeable, TypeSynonymInstances, PatternGuards #-}
module Anekos.Lib.MyGaps (
MyGaps(..),
myGaps
) where
import XMonad
import Graphics.X11 (Rectangle(..))
import XMonad.Layout.LayoutModifier
import XMonad.Util.Types (Direction2D(..))
import XMonad.Util.XUtils (fi)
import GHC.Word (Word32)
import Data.List (delete)
data MyGaps a = MyGaps () deriving (Read, Show)
instance LayoutModifier MyGaps Window where
modifyLayout g w r = runLayout w (applyGaps g r)
mainBarHeight, subBarHeight :: Word32
mainBarHeight = 20
subBarHeight = mainBarHeight
applyGaps :: MyGaps a -> Rectangle -> Rectangle
applyGaps _ (Rectangle x y 1920 1080) = Rectangle x y 1920 (1080 - mainBarHeight)
applyGaps _ (Rectangle x y 1080 1920) = Rectangle x (fi subBarHeight) 1080 (1920 - subBarHeight)
applyGaps _ r = r
myGaps :: LayoutClass l a => l a -> ModifiedLayout MyGaps l a
myGaps = ModifiedLayout $ MyGaps ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment