diff options
Diffstat (limited to 'src/Internal')
| -rw-r--r-- | src/Internal/Keys.hs | 4 | ||||
| -rw-r--r-- | src/Internal/Layout.hs | 50 | ||||
| -rw-r--r-- | src/Internal/LayoutDraw.hs | 3 |
3 files changed, 47 insertions, 10 deletions
diff --git a/src/Internal/Keys.hs b/src/Internal/Keys.hs index ab6eab6..cf7846d 100644 --- a/src/Internal/Keys.hs +++ b/src/Internal/Keys.hs @@ -1,6 +1,7 @@ {-# LANGUAGE RankNTypes #-} module Internal.Keys where +import XMonad.Layout.MosaicAlt import Graphics.X11.ExtraTypes.XorgDefault import System.Process import XMonad.Util.Ungrab @@ -84,6 +85,7 @@ newKeys markContext = , ((modm .|. shiftMask, xK_h), windows W.swapUp) , ((modm .|. shiftMask, xK_l), windows W.swapDown) , ((modm , xK_f), sendMessage FlipLayout) + , ((modm .|. shiftMask, xK_f), sendMessage HFlipLayout) , ((modm , xK_Return), windows W.swapMaster) , ((modm, xK_j), sendMessage Shrink) , ((modm, xK_k), sendMessage Expand) @@ -92,6 +94,8 @@ newKeys markContext = , ((modm .|. mod1Mask, xK_s), (void $ spawn "sudo systemctl suspend && xsecurelock")) , ((modm .|. shiftMask, xK_c), kill) , ((modm .|. shiftMask, xK_t), withFocused $ windows . W.sink) + , ((modm, xK_comma), withFocused $ sendMessage . shrinkWindowAlt) + , ((modm, xK_period), withFocused $ sendMessage . expandWindowAlt) , ((mod4Mask, xK_BackSpace), (void $ spawn "xterm")) , ((modm, xK_BackSpace), (void $ spawn "pkill -SIGUSR1 xmobar")) , ((modm, xK_t), (void $ spawn (terminal config))) diff --git a/src/Internal/Layout.hs b/src/Internal/Layout.hs index aa3df1a..853a885 100644 --- a/src/Internal/Layout.hs +++ b/src/Internal/Layout.hs @@ -12,23 +12,27 @@ import XMonad.Layout.Spiral import XMonad.Layout.ThreeColumns import XMonad.Layout.Grid import XMonad.Layout.Dishes +import XMonad.Layout.MosaicAlt import XMonad.Layout import XMonad.Layout.LayoutModifier import XMonad import XMonad.Core +import qualified Data.Map as M import qualified XMonad.StackSet as W myLayout = ModifiedLayout (Zoomable False 0.05 0.05) $ ModifiedLayout (Flippable False) $ - spacingRaw True (Border 5 5 5 5) True (Border 5 5 5 5) True $ avoidStruts $ - spiral (6/7) ||| - Tall 1 (3/100) (1/2) ||| - ThreeCol 1 (3/100) (1/2) ||| - Full ||| - Grid ||| - Dishes 2 (1/6) + ModifiedLayout (HFlippable False) $ + spacingRaw True (Border 5 5 5 5) True (Border 5 5 5 5) True $ avoidStruts $ + spiral (6/7) ||| + Tall 1 (3/100) (1/2) ||| + ThreeCol 1 (3/100) (1/2) ||| + Full ||| + Grid ||| + Dishes 2 (1/6) ||| + (MosaicAlt M.empty :: MosaicAlt Window) data ResizeZoom = ShrinkZoom | ExpandZoom deriving (Typeable) @@ -37,8 +41,13 @@ instance Message ResizeZoom where data Flippable a = Flippable Bool -- True if flipped deriving (Show, Read) +data HFlippable a = HFlippable Bool -- True if flipped + deriving (Show, Read) + data FlipLayout = FlipLayout deriving (Typeable) +data HFlipLayout = HFlipLayout deriving (Typeable) + data Zoomable a = Zoomable Bool Float Float -- True if zooming in on the focused window. deriving (Show, Read) @@ -47,15 +56,18 @@ data ToggleZoom = ToggleZoom instance Message FlipLayout where +instance Message HFlipLayout where + instance Message ToggleZoom where instance (Eq a) => LayoutModifier Flippable a where - pureModifier (Flippable flip) (Rectangle _ _ sw _) stack returned = + pureModifier (Flippable flip) (Rectangle sx _ sw _) stack returned = if flip then (map (second doFlip) returned, Nothing) else (returned, Nothing) where - doFlip (Rectangle x y w h) = Rectangle (fromIntegral sw - x - fromIntegral w) y w h + doFlip (Rectangle x y w h) = + Rectangle ((sx + fromIntegral sw) - x - fromIntegral w + sx) y w h pureMess (Flippable flip) message = case fromMessage message of @@ -67,6 +79,26 @@ instance (Eq a) => LayoutModifier Flippable a where if flipped then descr ++ " Flipped" else descr + +instance (Eq a) => LayoutModifier HFlippable a where + pureModifier (HFlippable flip) (Rectangle _ sy _ sh) stack returned = + if flip + then (map (second doFlip) returned, Nothing) + else (returned, Nothing) + where + doFlip (Rectangle x y w h) = + Rectangle x ((sy + fromIntegral sh) - y - fromIntegral h + sy) w h + + pureMess (HFlippable flip) message = + case fromMessage message of + Just HFlipLayout -> Just (HFlippable (not flip)) + Nothing -> Nothing + + modifyDescription (HFlippable flipped) underlying = + let descr = description underlying in + if flipped + then descr ++ " HFlipped" + else descr instance (Eq a) => LayoutModifier Zoomable a where diff --git a/src/Internal/LayoutDraw.hs b/src/Internal/LayoutDraw.hs index 4bb069a..7c69a08 100644 --- a/src/Internal/LayoutDraw.hs +++ b/src/Internal/LayoutDraw.hs @@ -10,6 +10,7 @@ import Control.Monad import Graphics.Rendering.Cairo import Graphics.Rendering.Cairo.Internal (Render(runRender)) import Graphics.Rendering.Cairo.Types (Cairo(Cairo)) +import Control.Concurrent (threadDelay) import System.FilePath import XMonad @@ -85,7 +86,7 @@ drawPng l = do surfaceWriteToPNG surface filepathPng - (!_) <- readProcessWithExitCode + out <- readProcessWithExitCode "/usr/bin/convert" [filepathPng, filepathXpm] "" |