linux - 在 i3wm 中禁用 float 窗口的边框

标签 linux window archlinux

<分区>

我可以通过启用 hide_edge_borders both 来禁用非 float 窗口的边框。但是当我打开像 lxterminal 这样的 float 窗口时,我得到了 this borders to change window size . 我该怎么做才能禁用此边框,但不能禁用窗口的标题?

最佳答案

hide_edge_borders仅隐藏与屏幕边缘相邻且仅在平铺层上的边框。这与受影响窗口的边框设置无关。

您可以使用 new_window 设置窗口的初始边框样式和 new_float设置:

new_window none
new_window normal|pixel [<px>]
new_float none
new_float normal|pixel [<px>]

设置none意味着没有边框和没有标题栏。 normal默认情况下,给出一个标题栏和两个像素宽的边框。可以使用可选的 <px> 更改边框宽度设置,0 的设置保留标题栏但删除边框。 pixel (也有可选的宽度)在所有边上产生边框,但没有标题栏。

new_window为从平铺层开始的窗口设置样式,i3 - 几乎是每个窗口。 new_float为开始为 float 窗口的窗口设置样式,这些窗口主要是对话框窗口。如果稍后更改 float 状态,这些设置不会影响边框样式。后来还包括像

这样的设置
for_window [class="SOMECLASS"] floating enable

因为它们也仅在窗口创建后才完成。

这给你留下了一些可能的解决方案


  • 如果您不需要任何边框,解决方案非常简单。你可以设置:

    new_window normal 0
    new_float normal 0
    

    这会删除任何边框,包括平铺窗口之间的边框。然后您也可以删除 hide_edge_borders设置,因为不再需要它。


  • 如果您想保持平铺层当前的状态 - 窗口之间的边缘,而不是屏幕边缘 - 它会变得更加棘手。如上所述,new_float设置只影响最初 float 的窗口,但不会影响后来 - 自动或手动 - 设置为 float 的窗口。最简单的解决方案可能是使用单独的命令来 float 和取消 float 窗口(而不是仅仅切换)并扩展任何 for_window设置也可以根据需要删除/添加边框。例如:

    # 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
    

    注意事项:

    • 为 float 和非 float 命令设置变量有助于提高可读性和可维护性。为边界类型设置变量没有多大意义,因为变量不是递归计算的。因此,不可能为边框样式设置变量并在 float /非 float 命令的变量设置中重复使用它。
    • 我用了bindcode因为我无法得到 Super+Control+Spacebindsym 的组合在我的系统上。当然,这只是一个示例,您的系统可能不需要它。

  • 如果您想保留当前的布局,但又想用一个快捷方式切换窗口的 float 状态,您将不得不使用i3 IPC interface .使用 IPC,您可以检查聚焦窗口的当前状态。然后你可以 float /取消 float 窗口并更改它的边框样式。

关于linux - 在 i3wm 中禁用 float 窗口的边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34395076/

相关文章:

java - JPanels、JFrames 和 Windows,天哪!

javascript - 更改窗口位置 Jquery

java - Libgdx 锁定宽高比到一定范围

archlinux - 删除除某些包之外的包组

linux - 从 OpenGL 2.1 更新到 OpenGL 3.2

linux - ATA Trusted commands-如何设置libata allow_tpm

linux - 如何使用 bash 脚本备份目录

archlinux - archLinux (libcrypt.so.1) 上缺少 realvnc-vnc-viewer 的依赖项

linux - 如何为从 Apache 启动的子进程禁用 SELinux?

android - android目录末尾有奇怪的字符