系统配置记录

Linux 系统配置记录,主要是 Arch Linux。

GNOME 主题、插件定制化参考另一篇专门的文章zsh 定制参考这篇

突然记起来应该把系统配置过程中遇到的问题都记下来,以免日后又要重新找解决方案……

Shortcut

  • Switch applications: Super+Tab (Alternatetab 插件会将这个选项也改成 Switch windows)
  • Switch windows: Alt+Tab
  • 我也不知道 Ctrl+Alt+Up/Down 切换 Workspace 是在哪配的了

Custom Shortcut

  • Terminal: Super+T gnome-terminal 80x24
  • Konsole: Super+K konsole --new-tab 最开始图它的分屏功能。但不知道从什么时候起,它启动时永远是最大化的,加上字体太瞎眼了,已经弃用。
  • TakeScreentshot: Ctrl+Alt+A flameshot gui

Alternative Character Key

Tweaks 有一个选项可以关闭它,但貌似某次更新后失效了。我被迫将其改成 Menu Key 来避免快捷键失效。

Fcitx XML Schema Problem

报错 Error parsing key “overrides” in schema “org.gnome.settings-daemon.plugins.xsettings” as specified in override file

一般此报错会在滚动更新的时候遇到。

glib-compile-schemas /usr/share/glib-2.0/schemas/ # 参数为配置所在的文件夹

如果配置有误,会给出详细的文件名。

例如,我遇到的错误配置是:

[org.gnome.settings-daemon.plugins.xsettings]
overrides={Gtk/IMModule:<fcitx>}

将其改为:

[org.gnome.settings-daemon.plugins.xsettings]
overrides={'Gtk/IMModule':<'fcitx'>}

Vimrc

.vim/vimrc:

unlet! skip_defaults_vim
source $VIMRUNTIME/defaults.vim

set ts=4 sw=4
set expandtab

" shift tab
inoremap <S-Tab> <C-d>

inoremap <C-Del> <C-o>dw
inoremap <C-D> <C-o>dw
inoremap <C-BS> <C-o>dB
inoremap <C-B> <C-o>db

:filetype plugin on
:syntax on

Pacman 配置

/etc/pacman.conf:

[multilib]
Include = /etc/pacman.d/mirrorlist

[archlinuxcn]
SigLevel = Never
Include = /etc/pacman.d/cn-mirrorlist

Arch Linux

/etc/pacman.d/mirrorlist:

Server = http://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch
Server = http://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch

Server = http://mirrors.zju.edu.cn/archlinux/$repo/os/$arch

/etc/pacman.d/cn-mirrorlist:

Server= https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/$arch

Server= https://mirrors.ustc.edu.cn/archlinuxcn/$arch

Server= https://mirrors.zju.edu.cn/archlinuxcn/$arch

Manjaro

/etc/pacman.d/mirrorlist:

Server = https://mirrors.ustc.edu.cn/manjaro/stable/$repo/$arch
Server = http://mirrors.tuna.tsinghua.edu.cn/manjaro/stable/$repo/$arch
Server = https://mirrors.zju.edu.cn/manjaro/stable/$repo/$arch

Fonts

pacman -Ss ttf | grep '\[installed' | awk '{print $1}':

Expand code
extra/gnu-free-fonts
extra/noto-fonts
extra/sdl2_ttf
extra/ttf-dejavu
community/ttf-arphic-uming
community/ttf-baekmuk
community/ttf-fira-code
community/ttf-jetbrains-mono
community/ttf-liberation
community/ttf-opensans
community/ttf-roboto
community/ttf-sarasa-gothic
archlinuxcn/ttf-monaco

pacman -Ss font | grep '\[installed' | grep -v "ttf" | grep -v "lib" | grep -v "xorg" | awk '{print $1}':

Expand code
extra/adobe-source-code-pro-fonts
extra/cantarell-fonts
extra/fluidsynth
extra/fontconfig
extra/freetype2
extra/gnome-font-viewer
extra/gnu-free-fonts
extra/gsfonts
extra/noto-fonts
extra/noto-fonts-cjk
extra/noto-fonts-emoji
extra/woff2
community/adobe-source-han-sans-cn-fonts
community/adobe-source-han-sans-jp-fonts
community/adobe-source-han-sans-kr-fonts
community/adobe-source-han-serif-cn-fonts
community/adobe-source-han-serif-jp-fonts
community/adobe-source-han-serif-kr-fonts
community/powerline-fonts
community/wqy-microhei
community/wqy-zenhei
archlinuxcn/adobe-source-han-mono-cn-fonts
archlinuxcn/adobe-source-han-mono-jp-fonts
archlinuxcn/adobe-source-han-mono-kr-fonts
archlinuxcn/nerd-fonts-hack
archlinuxcn/nerd-fonts-jetbrains-mono
archlinuxcn/nerd-fonts-meslo-lg

