Remove border from fullscreen floating windows only (XMonad configuration)

北慕城南 提交于 2019-12-05 15:57:07

问题


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.


回答1:


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).



来源:https://stackoverflow.com/questions/13498979/remove-border-from-fullscreen-floating-windows-only-xmonad-configuration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!