Disable borders from floating windows in i3wm
hide_edge_borders
hides only borders adjacent to the screen edges and only on the tiling layer. This is independent of the border settings of the affected windows.
You can set the initial border style for windows with the new_window
and new_float
settings:
new_window none
new_window normal|pixel [<px>]
new_float none
new_float normal|pixel [<px>]
The setting none
means no border and no title bar. normal
gives a title bar and borders which are two pixel wide by default. The border width can be changed with the optional <px>
setting, a setting of 0
keeps the title bar but removes the borders. pixel
(also with optional width) produces borders on all sides but without title bar.
new_window
sets the style for windows that start on the tiling layer, which - with i3 - is almost every window. new_float
sets the style for windows that start out as floating windows, which are mostly dialog windows. These settings do not affect the border style if the floating status is changed later. Later also includes settings like
for_window [class="SOMECLASS"] floating enable
as they are also done only after the window was already created.
This leaves you with a few possible solutions
-
If you do not need any borders the solution is quite simple. You can just set:
new_window normal 0 new_float normal 0
This removes any borders including between tiled windows. You may then also remove the
hide_edge_borders
setting, as it is then no longer needed.
-
If you want to keep the tiling layer as it is at the moment - edges between windows, but not on the screen edges - it gets trickier. As said above, the
new_float
setting only affects windows that are initially floating, but not those that are later - automatically or manually - set to be so. The simplest solution there probably would be to have separate commands for floating and un-floating a window (instead of just toggling) and extend anyfor_window
settings to also remove/add borders as needed. For example:# New tiling windows with title bar and borders new_window normal 2 # New floating windows with title bar and without borders new_float normal 0 # Hide borders on edges hide_edge_borders both # Set variables for floating and un-floating commands set $FLOAT floating enable, border normal 0 set $UNFLOAT floating disable, border normal 2 # Key bindings # Switch between tiling and floating layer (Super+Space) bindcode Mod4+65 focus mode_toggle # Put windows on floating layer and remove borders (Super+Shift+Space) bindcode Mod4+Shift+65 $FLOAT # Make windows on tiling layer and add borders (Super+Control+Space) bindcode Mod4+Control+65 $UNFLOAT # Auto-float some windows for_window [class="SomeClass"] $FLOAT for_window [title="ThisTitle"] $FLOAT # Auto-un-float some other windows for_window [class="SomeOtherClass" window_type="dialog"] $UNFLOAT for_window [title="ThatTitle"] $UNFLOAT
Notes:
- Setting variables for the float and un-float commands helps readability and maintainability. Setting variables for the border types does not make a lot of sense because variables are not evaluated recursively. So it is not possible to set a variable for a border style and reuse that in the setting of a variable for the float/un-float commands.
- I used
bindcode
because I could not get the combination Super+Control+Space withbindsym
on my system. Of course this is just an example and it may not be needed on your system anyway.
- If you want to keep the current layout but also want to be able to just toggle the floating state of a window with a single shortcut, you will have to make use of i3's IPC interface. Utilizing the IPC you can check for the current status of the focused window. Then you can float/un-float the window and change the border style it.
LavX64
Updated on August 21, 2022Comments
-
LavX64 almost 2 years
I can disable borders from not floating windows by enabling
hide_edge_borders both
. But when I open up a floating windows like lxterminal, i got this borders to change window size. What can i do to disable this borders, but not disabling title of a window? -
LavX64 over 8 yearsThanks. I've used
for_window [class="Lxterminal"] floating enable, border normal 0
And it works pretty well ^^