summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorArnout <arnouten@bzzt.net>2012-08-29 00:18:46 +0200
committerArnout <arnouten@bzzt.net>2012-08-29 00:18:46 +0200
commitcae6f2bc049d4b7ed57a7a18a828bc4ea35df4aa (patch)
tree3446d29a8ac0f3a7cbb41d921dbe998e1404d824
parente7cadcd8dee8c2e79e338f67cb27b675aba6bac5 (diff)
downloadxmobar-cae6f2bc049d4b7ed57a7a18a828bc4ea35df4aa.tar.gz
xmobar-cae6f2bc049d4b7ed57a7a18a828bc4ea35df4aa.tar.bz2
Add '-d' for dockapp mode
This makes xmobar work in windowmanagers that support _NET_WM_WINDOW_TYPE_DOCK but not _NET_WM_STRUT, such as Notion
-rw-r--r--readme.md1
-rw-r--r--src/Config.hs1
-rw-r--r--src/Main.hs3
-rw-r--r--src/Window.hs2
4 files changed, 7 insertions, 0 deletions
diff --git a/readme.md b/readme.md
index 2d18f67..8e9df21 100644
--- a/readme.md
+++ b/readme.md
@@ -299,6 +299,7 @@ xmobar --help):
-F fg color --fgcolor=fg color The foreground color. Default grey
-o --top Place xmobar at the top of the screen
-b --bottom Place xmobar at the bottom of the screen
+ -d --dock Place xmobar in the dock
-a alignsep --alignsep=alignsep Separators for left, center and right text
alignment. Default: '}{'
-s char --sepchar=char The character used to separate commands in
diff --git a/src/Config.hs b/src/Config.hs
index a6ad3e2..97040f1 100644
--- a/src/Config.hs
+++ b/src/Config.hs
@@ -77,6 +77,7 @@ data XPosition = Top
| BottomSize Align Int Int
| Static {xpos, ypos, width, height :: Int}
| OnScreen Int XPosition
+ | Docked
deriving ( Read, Eq )
data Align = L | R | C deriving ( Read, Eq )
diff --git a/src/Main.hs b/src/Main.hs
index 5ef5db6..aa6ac1d 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -100,6 +100,7 @@ data Opts = Help
| FgColor String
| T
| B
+ | D
| AlignSep String
| Commands String
| AddCommand String
@@ -117,6 +118,7 @@ options =
, Option ['F' ] ["fgcolor" ] (ReqArg FgColor "fg color" ) "The foreground color. Default grey"
, Option ['o' ] ["top" ] (NoArg T ) "Place xmobar at the top of the screen"
, Option ['b' ] ["bottom" ] (NoArg B ) "Place xmobar at the bottom of the screen"
+ , Option ['d' ] ["dock" ] (NoArg D ) "Place xmobar in the dock"
, Option ['a' ] ["alignsep" ] (ReqArg AlignSep "alignsep" ) "Separators for left, center and right text\nalignment. Default: '}{'"
, Option ['s' ] ["sepchar" ] (ReqArg SepChar "char" ) "The character used to separate commands in\nthe output template. Default '%'"
, Option ['t' ] ["template" ] (ReqArg Template "template" ) "The output template"
@@ -162,6 +164,7 @@ doOpts conf (o:oo) =
FgColor s -> doOpts (conf {fgColor = s }) oo
T -> doOpts (conf {position = Top }) oo
B -> doOpts (conf {position = Bottom}) oo
+ D -> doOpts (conf {position = Docked}) oo
AlignSep s -> doOpts (conf {alignSep = s }) oo
SepChar s -> doOpts (conf {sepChar = s }) oo
Template s -> doOpts (conf {template = s }) oo
diff --git a/src/Window.hs b/src/Window.hs
index 9b0c506..d08e445 100644
--- a/src/Window.hs
+++ b/src/Window.hs
@@ -66,6 +66,7 @@ setPosition p rs ht =
BottomSize a i ch -> (Rectangle (ax a i) (ny' ch) (nw i) (mh ch), True)
Static cx cy cw ch -> (Rectangle (fi cx) (fi cy) (fi cw) (fi ch), True)
OnScreen _ p'' -> setPosition p'' [scr] ht
+ Docked -> (Rectangle rx ry rw h, False)
where
(scr@(Rectangle rx ry rw rh), p') =
case p of OnScreen i x -> (fromMaybe (head rs) $ safeIndex i rs, x)
@@ -118,6 +119,7 @@ getStrutValues r@(Rectangle x y w h) p rwh =
BottomW _ _ -> [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, nx, nw]
BottomSize {} -> [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, nx, nw]
Static {} -> getStaticStrutValues p rwh
+ Docked -> getStaticStrutValues p rwh
where st = fi y + fi h
sb = rwh - fi y
nx = fi x