该笔记将记录:在 GNOME 中,如何设置窗口(比如,添加边框、设置按钮等等),以及常见问题的解决方案。
“XXXXXXX” is Ready
https://askubuntu.com/questions/80969/
https://superuser.com/questions/644850/
Gnome shows a “Window is ready” notification instead of popping up a new window to prevent apps from stealing focus without your direct interaction. This is an accessibility feature for visually impaired users, as it informs them a new window has been opened even if it doesn’t automatically gain focus. The notification appears because the application tried to raise its window, but GNOME’s heuristics blocked the request to maintain the current user context.
gsettings set org.gnome.desktop.wm.preferences auto-raise ‘true’
gsettings set org.gnome.desktop.wm.preferences focus-new-windows ‘strict’
GNOME extension: “Steal My Focus” by sstent
样式 | 调整窗口标题字体
gnome-tweak-tool
Fonts > Window title font
dconf-editor
org > gnome > desktop > wm > preferences :: titlebar-font
样式 | 为窗口添加边框
gnome terminal – How to enable/add window borders in 17.10 & 18.04? – Ask Ubuntu
Overlapping dark terminals have no visible border · Issue #287 · numixproject/numix-gtk-theme
问题描述
在 GNOME 3 中(GNOME Shell 3.30.2),窗口是没有边框的。当窗口背景色与桌面背景色相同时,无法区分二者,影响使用。比如,我们需要使用鼠标调整窗口边框,但是由于与背景色相同,导致我们很难无法找到窗口边框;
解决方案
修改 ~/.config/gtk-3.0/gtk.css 文件,添加如下配置:
decoration {
border: 1px solid gray;
background: gray;
}
重启桌面(Alt+F2 => r => ENTER),然后窗口就可以显示边框:
[WIP] 针对特定应用设置边框
# 02/15/2021 目前,1)可以通过 GTK_THEME 为特定应用使用特定主题,比如 GTK_THEME=Red-Dot-Black-GTK ./demo-app 命令在启动 demo-app 应用时,使用 Red-Dot-Black-GTK 主题。但是在主题文件中,我们不知道该如何设置边框,否则可以使用该方法。2)还有一种方案是,在应用指定特定的 gtk.css 文件,但是我们不知道是否支持该特性(至少以前在 GNOME 2 中是可行的)
样式 | 修改窗口按钮的显示(窗口管理器)
dconf editor the window-button settings function no useable
dconf-editor
org -> gnome -> desktop -> wm -> preferences -> button-layout
Q:有时候修改可能不会生效,即使重启也不生效
A:可能的原因是那个按钮属于「GTK3」,并不属于「窗口管理器」。我们上面的动作是修改了「窗口管理器」的按钮。如果要修改 GTK3 的按钮,可以参考「「GTK+3」- 杂记」一文;
样式 | 修改标题栏按钮
How do I hide/disable close buttons for GNOME windows?
方法很多,我们是通过修改 GSettings 的 org.gnome.desktop.wm.preferences button-layout 属性,将其设置为 appmenu 即可。
行为 | 当打开应用时,弹出窗口,而非显示 “xxx” is ready 提示
问题描述
例如,当我们打开 Calibre 中的 PDF 文件时,调起 PDF Master 来显示文件,然后 PDF Master 窗口显示在最前端。但是,当 PDF Master 支持多标签,当我们切换到 Calibre 应用,然后再次从中打开其他 PDF 文件时,无法显示 PDF Master 窗口,而是显示 “xxx” is ready 提示;
原因分析
WIP
解决方案
# 08/31/23 暂时未找到解决方案;
行为 | 窗口焦点跟随鼠标,但是不要升起窗口
Tweaks / Windows / Rasie Windows When Focused
行为 | 启动应用 | 最大化窗口
GNOME-44: howto maximize window(s) on startup? – Fedora Discussion
Maximized by default by aXe1 | https://extensions.gnome.org/extension/1193/maximized-by-default/
One Window Wonderland by jqno | https://extensions.gnome.org/extension/5696/one-window-wonderland/
https://github.com/jqno/gnome-one-window-wonderland/
Devilspie | https://help.ubuntu.com/community/Devilspie
Devilspie2 | a window matching utility | https://github.com/dsalt/devilspie2
https://www.nongnu.org/devilspie2/
https://www.linux-magazine.com/Issues/2017/205/Tutorial-Devilspie2
应用
窗口焦点,设置其跟随鼠标
How do I set focus follows mouse in Ubuntu 17.10 and later with GNOME 3?
在 Linux 中,桌面有个特性:即使窗口没有获得焦点,鼠标依旧可以滚动。这会让我们误以为窗口获得焦点,而后我们需要输入某些文本时,由于窗口并没有获得焦点,此时我们输入的内容就到了原有焦点的窗口上,有可能毁坏原有内容。
设置窗口焦点跟随鼠标,鼠标走到哪个窗口,哪个窗口就获得焦点。
1)安装 TWEAK TOOLS 工具:apt install gnome-tweak-tool
2)gnome-tweak-tool => Windows => Windows Focus => Focus on Hover
注意事项:不同的版本采用名称不同,比如某些发行版叫 Sloppy 而不是 Focus on Hover,但是含义是相同的。