summaryrefslogtreecommitdiffstats
path: root/tv/5pkgs/haskell
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2023-02-03 03:05:17 +0100
committertv <tv@krebsco.de>2023-02-03 03:05:17 +0100
commit3e4b31e65303581444d01156935c5cef48048079 (patch)
tree195101a5fab24ea3bfb996593c3b0f434766c02b /tv/5pkgs/haskell
parent51561857821558f62003b7a792286a1a7a1a11bf (diff)
tv xmonad: allow settings gaps
Diffstat (limited to 'tv/5pkgs/haskell')
-rw-r--r--tv/5pkgs/haskell/xmonad-tv/src/main.hs12
1 files changed, 10 insertions, 2 deletions
diff --git a/tv/5pkgs/haskell/xmonad-tv/src/main.hs b/tv/5pkgs/haskell/xmonad-tv/src/main.hs
index eb61bd5cf..118f2da46 100644
--- a/tv/5pkgs/haskell/xmonad-tv/src/main.hs
+++ b/tv/5pkgs/haskell/xmonad-tv/src/main.hs
@@ -23,6 +23,7 @@ import System.Posix.Process (executeFile)
import XMonad.Actions.DynamicWorkspaces ( addWorkspacePrompt, renameWorkspace
, removeEmptyWorkspace)
import XMonad.Actions.CycleWS (toggleWS)
+import XMonad.Layout.Gaps (Direction2D(U,R,D,L), gaps)
import XMonad.Layout.NoBorders ( smartBorders )
import XMonad.Layout.ResizableTile (ResizableTall(ResizableTall))
import XMonad.Layout.ResizableTile (MirrorResize(MirrorExpand,MirrorShrink))
@@ -58,13 +59,19 @@ main = getArgs >>= \case
readEnv :: Data.Aeson.FromJSON b => String -> IO b
readEnv name =
- Data.Maybe.fromJust
+ readEnv' (error $ "could not get environment variable: " <> name) name
+
+readEnv' :: Data.Aeson.FromJSON b => b -> String -> IO b
+readEnv' defaultValue name =
+ Data.Maybe.fromMaybe defaultValue
. Data.Aeson.decodeStrict'
. Data.ByteString.Char8.pack
- <$> getEnv name
+ . Data.Maybe.fromMaybe mempty
+ <$> lookupEnv name
mainNoArgs :: IO ()
mainNoArgs = do
+ myScreenGaps <- readEnv' [] "XMONAD_SCREEN_GAPS" :: IO [Int]
myScreenWidth <- readEnv "XMONAD_SCREEN_WIDTH" :: IO Dimension
myTermFont <- getEnv "XMONAD_TERM_FONT"
myTermFontWidth <- readEnv "XMONAD_TERM_FONT_WIDTH" :: IO Dimension
@@ -89,6 +96,7 @@ mainNoArgs = do
, workspaces = workspaces0
, layoutHook =
refocusLastLayoutHook $
+ gaps (zip [U,R,D,L] myScreenGaps) $
smartBorders $
ResizableTall
1