willardthor
willardthor

Reputation: 291

Remove border from fullscreen floating windows only (XMonad configuration)

I would like to

  1. remove borders (only) from floating windows covering the full screen (like mplayer), and
  2. use a different border color (normalBorderColor) when there is only one window in a workspace.

Currently, I am using smartBorders from XMonad.Layout.NoBorders to remove the border from mplayer, and to remove the border of a window when that window is the only window in a workspace. However, when I switch between two workspaces which both have a single non-floating window (regardless of mode (tall/mirror/full)), then I see the window (in the workspace I am changing into) "jump" a bit, as its border is drawn, and then removed a brief moment thereafter (the effect is more visible if you set your borderWidth to a large number).

The relevant part of my ~/.xmonad/xmonad.hs is given below.

import XMonad.Hooks.ManageDocks
import XMonad.Layout.NoBorders
myLayout = tiled ||| Mirror tiled ||| Full
  where
    tiled   = Tall 1 (3/100) (3/5)                                 
main = xmonad $ defaultConfig 
                 { layoutHook = avoidStruts $ smartBorders $ myLayout 
                 , borderWidth = 4
                 , normalBorderColor  = "#000000" -- black
                 , focusedBorderColor = "#ff3f3f" -- reddish
                 }

Do you folks know how I achieve this effect? (is part 2. even possible?) Suggestions and pointers to extensions and/or existing configurations that achieve a similar effect greatly appreciated.

Upvotes: 15

Views: 7176

Answers (2)

pmf
pmf

Reputation: 36068

Regarding part 2: Version 0.17.0 of the xmonad-contrib package introduced the new XMonad.Layout.VoidBorders layout modifier which removes borders just like XMonad.Layout.NoBorders does, but kind of permanently (the windows will retain their zero-width borders even when moved off of a VoidBorders-controlled workspace). This side-effect may or may not be a deal-breaker but it solves the "jumping" windows issue when switching workspaces.

Upvotes: 1

willardthor
willardthor

Reputation: 291

I solved pt. 1 using the Ambiguity constructor named OnlyFloat from XMonad.Layout.NoBorders.

import XMonad.Hooks.ManageDocks
import XMonad.Layout.NoBorders
myLayout = tiled ||| Mirror tiled ||| Full
  where
    tiled   = Tall 1 (3/100) (3/5)                                 
main = xmonad $ defaultConfig 
                 { layoutHook = lessBorders OnlyFloat $ avoidStruts $ myLayout 
                 , borderWidth = 4
                 , normalBorderColor  = "#000000" -- black
                 , focusedBorderColor = "#ff3f3f" -- reddish
                 }

I haven't addressed pt. 2. Furthermore, when I switch into a workspace, the border color of the focused window "flickers", since initially, the window is not focused (an thus its border is colored as per normalBorderColor), whereafter the window becomes focused (and thus its border gets the color focusedBorderColor).

Upvotes: 9

Related Questions