cat .config/fontconfig/fonts.conf:

并不保证这份配置正确,因为我也不懂 fontconfig。

Expand code
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>

  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
  </its:rules>

  <description>Sarasa Font Config</description>

  <!-- Font directory list -->

  <dir>/usr/share/fonts</dir>
  <dir>/usr/local/share/fonts</dir>
  <dir prefix="xdg">fonts</dir>
  <!-- the following element will be removed in the future -->
  <dir>~/.fonts</dir>


  <!-- 关闭内嵌点阵字体 -->
  <match target="font">
    <edit name="embeddedbitmap" mode="assign">
      <bool>false</bool>
    </edit>
  </match>

  <!-- 英文默认字体使用 Roboto 和 Noto Serif ,终端使用 DejaVu Sans Mono. -->
  <match>
    <test qual="any" name="family">
      <string>serif</string>
    </test>
    <edit name="family" mode="prepend" binding="strong">
      <string>Noto Serif</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>sans-serif</string>
    </test>
    <edit name="family" mode="prepend" binding="strong">
      <string>Roboto</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>monospace</string>
    </test>
    <edit name="family" mode="prepend" binding="strong">
      <string>DejaVu Sans Mono</string>
    </edit>
  </match>

  <!-- 中文默认字体使用思源黑体和思源宋体,不使用 Noto Sans CJK SC 是因为这个字体会在特定情况下显示片假字. -->

  <!-- <match>
    <edit mode="prepend" name="family">
    <string>Noto Sans</string>
    </edit>
  </match> -->
  <match>
    <test name="lang" compare="contains">
      <string>zh</string>
    </test>
    <test name="family">
      <string>serif</string>
    </test>
    <edit name="family" mode="prepend">
      <!-- <string>Microsoft YaHei</string> -->
      <string>Source Han Serif CN</string> 
    </edit>
  </match>
  <match>
    <test name="lang" compare="contains">
      <string>zh</string>
    </test>
    <test name="family">
      <string>sans-serif</string>
    </test>
    <edit name="family" mode="prepend">
      <string>Source Han Sans CN</string>
      <!-- <string>Microsoft YaHei</string> -->
    </edit>
  </match>
  <match>
    <test name="lang" compare="contains">
      <string>zh</string>
    </test>
    <test name="family">
      <string>monospace</string>
    </test>
    <edit name="family" mode="prepend">
      <!-- <string>Noto Sans Mono CJK SC</string> -->
      <string>WenQuanYi Zen Hei Mono</string>
    </edit>
  </match>
  
  <!--Windows & Linux Chinese fonts. -->
  <!--把所有常见的中文字体映射到思源黑体和思源宋体,这样当这些字体未安装时会使用思源黑体和思源宋体.
  解决特定程序指定使用某字体,并且在字体不存在情况下不会使用fallback字体导致中文显示不正常的情况. -->
  
  <!-- <match target="pattern">
    <test qual="any" name="family">
      <string>WenQuanYi Zen Hei</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>Source Han Sans CN</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>WenQuanYi Micro Hei</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>Source Han Sans CN</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>WenQuanYi Micro Hei Light</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>Source Han Sans CN</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>Microsoft YaHei</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>Source Han Sans CN</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>SimHei</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>Source Han Sans CN</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>SimSun</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>Source Han Serif CN</string>
    </edit>
  </match> -->
  <!-- <match target="pattern">
    <test qual="any" name="family">
      <string>SimSun-18030</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>Source Han Serif CN</string>
    </edit>
  </match> -->

  
  <!--
  Load local system customization file
  -->
  <include ignore_missing="yes">conf.d</include>

  <!-- Font cache directory list -->

  <cachedir>/var/cache/fontconfig</cachedir>
  <cachedir prefix="xdg">fontconfig</cachedir>
  <!-- the following element will be removed in the future -->
  <cachedir>~/.fontconfig</cachedir>

  <config>
    <!--
    Rescan configuration every 30 seconds when FcFontSetList is called
    -->
    <rescan>
      <int>30</int>
    </rescan>
  </config>

  <!-- 全局开启 Hint 和 Antialias -->

  <match target="font">
    <edit name="autohint">
      <bool>true</bool>
    </edit>
    <edit name="hintstyle">
      <const>hintfull</const>
    </edit>
    <edit name="antialias">
      <bool>true</bool>
    </edit>
  </match>

  <!-- 禁用 Noto Color Emoji 的 Antialias,因为这个字体在同时开启 Hint 和 Antialias 时会显示空白、 -->

  <match target="font">
    <test name="family">
      <string>Noto Color Emoji</string>
    </test>
    <edit name="antialias">
      <bool>false</bool>
    </edit>
  </match>

  <!--
  Synthetic emboldening for fonts that do not have bold face available
  -->

  <match target="font">
    <!-- check to see if the font is just regular -->
    <test name="weight" compare="less_eq">
      <const>medium</const>
    </test>
    <!-- check to see if the pattern requests bold -->
    <test target="pattern" name="weight" compare="more">
      <const>medium</const>
    </test>
    <!--
    set the embolden flag
    needed for applications using cairo, e.g. gucharmap, gedit, ...
    -->
    <edit name="embolden" mode="assign">
      <bool>true</bool>
    </edit>
    <!--
    set weight to bold
    needed for applications using Xft directly, e.g. Firefox, ...
    -->
    <edit name="weight" mode="assign">
      <const>bold</const>
    </edit>
  </match>


  <match target="font">
    <test target="pattern" name="lang" compare="contains">
      <string>zh</string>
    </test>
    <test target="pattern" name="lang" compare="contains">
      <string>ja</string>
    </test>
    <test target="pattern" name="lang" compare="contains">
      <string>ko</string>
    </test>
    <edit name="spacing">
      <const>proportional</const>
    </edit>
    <edit name="globaladvance">
      <bool>false</bool>
    </edit>
  </match>


  <match target="pattern">
    <test name="family">
      <string>SimSun</string>
    </test>
    <test name="family">
      <string>SimSun-18030</string>
    </test>
    <test name="family">
      <string>AR PL ShanHeiSun Uni</string>
    </test>
    <test name="family">
      <string>AR PL New Sung</string>
    </test>
    <test name="family">
      <string>MingLiU</string>
    </test>
    <test name="family">
      <string>PMingLiU</string>
    </test>
    <edit binding="strong" mode="prepend" name="family">
      <string>Tahoma</string>
      <string>Arial</string>
      <string>Verdana</string>
      <string>DejaVu Sans</string>
      <string>Bitstream Vera Sans</string>
    </edit>
  </match>

  <match target="font">
    <test name="family" qual="any">
      <string>AR PL ShanHeiSun Uni</string>
    </test>
    <test name="family" qual="any">
      <string>AR PL New Sung</string>
    </test>
    <test name="family" qual="any">
      <string>SimSun</string>
    </test>
    <test name="family" qual="any">
      <string>NSimSun</string>
    </test>
    <test name="family" qual="any">
      <string>MingLiu</string>
    </test>
    <test name="family" qual="any">
      <string>PMingLiu</string>
    </test>
    <test name="pixelsize" compare="less_eq">
      <double>12</double>
    </test>
    <edit name="pixelsize" mode="assign">
      <double>12</double>
    </edit>
  </match>

  <!--
  <match target="font" >
    <test compare="eq" name="family" qual="any" >
      <string>宋体</string>
      <string>新宋体</string>
      <string>SimSun</string>
      <string>NSimSun</string>
      <string>宋体-18030</string>
      <string>新宋体-18030</string>
      <string>SimSun-18030</string>
      <string>NSimSun-18030</string>
      <string>AR PL ShanHeiSun Uni</string>
      <string>AR PL New Sung</string>
      <string>MingLiU</string>
      <string>PMingLiU</string>
    </test>
    <test compare="less_eq" name="pixelsize" >
      <double>16</double>
    </test>
    <edit mode="assign" name="hinting" >
      <bool>true</bool>
    </edit>
    <edit mode="assign" name="autohint" >
      <bool>false</bool>
    </edit>
    <edit name="antialias">
      <bool>false</bool>
    </edit>
    <edit mode="assign" name="hintstyle" >
      <const>hintslight</const>
    </edit>
  </match>
  -->

  <!--
  <match target="font">
    <test name="family">
      <string>Andale Mono</string>
      <string>Arial</string>
      <string>Comic Sans MS</string>
      <string>Georgia</string>
      <string>Impact</string>
      <string>Trebuchet MS</string>
      <string>Verdana</string>
      <string>Courier New</string>
      <string>Times New Roman</string>
      <string>Tahoma</string>
      <string>Webdings</string>
      <string>Albany AMT</string>
      <string>Thorndale AMT</string>
      <string>Cumberland AMT</string>
      <string>Andale Sans</string>
      <string>Andy MT</string>
      <string>Bell MT</string>
      <string>Monotype Sorts</string>
    </test>
    <test name="pixelsize" compare="less_eq">
      <double>16</double>
    </test>
    <edit name="autohint">
      <bool>false</bool>
    </edit>
    <edit name="antialias">
      <bool>false</bool>
    </edit>
  </match>
  -->

  <alias>
    <family>serif</family>
    <prefer>
      <family>Nimbus Roman No9 L</family>
      <family>Thorndale AMT</family>
      <family>DejaVu Serif</family>
      <family>Bitstream Vera Serif</family>
      <family>Times New Roman</family>
      <family>Luxi Serif</family>
      <family>Likhan</family>
      <family>FreeSerif</family>
      <family>Times</family>
      <!-- <family>Microsoft YaHei</family> -->
      <family>SimSun</family>
      <family>SimSun-18030</family>
      <family>MingLiU</family>
      <family>WenQuanYi Bitmap Song</family>
      <family>AR PL ShanHeiSun Uni</family>
      <family>AR PL New Sung</family>
      <family>FZSongTi</family>
      <family>FZMingTiB</family>
      <family>AR PL SungtiL GB</family>
      <family>AR PL Mingti2L Big5</family>
      <family>Kochi Mincho</family>
      <family>UnBatang</family>
      <family>Baekmuk Batang</family>
      <family>HanyiSong</family>
      <family>ZYSong18030</family>
    </prefer>
  </alias>
  <alias>
    <family>sans-serif</family>
    <prefer>
      <family>DejaVu Sans</family>
      <family>Bitstream Vera Sans</family>
      <family>Luxi Sans</family>
      <family>Arial</family>
      <family>Verdana</family>
      <family>Albany AMT</family>
      <family>Nimbus Sans L</family>
      <family>FreeSans</family>
      <family>Helvetica</family>
      <family>Source Han Sans CN</family>
      <family>Microsoft YaHei</family>
      <family>SimSun</family>
      <family>SimSun-18030</family>
      <family>MingLiU</family>
      <family>WenQuanYi Bitmap Song</family>
      <family>AR PL ShanHeiSun Uni</family>
      <family>AR PL New Sung</family>
      <family>FZSongTi</family>
      <family>FZMingTiB</family>
      <family>AR PL SungtiL GB</family>
      <family>AR PL Mingti2L Big5</family>
      <family>Kochi Gothic</family>
      <family>UnDotum</family>
      <family>Baekmuk Gulim</family>
      <family>Baekmuk Dotum</family>
    </prefer>
  </alias>
  <alias>
    <family>monospace</family>
    <prefer>
      <family>DejaVu Sans Mono</family>
      <family>Bitstream Vera Sans Mono</family>
      <family>Luxi Mono</family>
      <family>Courier New</family>
      <family>Cumberland AMT</family>
      <family>Nimbus Mono L</family>
      <family>Andale Mono</family>
      <family>FreeMono</family>
      <family>NSimSun</family>
      <family>NSimSun-18030</family>
      <family>PMingLiU</family>
      <family>WenQuanYi Bitmap Song</family>
      <family>AR PL ShanHeiSun Uni</family>
      <family>AR PL New Sung</family>
      <family>FZSongTi</family>
      <family>FZMingTiB</family>
      <family>AR PL SungtiL GB</family>
      <family>AR PL Mingti2L Big5</family>
      <family>Kochi Gothic</family>
      <family>UnDotum</family>
      <family>Baekmuk Gulim</family>
      <family>Baekmuk Dotum</family>
      <family>HanyiSong</family>
      <family>ZYSong18030</family>
      <family>WenQuanYi Zen Hei Mono</family>
    </prefer>
  </alias>

