欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

8.Manjaro配置优化

程序员文章站 2022-07-14 16:15:55
...

配置镜像源

镜像源列表: https://repo.manjaro.org/

1. 排列源并自动添加源

sudo  pacman-mirrors -i -c China -m rank  
# 在弹出的窗口中选择想要的镜像源。(结果会自动导入/etc/pacman.d/mirrorlist 配置文件中)
#或用以下命令直接查找最快镜像:
sudo pacman-mirrors --fasttrack

2. 手动添加镜像源

# 打开/etc/pacman.d/mirrorlist文件添加如下内容:

## 阿里云
Server = http://mirrors.aliyun.com/archlinux/$repo/os/$arch
## 清华大学
Server = https://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch
## Country : China(中科大)
Server = https://mirrors.ustc.edu.cn/manjaro/stable/$repo/$arch

3. 增加archlinuxcn软件仓库

Arch Linux中文社区仓库是由Arch Linux中文社区驱动的非官方用户仓库。包含中文用户常用软件、工具、字体/美化包等。

echo -e "\n[archlinuxcn]\nSigLevel = TrustAll\nServer = https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/\$arch\n"|sudo tee -a /etc/pacman.conf

4. 同步软件索引

sudo pacman -Syy

5. 安装 archlinuxcn-keyring 包以导入 GPG key

sudo pacman -S --noconfirm archlinuxcn-keyring

系统更新

1. 升级系统

sudo pacman -Syyu

2.扩展系统

(1) 安装“安装AUR库中软件”命令

sudo pacman -S yay#该命令不仅可以搜索官方基本库中的软件,同是地可以搜索AUR库。

3. 美化xfce terminal

(1) 安装zsh( 一个强大的虚拟终端)

sudo pacman -S zsh zsh-doc #zsh-doc安装在/usr/share/doc/zsh/文件夹下
sudo pacman -S manjaro-zsh-config  #manjaro的zsh配置文档
cp /etc/skel/.zshrc ~/.zshrc #将配置文件复制到用户目录
zsh #启动zsh

(2) 安装 oh-my-zsh (基于zsh命令行的一个扩展工具集)

sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" #via wget
#sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" #via curl 
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc #替换zsh的配置文件为oh-my-zsh

(3) 查看并更改主题

cd ~/.oh-my-zsh/themes&&ls
#更该主题方法:sudo gedit ~/.zshrc,找到ZSH_THEME=更改为ZSH_THEME="agnoster"

(4) 安装插件

#安装zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/plugins/zsh-autosuggestions

#安装zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/plugins/zsh-syntax-highlighting

#安装 autojump
sudo pacman -S autojump

#安装完毕后:sudo gedit ~/.zshrc,找到plugins=(git)
#更改为plugins=(git zsh-syntax-highlighting zsh-autosuggestions autojump)

source ~/.zshrc #刷新配置,使之生效

(5) 安装 powerline及字体

pacman -S powerline
pacman -S powerline-fonts
pacman -S powerline-vim

(6) 使用zsh替换bash(重新打开终端生效)

chsh -s /bin/zsh
zsh --version  #查看zsh版本

(7) 解决终端字体间距过宽

sudo pacman -S wqy-bitmapfont
sudo pacman -S wqy-zenhei
sudo pacman -S wqy-microhei-lite
#依次打开终端(xfce)->编辑->外观,字体选择Noto Sans Mono Medium
#依次打开终端(xfce)->编辑->外观,勾选使用自定义样式以将标签页变窄(需要重启终端)

(8) 安装其它中文字体

sudo pacman -S ttf-roboto noto-fonts ttf-dejavu
# 文泉驿
sudo pacman -S wqy-bitmapfont wqy-microhei wqy-microhei-lite wqy-zenhei
# 思源字体
sudo pacman -S noto-fonts-cjk adobe-source-han-sans-cn-fonts adobe-source-han-serif-cn-fonts

创建文件.config/fontconfig/fonts.conf,加入下面的配置

<?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>Manjaro Font Config</description>

 <!-- Font directory list -->
 <dir>/usr/share/fonts</dir>
 <dir>/usr/local/share/fonts</dir>
 <dir prefix="xdg">fonts</dir>
 <dir>~/.fonts</dir> <!-- this line will be removed in the future -->

 <!-- 自动微调 微调 抗锯齿 内嵌点阵字体 -->
 <match target="font">
 <edit name="autohint"> <bool>false</bool> </edit>
 <edit name="hinting"> <bool>true</bool> </edit>
 <edit name="antialias"> <bool>true</bool> </edit>
 <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>
        <test name="lang" compare="contains">
            <string>zh</string>
        </test>
        <test name="family">
            <string>serif</string>
        </test>
        <edit name="family" mode="prepend">
            <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>
        </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>
        </edit>
    </match>

    <!-- 把Linux没有的中文字体映射到已有字体,这样当这些字体未安装时会有替代字体 -->
    <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>
    <!-- will be removed in the future -->
    <cachedir>~/.fontconfig</cachedir>

    <config>
        <!-- Rescan in every 30s when FcFontSetList is called -->
        <rescan> <int>30</int> </rescan>
    </config>

</fontconfig>

(9) 中文home目录改英文home目录

# 修改配置文件 ~/.config/user-dirs.dirs

XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_VIDEOS_DIR="$HOME/Videos"

# 打开终端,输入以下命令

cd ~
mv 公共 Public
mv 模板 Templates
mv 视频 Videos
mv 图片 Pictures
mv 文档 Documents
mv 下载 Downloads
mv 音乐 Music
mv 桌面 Desktop

(10) Manjaro(archLinux)系统时间快8小时

sudo ln -sf /usr/share/zoneinfo/Asia/Shanghai/etc/localtime #设置时区
sudo pacman -S openntpd    #安装openNTPD
systemctl restart openntpd #重启openNTPD
systemctl enable openntpd  #设置开机启动 
相关标签: Manjaro