The Goal
Set no border for specific windows in Xmonad.
Concrete example: I'd like firefox and feh always have no border. I want to set this not only for specific layout (e.g., single window) or specific window mode like float.
Attempt A
The most straight forward idea I have is to add a line in manageHook, which supposes to handle window creation. So I put a line in my customized ManageHook:
className =? "firefox" --> ask >>= \w -> liftX $ withDisplay $ \d -> io $ setWindowBorderWidth d w 0 >> idHook
It compiles, but unfortunately nothing happens when I start firefox.
Then I try to debug it:
- Tested the following and it works (new firefox window is floated), which indicates my customized 
ManageHookworks, and my logic (modify the window followed byidHook) should be OK. 
className =? "firefox" --> ask >>= liftX . float >> idHook
Tested
setWindowBorderWidthfunction by tryingtoggleBorderin XMonad.Actions.NoBorders.toggleBorderdoes something similarly callingsetWindowBorderWidth. I used a key binding to invoketoggleBorderand it works. SosetWindowBorderWidthworks well during a Xmonad session after the window is created.Tested the following (found it here) but it doesn't work, same as my code (Attempt A).
className =? "firefox" --> ask >>= liftX . toggleBorder >> idHook
Attempt B
I find the hasBorder function in XMonad.Layout.NoBorders and also this answer, but I did not succeed.
If I only put className =? "firefox" --> hasBorder False in ManageHook but does not use layoutHook, nothing happens. I checked the source code of hasBorder and found it only broadcast a message but not set the border. I think I may need to invoke a layoutHook from XMonad.Layout.NoBorders to really set the border but I am not sure which one I should use. And I am also not sure if I need to specify any layout to use XMonad.Layout.NoBorders.
Questions
Does Xmonad set border after
ManageHookso my code in Attempt A is nullified?If Q1 is true, does it mean I can only set no border at
LayoutHook(likely usingXMonad.Layout.NoBorders) when the window is drawn on the screen?If Q2 is true, do I need to specify a layout and which
layoutHookI can use?