</fontconfig>

Can’t Unlock GNOME

参考这篇文章

Bash inputrc/bind, make life easier

Zsh version.

Run cat $HOME/.inputrc:

"C-h": backward-kill-word
"\e[3;5~": kill-word

Run cat /etc/inputrc:

Expand code
# do not bell on tab-completion
#set bell-style none

set meta-flag on
set input-meta on
set convert-meta off
set output-meta on

$if mode=emacs

# for linux console and RH/Debian xterm
"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": beginning-of-history
"\e[6~": end-of-history
"\e[7~": beginning-of-line
"\e[3~": delete-char
"\e[2~": quoted-insert
"\e[5C": forward-word
"\e[5D": backward-word
"\e\e[C": forward-word
"\e\e[D": backward-word
"\e[1;5C": forward-word
"\e[1;5D": backward-word

# for rxvt
"\e[8~": end-of-line

# for non RH/Debian xterm, can't hurt for RH/DEbian xterm
"\eOH": beginning-of-line
"\eOF": end-of-line

# for freebsd console
"\e[H": beginning-of-line
"\e[F": end-of-line
$endif

Run bind -p | grep -v 'not bound' | grep -v 'self-insert' | grep -v 'do-lowercase-version' | grep -v 'digit-argument':

Expand code
"\C-g": abort
"\C-x\C-g": abort
"\e\C-g": abort
"\C-j": accept-line
"\C-m": accept-line
"\C-b": backward-char
"\eOD": backward-char
"\e[D": backward-char
"\C-h": backward-delete-char
"\C-?": backward-delete-char
"\C-x\C-?": backward-kill-line
"\e\C-h": backward-kill-word
"\e\C-?": backward-kill-word
"C-h": backward-kill-word
"\e[1;3D": backward-word
"\e[1;5D": backward-word
"\eb": backward-word
"\e<": beginning-of-history
"\C-a": beginning-of-line
"\eOH": beginning-of-line
"\e[H": beginning-of-line
"\e[200~": bracketed-paste-begin
"\C-xe": call-last-kbd-macro
"\ec": capitalize-word
"\C-]": character-search
"\e\C-]": character-search-backward
"\C-l": clear-screen
"\C-i": complete
"\e\e": complete
"\e!": complete-command
"\e/": complete-filename
"\e@": complete-hostname
"\e{": complete-into-braces
"\e~": complete-username
"\e$": complete-variable
"\C-d": delete-char
"\e[3~": delete-char
"\e\\": delete-horizontal-space
"\C-x\C-v": display-shell-version
"\el": downcase-word
"\e\C-i": dynamic-complete-history
"\C-x\C-e": edit-and-execute-command
"\C-x)": end-kbd-macro
"\e>": end-of-history
"\C-e": end-of-line
"\eOF": end-of-line
"\e[F": end-of-line
"\C-x\C-x": exchange-point-and-mark
"\C-f": forward-char
"\eOC": forward-char
"\e[C": forward-char
"\C-s": forward-search-history
"\e[1;3C": forward-word
"\e[1;5C": forward-word
"\ef": forward-word
"\eg": glob-complete-word
"\C-x*": glob-expand-word
"\C-xg": glob-list-expansions
"\e^": history-expand-line
"\e#": insert-comment
"\e*": insert-completions
"\e.": insert-last-argument
"\e_": insert-last-argument
"\C-k": kill-line
"\e[3;5~": kill-word
"\ed": kill-word
"\C-n": next-history
"\eOB": next-history
"\e[B": next-history
"\en": non-incremental-forward-search-history
"\ep": non-incremental-reverse-search-history
"\C-o": operate-and-get-next
"\e[2~": overwrite-mode
"\C-x!": possible-command-completions
"\e=": possible-completions
"\e?": possible-completions
"\C-x/": possible-filename-completions
"\C-x@": possible-hostname-completions
"\C-x~": possible-username-completions
"\C-x$": possible-variable-completions
"\C-p": previous-history
"\eOA": previous-history
"\e[A": previous-history
"\C-q": quoted-insert
"\C-v": quoted-insert
"\C-x\C-r": re-read-init-file
"\C-r": reverse-search-history
"\e\C-r": revert-line
"\er": revert-line
"\C-@": set-mark
"\e ": set-mark
"\e\C-e": shell-expand-line
"\C-x(": start-kbd-macro
"\e&": tilde-expand
"\C-t": transpose-chars
"\et": transpose-words
"\C-x\C-u": undo
"\C-_": undo
"\C-u": unix-line-discard
"\C-w": unix-word-rubout
"\eu": upcase-word
"\C-y": yank
"\e.": yank-last-arg
"\e_": yank-last-arg
"\e\C-y": yank-nth-arg
"\ey": yank-pop