summaryrefslogtreecommitdiffstats
path: root/app/Main.hs
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2024-05-06 22:24:32 +0200
committerLibravatar Alexander Foremny <aforemny@posteo.de>2024-05-06 22:24:32 +0200
commit85b4be2d0d4ea2c70883f026d1a5bde6230f626e (patch)
tree1026f2d02bc73021740c2585845e5e9a45798479 /app/Main.hs
parentb61dcb6698ee7669655a833d3e8af37727d1c7d6 (diff)
feat: add `--spacing`
Diffstat (limited to 'app/Main.hs')
-rw-r--r--app/Main.hs19
1 files changed, 11 insertions, 8 deletions
diff --git a/app/Main.hs b/app/Main.hs
index 701646f..09f0d50 100644
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -28,15 +28,19 @@ import Ui qualified
import UnliftIO.STM
data Args = Args
- { icons :: Bool
+ { icons :: Bool,
+ spacing :: Int
}
args :: O.ParserInfo Args
-args = O.info (Args <$> iconsArg) O.idm
+args = O.info (Args <$> iconsArg <*> spacingArg) O.idm
iconsArg :: O.Parser Bool
iconsArg = O.switch (O.long "icons")
+spacingArg :: O.Parser Int
+spacingArg = O.option O.auto (O.long "spacing" <> O.value 0)
+
data Env = Env
{ dpy :: X.Display,
win :: X.Window,
@@ -45,7 +49,6 @@ data Env = Env
wwidth :: Int,
wheight :: Int,
wleft :: Int,
- wtop :: Int,
gc :: X.GC,
pixm :: X.Pixmap,
fnt :: X.XftFont,
@@ -152,8 +155,8 @@ createWindow args = do
swidth = fi (X.displayWidth dpy scrn)
sheight = fi (X.displayHeight dpy scrn)
wwidth = swidth - 16
- wleft = 8
- wtop = 8
+ wspac = args.spacing
+ wleft = wspac
fnt <- X.xftFontOpen dpy scr "IosevkaTerm Nerd Font:size=14"
wheight <- X.xftfont_height fnt
cmap <- X.createColormap dpy root vis X.allocNone
@@ -162,7 +165,7 @@ createWindow args = do
X.set_border_pixel attr 0
X.set_background_pixel attr 0
X.set_override_redirect attr True
- X.createWindow dpy root (fi wleft) (fi wtop) (fi wwidth) (fi wheight) 0 dpth cls vis vmsk attr
+ X.createWindow dpy root (fi wleft) 0 (fi wwidth) (fi wheight) 0 dpth cls vis vmsk attr
atom <- X.internAtom dpy "ATOM" True
wmState <- X.internAtom dpy "_NET_WM_STATE" False
wmStateSticky <- X.internAtom dpy "_NET_WM_STATE_STICKY" False
@@ -179,9 +182,9 @@ createWindow args = do
[ fi wmWindowTypeDock
]
X.changeProperty32 dpy win wmStrut atom X.propModeReplace $
- [0, 0, fi wheight + 8, 0]
+ [0, 0, fi (wheight + wspac), 0]
X.changeProperty32 dpy win wmStrutPartial atom X.propModeReplace $
- [0, 0, fi wheight + 8, 0, 0, 0, 0, 0, fi wleft, fi wwidth, 0, 0]
+ [0, 0, fi (wheight + wspac), 0, 0, 0, 0, 0, fi wleft, fi wwidth, 0, 0]
pixm <- X.createPixmap dpy win (fi wwidth) (fi wheight) dpth
gc <- X.createGC dpy win
drw <- X.xftDrawCreate dpy pixm vis cmap