aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2018-05-04 13:07:56 +0200
committerAdrian Kummerlaender2018-05-04 13:07:56 +0200
commit980d05929791e5f9920294f937cbeaa5e6bd31ba (patch)
tree35e00ee9f23e9bb150cc9189980cfc5af375a1f3
parent62ef3c1979392bd264026240e73c6623f4da96dd (diff)
downloadnixos_home-980d05929791e5f9920294f937cbeaa5e6bd31ba.tar
nixos_home-980d05929791e5f9920294f937cbeaa5e6bd31ba.tar.gz
nixos_home-980d05929791e5f9920294f937cbeaa5e6bd31ba.tar.bz2
nixos_home-980d05929791e5f9920294f937cbeaa5e6bd31ba.tar.lz
nixos_home-980d05929791e5f9920294f937cbeaa5e6bd31ba.tar.xz
nixos_home-980d05929791e5f9920294f937cbeaa5e6bd31ba.tar.zst
nixos_home-980d05929791e5f9920294f937cbeaa5e6bd31ba.zip
Hide screen boundary facing window borders
-rw-r--r--conf/xmonad/xmonad.hs51
1 files changed, 31 insertions, 20 deletions
diff --git a/conf/xmonad/xmonad.hs b/conf/xmonad/xmonad.hs
index 86b92e6..bea9bd2 100644
--- a/conf/xmonad/xmonad.hs
+++ b/conf/xmonad/xmonad.hs
@@ -48,13 +48,13 @@ availableLayouts = smartBorders $ tabs ||| tilesLM ||| tilesRM ||| tilesTM ||| t
windowBringerDmenuConfig = def { menuCommand = "rofi"
, menuArgs = [ "-p", "win", "-dmenu", "-i" ] }
-floatRectFull = RationalRect 0 0 1 1
-floatRectLarge = RationalRect (1/20) (1/20) (18/20) (18/20)
-floatRectCenter = RationalRect (1/6) (1/6) (2/3) (2/3)
-floatRectBottom = RationalRect (1/20) (1/3) (18/20) (2/3)
-floatRectTop = RationalRect (1/20) 0 (18/20) (2/3)
-floatRectLeft = RationalRect 0 (1/20) (1/2) (18/20)
-floatRectRight = RationalRect (1/2) (1/20) (1/2) (18/20)
+floatRectFull = hideScreenBorder $ RationalRect 0 0 1 1
+floatRectLarge = hideScreenBorder $ RationalRect (1/20) (1/20) (18/20) (18/20)
+floatRectCenter = hideScreenBorder $ RationalRect (1/6) (1/6) (2/3) (2/3)
+floatRectBottom = hideScreenBorder $ RationalRect (1/20) (1/3) (18/20) (2/3)
+floatRectTop = hideScreenBorder $ RationalRect (1/20) 0 (18/20) (2/3)
+floatRectLeft = hideScreenBorder $ RationalRect 0 (1/20) (1/2) (18/20)
+floatRectRight = hideScreenBorder $ RationalRect (1/2) (1/20) (1/2) (18/20)
scratchpads = [ NS "terminal" "kitty --class=scratchterm" (className =? "scratchterm")
(customFloating floatRectTop)
@@ -63,7 +63,7 @@ scratchpads = [ NS "terminal" "kitty --class=scratchterm" (className =? "scratch
, NS "documentation" "zeal" (className =? "Zeal")
(customFloating floatRectLarge)
, NS "messaging" "telegram-desktop" (className =? "TelegramDesktop")
- (customFloating floatRectTop) ]
+ (customFloating floatRectRight) ]
keybindings =
-- xmonad session control
@@ -106,14 +106,10 @@ keybindings =
, ("M-w f" , withFocused $ placeFloating floatRectFull )
, ("M-w S-c" , withFocused $ placeFloating floatRectLarge)
, ("M-w c" , withFocused $ placeFloating floatRectCenter)
- , ("M-w j" , do withFocused $ placeFloating floatRectBottom
- withFocused $ keysMoveWindow (0, 7))
- , ("M-w k" , do withFocused $ placeFloating floatRectTop
- withFocused $ keysMoveWindow (0,-6))
- , ("M-w h" , do withFocused $ placeFloating floatRectLeft
- withFocused $ keysMoveWindow (-6,0))
- , ("M-w l" , do withFocused $ placeFloating floatRectRight
- withFocused $ keysMoveWindow ( 7,0))
+ , ("M-w j" , withFocused $ placeFloating floatRectBottom)
+ , ("M-w k" , withFocused $ placeFloating floatRectTop)
+ , ("M-w h" , withFocused $ placeFloating floatRectLeft)
+ , ("M-w l" , withFocused $ placeFloating floatRectRight)
-- system control
, ("M-c <Up>" , spawn "amixer sset Master 10%+")
, ("M-c <Down>" , spawn "amixer sset Master 10%-")
@@ -149,11 +145,19 @@ nonEmptyWS = WSIs $ return (\w -> nonNSP w && nonEmpty w)
placeFloating :: RationalRect -> Window -> X ()
placeFloating rect = windows . (flip XMonad.StackSet.float $ rect)
+windowSize w = do
+ r <- withDisplay $ (\d -> io $ getWindowAttributes d w)
+ return (fromIntegral $ wa_width r, fromIntegral $ wa_height r)
+
+withCurrentScreen f = withWindowSet $ \ws -> f (current ws)
+withCurrentScreenRect f = withCurrentScreen $ \s -> f (screenRect (screenDetail s))
+
+screenResolution = withCurrentScreenRect $ \r -> return (rect_width r, rect_height r)
+
isNotFullscreen :: Query Bool
-isNotFullscreen = ask >>= (\w -> liftX $ do wa <- withDisplay $ (\d -> io $ getWindowAttributes d w)
- sr <- fmap (screenRect . screenDetail . current) (gets windowset)
- return $ not (fromIntegral (wa_width wa) == rect_width sr &&
- fromIntegral (wa_height wa) == rect_height sr))
+isNotFullscreen = ask >>= (\w -> liftX $ do (ww, wh) <- windowSize w
+ (sw, sh) <- screenResolution
+ return $ not (ww == sw && wh == sh))
isFloat :: Query Bool
isFloat = ask >>= (\w -> liftX $ withWindowSet $ \ws -> return $ (M.member w (floating ws)))
@@ -167,3 +171,10 @@ setWindowBorder' color width window = do
~(Just pixel) <- io $ initColor d color
io $ setWindowBorder d window pixel
io $ setWindowBorderWidth d window width
+
+-- ugly hack to hide window border at screen boundary
+hideScreenBorder :: RationalRect -> RationalRect
+hideScreenBorder (RationalRect x0 y0 w h) = RationalRect (x0-(bw/sw)) (y0-(bw/sh)) (w+((2*bw)/sw)) (h+((2*bw+1)/sh))
+ where bw = 6
+ sw = 1280
+ sh = 1024