1. 程式人生 > >Gnome3提取gnome-shell.css以及修改和編譯

Gnome3提取gnome-shell.css以及修改和編譯

GNOME 3.12 開始使用 GResource 二進位制資原始檔儲存 js/css/svg 等檔案,需使用 gresource 解壓,使用 glib-compile-resources 封裝。
將下面的程式碼儲存為一個sh指令碼檔案:

#!/bin/sh
gs="/usr/share/gnome-shell/gnome-shell-theme.gresource"
for r in `gresource list $gs`; do
    gresource extract $gs $r > ${r/#\/org\/gnome\/shell\/theme/.}
done

執行這個指令碼檔案就會在當前目錄下生成gnome-shell-theme.gresource

中編譯打包過了的資原始檔,其中就有gnome-shell.css
接著按你所需編輯gnome-shell.css檔案後,在終端執行以下命令:

//這是是下載gnome-shell-theme.gresource.xml資源規格檔案到當前目錄
wget https://raw.githubusercontent.com/GNOME/gnome-shell/master/data/gnome-shell-theme.gresource.xml

接著執行編譯命令來生成資原始檔:

glib-compile-resources gnome-shell-theme.gresource.xml

執行完畢後就回在當前目錄生成gnome-shell-theme.gresource

檔案了。
將生成的gnome-shell-theme.gresource 覆蓋系統預設的 /usr/share/gnome-shell/gnome-shell-theme.gresource 即可。

下面是隱藏標題欄的兩個方法:
方法1(arch是這樣),建立 ~/.config/gtk-3.0/gtk.css 檔案:

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

然後重啟Shell

開啟 ~/user/share/gnome-shell/extensions/maximus-two\@wilfinitlike.gmail.com/metadata.json 檔案增加:

3.14

+3.16