标题栏/CSD

标题栏/CSD

在 Gnome 3.18 中,可以通过更改 css 来更改所有窗口的标题栏~/.config/gtk-3.0/gtk.css高度降低 gnome 3 / gtk+ 3 中标题栏的高度

.header-bar.default-decoration {
        padding-top: 0px;
        padding-bottom: 0px;
    }

.header-bar.default-decoration .button.titlebutton {
    padding-top: 0px;
    padding-bottom: 0px;
}

/* No line below the title bar */
.ssd .titlebar {
    border-width: 0;
    box-shadow: none;
}

在 Gnome 3.20 中,这似乎不再适用于带有标题栏/CSD(标题栏中的 gnome 特定按钮)的窗口,例如 Nautilus(文件)、设置、照片、联系人等。该调整仍然降低了标题栏高度对于其他应用程序,例如 gnome-terminal 和 gVim。如何降低 gnome 程序(例如 Gnome 3.20 中的 Nautilus)中标题栏的高度?


更新

我也尝试过什么是在此 Reddit 主题中建议。我都试过了window.ssd.ssd没有骰子。 这有效,请参阅我发布的答案以了解更多详细信息

window.ssd headerbar.titlebar {
    padding-top: 1px;
    padding-bottom: 1px;
    min-height: 0;
}

window.ssd headerbar.titlebar button.titlebutton {
    padding-top: 1px;
    padding-bottom: 1px;
    min-height: 0;
}

/* shrink headebars */
headerbar {
    min-height: 38px;
    padding-left: 2px; /* same as childrens vertical margins for nicer proportions */
    padding-right: 2px;
}

headerbar entry,
headerbar spinbutton,
headerbar button,
headerbar separator {
    margin-top: 2px; /* same as headerbar side padding for nicer proportions */
    margin-bottom: 2px;
}

/* shrink ssd titlebars */
.default-decoration {
    min-height: 0; /* let the entry and button drive the titlebar size */ 
    padding: 2px
}

.default-decoration .titlebutton {
    min-height: 26px; /* tweak these two props to reduce button size */
    min-width: 26px;
}

答案1

  1. 创建文件 ~/.config/gtk-3.0/gtk.css (添加以下 CSS )
  2. 那么你需要重新加载 gnome-shell:ALT + F2并输入r

我能够使用以下 CSS 缩小 Gnome 3.20 上的应用程序标题栏:

headerbar entry,
headerbar spinbutton,
headerbar button,
headerbar separator {
    margin-top: 0px; /* same as headerbar side padding for nicer proportions */
    margin-bottom: 0px;
}

headerbar {
    min-height: 24px;
    padding-left: 2px; /* same as childrens vertical margins for nicer proportions */
    padding-right: 2px;
    margin: 0px; /* same as headerbar side padding for nicer proportions */
    padding: 0px;
  }

答案2

注意:如果您使用的是 PopOS,顶部栏菜单中有一个“删除窗口标题”选项,该选项也可以控制平铺。这就是我目前使用的方法,它非常适合仅删除多余的非 CSD 标题栏。

标题栏/CSD

实际上,我通过reddit找到并发布在上面的一段代码,即

headerbar entry,
headerbar spinbutton,
headerbar button,
headerbar separator {
    margin-top: 2px; /* same as headerbar side padding for nicer proportions */
    margin-bottom: 2px;
}

修改标题栏/CSD。但效果并不是立竿见影的。即使重新加载 gnome,您也可能需要关闭所有窗口,等待一段时间,或者注销并重新登录才能看到效果。

修改以下内容时,我仍然没有看到标题栏有任何差异。

headerbar {
    min-height: 38px;
    padding-left: 2px; /* same as children's vertical margins for nicer proportions */
    padding-right: 2px;
}

标准标题栏

普通窗口标题栏的两个部分按预期工作。

.default-decoration {
    min-height: 0; /* let the entry and button drive the titlebar size */
    padding: 2px
}

.default-decoration .titlebutton {
    min-height: 26px; /* tweak these two props to reduce button size */
    min-width: 26px;
}

标题栏边框

如果您运行默认的 adwaita 主题,您可以使用以下命令删除标题栏边框。从https://bbs.archlinux.org/viewtopic.php?id=211102

window.ssd headerbar.titlebar {
  border: none;
  background-image: linear-gradient(to bottom,
  shade(@theme_bg_color, 1.05),
  shade(@theme_bg_color, 0.99));
  box-shadow: inset 0 1px shade(@theme_bg_color, 1.4);
}

答案3

~/.config/gtk-3.0/gtk.css使用以下内容更新您的:

/* shrink headerbars (don't forget semicolons after each property) */
headerbar {
    min-height: 0px;
    padding-left: 2px; /* same as childrens vertical margins for nicer proportions */
    padding-right: 2px;
    background-color: #2d2d2d;
}

headerbar entry,
headerbar spinbutton,
headerbar button,
headerbar separator {
    margin-top: 0px; /* same as headerbar side padding for nicer proportions */
    margin-bottom: 0px;
}

/* shrink ssd titlebars */
.default-decoration {
    min-height: 0; /* let the entry and button drive the titlebar size */
    padding: 0px;
    background-color: #2d2d2d;
}

.default-decoration .titlebutton {
    min-height: 0px; /* tweak these two props to reduce button size */
    min-width: 0px;
}

window.ssd headerbar.titlebar {
    padding-top: 3px;
    padding-bottom: 3px;
    min-height: 0;
}

window.ssd headerbar.titlebar button.titlebutton {
    padding-top: 3px;
    padding-bottom:3px;
    min-height: 0;
}

答案4

在我的 Ubuntu 20.04 上,我使用这个自定义主题修复(Yaru 标准主题上的 Gnome 3.20)并且运行良好。

headerbar.default-decoration {
    min-height: 18px;
    margin: 0px 0px 0px 0px;
    padding: 2px 2px 2px 2px;
}

headerbar.default-decoration button.titlebutton {
    min-height: 16px;
    min-width: 16px;
    margin: 0px 0px 0px 0px;
    padding: 2px 2px 2px 2px;
}


headerbar  {
    min-height: 18px;
    margin: 0px 0px 0px 0px;
    padding: 2px 2px 2px 2px;
}


headerbar entry, headerbar spinbutton, headerbar button, headerbar switch, headerbar separator {
    margin: 0px 0px 0px 0px;
    padding: 0px 0px 0px 0px;
}


headerbar button.titlebutton.minimize, headerbar button.titlebutton.maximize, headerbar button.titlebutton.close {
    min-height: 16px;
    min-width: 16px;
    margin: 0px 0px 0px 0px;
    padding: 2px 2px 2px 2px;
}

相关内容