当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 2 篇帖子 ] 
作者 内容
1 楼 
 文章标题 : 释放gnome-shell.css的方法
帖子发表于 : 2015-09-19 21:33 

注册: 2015-08-29 21:05
帖子: 81
送出感谢: 0 次
接收感谢: 4
gnome-shell的字体设置分成几部分,通过gnome-tweak-tool和dconf-editor两个工具,大多数字体的自定义都能实现。这两个工具不能调整系统字体,也就是dash、topbar及其子应用的字体,这两处的字体是由gnome-shell.css决定的。从gnome 3.12起,gnome-shell.css文件,连同系统默认图标,被集成编译为gnome-shell-theme.gresource文件,这是个二进制文件,无法直接编辑,只有先从gnome-shell-theme.gresource中释放出gnome-shell.css,才能重新设定系统字体。如何将需要的文件释放出来?诀窍是使用shell脚本。
打开终端,新建一个目录:
代码:
mkdir ~/gnomecss

将以下代码复制到文本编辑器,并保存,名称随意,为清晰起见,这里就采用默认路径,即/home/用户名,保存为shellcss.sh。fedora的解释器与debian的不同,fedora的解释器是sh,debian的是bash,所以,对于fedora,需将第一行的bash改为sh。
代码:
#!/bin/bash
workdir=~/gnomecss
gst=/usr/share/gnome-shell/gnome-shell-theme.gresource
mkdir ~/gnomecss/theme
for r in $(gresource list $gst); do
gresource extract $gst $r >$workdir${r/#\/org\/gnome\/shell/}
done

然后赋予shellcss.sh文件可执行权限:
代码:
chmod +x shellcss.sh

紧接着运行:
代码:
./shellcss.sh

该命令会在gnomecss目录下创建theme文件夹,并将包括gnome-shell.css等在内的所有文件释放到该文件夹。关闭当前终端,打开nautilus,浏览到~/gnomecss/theme,将下面的代码复制到文本编辑器,并与theme文件夹中的文件进行核对,文件与代码中列出的名称必须一一对应,删除代码中多余的文件名,添加未列出的文件名,就绪以后,将文件命名为gnome-shell-theme.gresource.xml,保存在theme文件夹。
代码:
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
  <gresource prefix="/org/gnome/shell/theme">
    <file>calendar-arrow-left.svg</file>
    <file>calendar-arrow-right.svg</file>
    <file>calendar-today.svg</file>
    <file>checkbox-focused.svg</file>
    <file>checkbox-off-focused.svg</file>
    <file>checkbox-off.svg</file>
    <file>checkbox.svg</file>
    <file>close-window.svg</file>
    <file>close.svg</file>
    <file>corner-ripple-ltr.png</file>
    <file>corner-ripple-rtl.png</file>
    <file>dash-placeholder.svg</file>
    <file>filter-selected-ltr.svg</file>
    <file>filter-selected-rtl.svg</file>
    <file>gnome-shell.css</file>
    <file>gnome-shell-high-contrast.css</file>
    <file>logged-in-indicator.svg</file>
    <file>more-results.svg</file>
    <file>no-events.svg</file>
    <file>no-notifications.svg</file>
    <file>noise-texture.png</file>
    <file>page-indicator-active.svg</file>
    <file>page-indicator-inactive.svg</file>
    <file>page-indicator-checked.svg</file>
    <file>page-indicator-hover.svg</file>
    <file>process-working.svg</file>
    <file>running-indicator.svg</file>
    <file>source-button-border.svg</file>
    <file>summary-counter.svg</file>
    <file>toggle-off-us.svg</file>
    <file>toggle-off-intl.svg</file>
    <file>toggle-on-us.svg</file>
    <file>toggle-on-intl.svg</file>
    <file>ws-switch-arrow-up.png</file>
    <file>ws-switch-arrow-down.png</file>
  </gresource>
</gresources>

在nautilus中双击gnome-shell.css文件,弹出文本编辑器后,找到字体设置的描述进行更改,并保存。
代码:
/* GLOBALS */
stage {
  font-family: Cantarell, Sans-Serif;
  font-size: 11pt;
  color: #eeeeec; }

在theme文件夹空白处单击鼠标右键,在弹出的右键菜单中选择“打开终端“,输入下面的命令,将修改好的文件打包为新的gnome-shell-theme.gresource文件。
代码:
glib-compile-resources gnome-shell-theme.gresource.xml

备份系统自带的gnome-shell-theme.gresource文件,之后用新生成的替换系统自带的:
代码:
sudo cp /usr/share/gnome-shell/gnome-shell-theme.gresource /usr/share/gnome-shell/gnome-shell-theme.gresource.save
sudo cp gnome-shell-theme.gresource /usr/share/gnome-shell/gnome-shell-theme.gresource
cd ..
mv theme /path/to/save
cd ..
rm shellcss.sh
rm -r gnomecss

最后按alt+f2,输入r回车,重新启动窗口管理器,这下应该能看到变更的效果了。



_________________
评价: 7.41% lord007vickycq
 
页首
 用户资料  
 
2 楼 
 文章标题 : Re: 释放gnome-shell.css的方法
帖子发表于 : 2015-10-12 22:45 
头像

注册: 2007-03-15 16:58
帖子: 2802
地址: 湖北武汉
送出感谢: 2
接收感谢: 4
学习了 :em11


_________________
引用:


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 2 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 1 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译