freebsd_13_thinkpad_T430笔记本i3wm桌面安装配置

Catalogue
  1. 1. 安装sudo
  2. 2. 安装zsh
  3. 3. 显卡驱动安装
  4. 4. 字体安装
    1. 4.1. tty控制台中文显示方块
  5. 5. i3wm安装
  6. 6. fcitx5安装
  7. 7. 中文化设置
  8. 8. ntfs 挂载参考
  9. 9. 音量控制
    1. 9.1. 小键盘开启
    2. 9.2. wifi设置
  10. 10. zfs 快照简单操作
  • 参考资料
  • 2022-5-2 更新 rofi主题,tty控制台中文显示方框,guake 无法启动,fcitx5 皮肤设置,volumeicon设置,数字键盘开机启动,wifi设置

    freebsd 中文使用手册 https://www-legacy.freebsd.org/doc/zh_CN/books/handbook/

    常用网站:
    https://www.freshports.org/
    https://forums.freebsd.org/
    https://www.chinafreebsd.cn/article/5a024c4e119ec
    https://bsdfun.com/

    使用 ventoy 引导,节省U盘,拷贝freebsd 13 的DVD ios 到u盘的 ventoy的ios目录下 ,然后从U盘启动

    启动后会提示进入安装还是进入shell,选择进入安装,选择软件的时候我是一股脑全选上了

    安装的时候分区这里zsf格式是可以自动分区的,但是是整个硬盘才能自动分区,如果是分区安装就要手动设置zfs,或者使用UFS格式

    安装完成后,好像还是无法上网,直接ping ip地址可以,但是Ping www.baidu.com 就无法解析,记得安装的时候也设置了dns解析服务器,root 账户登陆,修改 vi /etc/resolv.conf 取消 nameserver 前面的 # 号,也可以新添加一个自己需要的 dns 服务器,这样就可以ping www.baidu.com 了。

    ####网络配置

    1
    2
    3
    4
    5
    6
    #正常不需要自己配置,可以跳过
    ifconfig #列出网卡配置列表
    vim /etc/rc.conf
    #添加类似如下内容
    ifconfig_dc0="inet 192.168.1.3 netmask 255.255.255.0"
    /etc/rc.d/netif restart #重启网络系统

    安装sudo

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    sudo vim /etc/pkg/FreeBSD.conf
    #修改url 最后一个字段,latest表示软件最新版;如latest换成quarterly表示软件稳定版
    sudo pkg update -F
    sudo pkg upgrade

    更新。FreeBSD和Linux中更新的不同之处在于,内核和软件包是分开更新的,
    内核使用 freebsd-update fetch #获取更新
    freebsd-update install #安装更新
    而软件包使用 pkg upgrade 更新。

    常用命令。
    安装软件:sudo pkg install xxx
    安装本地包:sudo pkg add ./xxx
    列出安装的包:sudo pkg info
    列出设备:sudo pciconf -l
    列出内核模块:sudo kldstat
    搜索软件:sudo pkg search ^vim 列出以vim 开头的软件包

    root 用户

    1
    2
    3
    4
    5
    6
    pkg install sudo 
    pw usermod john -G wheel #添加用户john到wheel组,这样才能 su 到 root 用户
    visudo #给用户添加sudo权限
    root ALL=(ALL) ALL
    username ALL=(ALL) ALL #新添加一行

    安装zsh

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    sudo pkg install zsh wget curl git
    sudo chsh -s zsh username
    #退出重新登陆用户
    sudo pkg install
    vim .zshrc #设置一下代理
    export HTTP_PROXY=“http://web-proxy.xxxxxx.com:8080“
    export HTTPS_PROXY=“https://web-proxy.xxxxxx.com:8080“

    vim .zshrc #设置一下插件
    plugins=(
    git
    zsh-syntax-highlighting
    zsh-autosuggestions
    z # 文件夹跳转插件,zsh 自带,无需安装
    )
    #安装插件
    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
    git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

    显卡驱动安装

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    sudo pkg install drm-kmod
    vim /etc/rc.conf
    #添加下面一行
    kld_list="/boot/modules/i915kms.ko"
    sshd_enable="YES" #这一行是开启 ssh服务


    #pw usermod <username> -G video,operator #添加用户到video组
    pw usermod john -G wheel,operator,video #wheel组可以su 到root, operator组方便后续电源管理

    pkg install libva-intel-driver #(intel高清解码器)
    #pkg install xf86-video-intel #(intel开源程序,这个我的T430安装了会在显示器休眠后无法支正常返回桌面,显示黑色的屏幕和一个可以移动的鼠标指针,删除掉这个包就好了
    pkg install xorg dbus

    vim /etc/rc.conf #添加下面两行
    hald_enable='YES"
    dbus_enable='YES"

    shutdown -r now #重启

    xorg 配置文件目录 #一般用不到记录一下

    1
    2
    3
    4
    5
    6
    7
    8
    9
    cat Xorg.0.log | grep config
    [ 40.249] Markers: (--) probed, (**) from config file, (==) default setting,
    [ 40.271] (==) Using system config directory "/usr/local/share/X11/xorg.conf.d"
    Using a default monitor configuration.
    If no devices become available, reconfigure udev or disable AutoAddDevices.
    [ 40.575] (==) Matched intel as autoconfigured driver 0
    [ 40.575] (==) Matched modesetting as autoconfigured driver 1
    [ 40.575] (==) Matched scfb as autoconfigured driver 2
    [ 40.575] (==) Matched vesa as autoconfigured driver 3

    字体安装

    参考如下配置文件部分 https://forums.freebsd.org/threads/installing-truetype-fonts-on-freebsd.65261/

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    Add the font path to:

    /usr/local/etc/X11/xorg.conf.d/10-files.conf
    Code:
    Section "Files"
    FontPath "/usr/local/share/fonts/"
    FontPath "/usr/share/fonts/100dpi"
    FontPath "/usr/share/fonts/75dpi"
    FontPath "/usr/share/fonts/TTF"
    FontPath "/usr/share/fonts/encodings"
    FontPath "/usr/share/fonts/misc"
    FontPath "/usr/share/fonts/util"
    EndSection

    And the module can be loaded on this way.

    /usr/local/etc/X11/xorg.conf.d/15-modules.conf
    Code:
    Section "Module"
    Load "freetype"
    EndSection

    EDIT: Ah, do not forget to run fc-cache, or even better fc-cache -vf.

    复制 msyh.ttf 文件到 /usr/local/share/fonts/TTF ,运行 fc-cache ,fc-cache -vf

    安装其他字体

    1
    sudo pkg install dejavu hack-font nerd-fonts powerline-fonts
    tty控制台中文显示方块

    参考https://www.chinafreebsd.cn/article/5a024c4e119ec

    下载字体:https://www.chinafreebsd.cn/upload/file/wqy.fnt

    1
    sudo cp wqy.fnt /usr/share/vt/fonts/

    设置字体配置文件,我只做了第一步:

    1
    2
    3
    sudo sysrc font8x16="wqy"
    #echo 'hw.vga.textmode=0' >> /boot/loader.conf
    #echo 'kern.vty=vt' >> /boot/loader.conf

    重启验证

    1
    2
    sudo reboot
    date #敲入 date 命令验证中文显示

    i3wm安装

    1
    pkg install i3-gaps i3lock i3status  rofi  dunst picom  conky dmenu xterm flameshot nitrogen caja engrampa alacritty

    安装后创建 .xinitrc 文件添加如下内容以便用 startx 命令启动桌面

    1
    exec i3

    这时候可以先把自己的 i3 config 文件拷贝过来到 ~/.config/i3/ 文件夹下,或者先 startx 启动i3 创建并使用默认的配置文件。

    1
    mkdir -p .config/i3

    这是我使用的 config 文件,如果用需要自己修改,仅作参考

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    # i3 config file (v4)

    # I prefer to use the Win key as the mod key.
    # Arch Linux.
    #set $mod Mod4
    # FreeBSD.
    set $mod Mod4
    workspace 1 output LVDS-1
    workspace 2 output DP-3 LVDS-1
    workspace 2 output DP-3 LVDS-1
    workspace 2 output DP-3 LVDS-1
    workspace 2 output DP-3 LVDS-1
    workspace 2 output DP-3 LVDS-1
    workspace 2 output DP-3 LVDS-1
    workspace 2 output DP-3 LVDS-1
    workspace 2 output DP-3 LVDS-1
    workspace 2 output DP-3 LVDS-1
    workspace 2 output DP-3 LVDS-1
    workspace 2 output DP-3 LVDS-1

    # Default font for i3.
    font pango:DejaVu Sans Mono 10
    #font pango:Monospace 10

    # Use Mouse+$mod to drag floating windows to their wanted position.
    floating_modifier $mod

    # Disable focus following the mouse.
    #focus_follows_mouse no
    focus_follows_mouse yes

    # Kill focused window.
    bindsym $mod+q kill
    bindsym $mod+Shift+minus move scratchpad
    bindsym $mod+minus scratchpad show
    # Chance focus.
    bindsym $mod+h focus left
    bindsym $mod+j focus down
    bindsym $mod+k focus up
    bindsym $mod+l focus right

    # Alternatively use arrow keys.
    bindsym $mod+Left focus left
    bindsym $mod+Down focus down
    bindsym $mod+Up focus up
    bindsym $mod+Right focus right

    # Move focused window.
    bindsym $mod+Shift+h move left
    bindsym $mod+Shift+j move down
    bindsym $mod+Shift+k move up
    bindsym $mod+Shift+l move right

    # Alternatively use arrow keys.
    bindsym $mod+Shift+Left move left
    bindsym $mod+Shift+Down move down
    bindsym $mod+Shift+Up move up
    bindsym $mod+Shift+Right move right

    # Split in horizontal orientation.
    bindsym $mod+t split h

    # Split in vertical orientation.
    bindsym $mod+v split v

    # Enter fullscreen mode for the focused container.
    bindsym $mod+f fullscreen toggle

    # Change container layout (stacked, tabbed, toggle split).
    bindsym $mod+s layout stacking
    bindsym $mod+w layout tabbed
    bindsym $mod+e layout toggle split
    # Toggle tiling / floating.
    bindsym $mod+Shift+space floating toggle

    # Change focus between tiling / floating windows.
    #bindsym $mod+space focus mode_toggle

    # Focus the parent container.
    #bindsym $mod+a focus parent

    # Focus the child container.
    #bindsym $mod+d focus child

    # Switch to workspace.
    bindsym $mod+1 workspace 1
    bindsym $mod+2 workspace 2
    bindsym $mod+3 workspace 3
    bindsym $mod+4 workspace 4
    bindsym $mod+5 workspace 5
    bindsym $mod+6 workspace 6
    bindsym $mod+7 workspace 7
    bindsym $mod+8 workspace 8
    bindsym $mod+9 workspace 9
    bindsym $mod+0 workspace 10

    # Move focused container to workspace.
    bindsym $mod+Shift+1 move container to workspace 1; workspace 1
    bindsym $mod+Shift+2 move container to workspace 2; workspace 2
    bindsym $mod+Shift+3 move container to workspace 3; workspace 3
    bindsym $mod+Shift+4 move container to workspace 4; workspace 4
    bindsym $mod+Shift+5 move container to workspace 5; workspace 5
    bindsym $mod+Shift+6 move container to workspace 6; workspace 6
    bindsym $mod+Shift+7 move container to workspace 7; workspace 7
    bindsym $mod+Shift+8 move container to workspace 8; workspace 8
    # This only works for i3-gaps.
    gaps inner 3
    gaps outer 2

    # Disable title bars.
    for_window [class="^.*"] border pixel 1

    # Key combination for dmenu.
    #bindsym $mod+space exec dmenu_run
    bindsym $mod+space --release exec "rofi -combi-modi drun,window,ssh -show combi -modi combi"

    # If you prefer Rofi to dmenu, you can comment out the above and use this
    # instead. Remember to install the Rofi package: 'doas pkg install rofi'.
    #bindsym $mod+d exec "rofi -combi-modi window,drun -show combi -modi combi"

    # Open applications on specific workspaces


    # Key combination for some of my favorite applications.
    bindsym $mod+Return exec "xterm"
    bindsym $mod+Shift+m exec "claws-mail"
    bindsym $mod+Shift+g exec "gimp"
    bindsym $mod+Shift+f exec "firefox"
    bindsym $mod+Shift+t exec "hexchat"
    bindsym $mod+Shift+z exec "filezilla"
    bindsym $mod+Print --release exec --no-startup-id flameshot gui

    # Map the print key to gnome-screenshot.
    bindsym Print exec "gnome-screenshot -i"

    # Some applications needs to be floating. mpv is one of them.
    for_window [class="mpv"] floating enable

    # Screen lock. See 'man i3lock' for information about usage.
    bindsym $mod+Control+l exec "i3lock -t -i ~/.lock1.png --color=000000"

    # Jump to the latest "urgent" window.
    bindsym $mod+u [urgent=latest] focus

    # Reload the configuration file.
    bindsym $mod+Shift+r reload

    # Restart i3 inplace (preserves your layout/session, can be used to upgrade i3).
    bindsym $mod+Shift+e restart

    # Exit i3 (logs you out of your X session).
    # In my case I don't want a warning or anything, so be careful about pressing
    # this combination as it kills X. Also be sure to lock down all applications
    # before usage.
    bindsym $mod+Shift+x exec i3-msg exit

    # If you like a warning that needs to be confirmed with the mouse, you can use
    # the following instead.
    #bindsym $mod+Shift+x exec "i3-nagbar -t warning -m 'Do you really want to end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"

    # Resize window (you can also use the mouse for that).
    mode "resize" {
    # These bindings trigger as soon as you enter the resize mode.
    bindsym h resize shrink width 10 px or 10 ppt
    bindsym j resize grow height 10 px or 10 ppt
    bindsym k resize shrink height 10 px or 10 ppt
    bindsym l resize grow width 10 px or 10 ppt

    # Same bindings, but for the arrow keys.
    bindsym Left resize shrink width 10 px or 10 ppt
    bindsym Down resize grow height 10 px or 10 ppt
    bindsym Up resize shrink height 10 px or 10 ppt
    bindsym Right resize grow width 10 px or 10 ppt

    # Back to normal: Enter or Escape.
    bindsym Return mode "default"
    bindsym Escape mode "default"
    }

    # Resize windows.
    bindsym $mod+r mode "resize"

    bar {
    colors {
    background #1e1e1e
    statusline #ffffff
    separator #1e1e1e
    focused_workspace #008fff #007fff #ffffff
    active_workspace #333333 #5f676a #ffffff
    inactive_workspace #333333 #222222 #888888
    urgent_workspace #aa0000 #990000 #ffffff
    }
    i3bar_command i3bar -t
    position top
    status_command ~/.config/i3/conky-i3bar.sh
    }

    ## Autostart applicatons ##

    # Let's get our wallpaper.
    # You can run nitrogen from the console and set it up, afterwards use "--restore" to use it in i3.
    #exec --no-startup-id "nitrogen --restore"

    # If you would like to be able to switch between keyboard layouts, this is the
    # way to do it. As an example I am swithing between a Danish and an Arabic
    # keyboard layout in this setup.
    # You switch between layouts by pressing "left CTRL + right CTRL".
    #exec --no-startup-id "setxkbmap -layout dk,ara -option grp:ctrls_toggle"
    exec --no-startup-id fcitx5
    exec --no-startup-id picom --experimental-backends -b
    exec --no-startup-id alacritty
    for_window [class="Alacritty"] move to workspace 2
    exec --no-startup-id caja
    for_window [class="Caja"] move to workspace 3
    exec --no-startup-id firefox
    for_window [class="Firefox"] move to workspace 2
    exec --no-startup-id copyq
    exec --no-startup-id flameshot
    exec --no-startup-id /usr/local/libexec/polkit-gnome-authentication-agent-1
    exec --no-startup-id xfce4-power-manager
    exec --no-startup-id xautolock -time 3 -locker "i3lock"
    exec --no-startup-id volumeicon

    conky 配置文件和脚本都复制的这篇guide的,稍有修改 https://unixsheikh.com/tutorials/how-to-setup-freebsd-with-a-riced-desktop-part-3-i3.html

    1
    vim  .conkyrc

    内容如下:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    conky.config = {
    background = false,
    cpu_avg_samples = 2,
    no_buffers = true,
    out_to_console = true,
    out_to_x = false,
    own_window = false,
    update_interval = 1,
    short_units = true,
    total_run_times = 0
    };

    conky.text = [[

    [
    {"full_text": "CPU: ${cpu cpu0}% ", "color":"\#cf6a4c"},
    #{"full_text": " | ", "color":"\#555555"},
    {"full_text": "${acpitemp}℃ ","color":"\#00aaaa"},
    {"full_text": "|", "color":"\#555555"},
    {"full_text": "RAM: $mem","color":"\#cda869"},
    {"full_text": "|", "color":"\#555555"},
    {"full_text": "LAN: ${addr wlan0}","color":"\#89b859"},
    #{"full_text": "VPN: ${addr tun0}","color":"\#00aaaa"},
    {"full_text": "|", "color":"\#555555"},
    {"full_text": "↑${upspeedf wlan0} ↓${downspeedf wlan0} KB/s", "color":"\#9b703f"},
    {"full_text": "|", "color":"\#555555"},
    {"full_text": "UP: ${uptime_short} ", "color":"\#838184"},
    {"full_text": "|", "color":"\#555555"},
    {"full_text": "${time %A %Y-%m-%d}", "color":"\#cccccc"},
    {"full_text": "${time %H:%M}", "color":"\#cccccc"}
    ],

    ]];

    然后创建一个 conky-i3bar.sh 文件放在 ~/.config/i3/ 下面给 i3 调用,内容如下:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    #!/bin/sh

    # Send the header so that i3bar knows we want to use JSON:
    echo '{"version":1}'

    # Begin the endless array.
    echo '['

    # We send an empty first array of blocks to make the loop simpler:
    echo '[],'

    # Now send blocks with information forever:
    exec conky -c ~/.conkyrc

    添加执行权限

    1
    $ chmod +x ~/.config/i3/conky-i3bar.sh

    alacritty 可以去github 下载一个配置文件模板,然后修改字体:

    1
    2
    3
    font:
    normal:
    family: Hack

    设置为其他的字体字符显示会重叠。

    xterm 配置文件 .Xdefaults

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    xterm*faceName:             DejaVu Sans Mono:style=Book:antialias=true
    xterm*faceNameDoublesize: Noto Sans CJK SC
    xterm*faceSize: 13
    xterm*renderFont: true
    xterm*cjk_width: true
    xterm*geometry: 80x25
    xterm*dynamicColors: true
    xterm*utf8: 2
    xterm*eightBitInput: true
    xterm*saveLines: 2048
    xterm*scrollKey: true
    xterm*scrollTtyOutput: false
    xterm*scrollBar: true
    xterm*rightScrollBar: true
    xterm*jumpScroll: true
    xterm*multiScroll: true
    xterm*toolBar: false
    xterm*Scrollbar*thickness: 10
    xterm*Scrollbar*background: black
    xterm*Scrollbar*foreground: gray90
    xterm*termName: xterm-256color
    xterm*decTerminalID: vt340

    ! https://askubuntu.com/questions/237942/how-does-copy-paste-work-with-xterm
    xterm*selectToClipboard: true

    ! https://futurile.net/2016/06/15/xterm-256color-themes-molokai-terminal-theme/
    xterm*background: rgb:1a/1a/1a
    xterm*foreground: rgb:d6/d6/d6
    xterm*cursorColor: rgb:d6/d6/d6
    xterm*color0: rgb:00/00/00
    xterm*color1: rgb:9e/18/28
    xterm*color2: rgb:00/88/00
    xterm*color3: rgb:96/8a/38
    xterm*color4: rgb:41/41/71
    xterm*color5: rgb:96/3c/59
    xterm*color6: rgb:41/81/79
    xterm*color7: rgb:be/be/be
    xterm*color8: rgb:66/66/66
    xterm*color9: rgb:cf/61/71
    xterm*color10: rgb:7c/bc/8c
    xterm*color11: rgb:ff/f7/96
    xterm*color12: rgb:41/86/be
    xterm*color13: rgb:cf/9e/be
    xterm*color14: rgb:71/be/be
    xterm*color15: rgb:ff/ff/ff

    fcitx5安装

    1
    sudo pkg install fcitx5 fcitx5-configtool fcitx5-gtk fcitx5-qt fcitx5-lua zh-fcitx5-chinese-addons 

    设置环境变量, .zshrc 文件添加如下设置:

    1
    2
    3
    4
    5
    6
    7
    8
    export XMODIFIERS='@im=fcitx'
    export GTK_IM_MODULE=fcitx/xim
    export QT_IM_MODULE=fcitx
    export QT4_IM_MODULE fcitx
    export GTK2_IM_MODULE fcitx
    export GTK3_IM_MODULE fcitx
    export LANG zh_CN.UTF-8
    export MM_CHARSET zh_CN.UTF-8

    安装完成以后在i3配置文件里设置启动

    1
    exec_always --no-startup-id fcitx5

    皮肤安装

    参考:https://github.com/hosxy/Fcitx5-Material-Color

    1
    2
    3
    4
    5
    6
    #安装
    mkdir -p ~/.local/share/fcitx5/themes/Material-Color
    git clone https://github.com/hosxy/Fcitx5-Material-Color.git ~/.local/share/fcitx5/themes/Material-Color
    #手动设置配色方案
    cd ~/.local/share/fcitx5/themes/Material-Color
    ln -sf ./theme-pink.conf theme.conf

    启用主题

    修改配置文件 ~/.config/fcitx5/conf/classicui.conf

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    # 垂直候选列表
    Vertical Candidate List=False

    # 按屏幕 DPI 使用
    PerScreenDPI=True

    # Font (设置成你喜欢的字体)
    Font="思源黑体 CN Medium 13"

    # 主题
    Theme=Material-Color

    中文化设置

    参考 https://zhuanlan.zhihu.com/p/68167981https://www.xuchao.org/docs/freebsd/using-localization.html

    首先在/etc/login.conf中添加以下部分,配置文件里面默认的是russian,把下面这一段贴到russian前面

    1
    2
    3
    4
    chinese|Chinese Users Account:\
    :charset=UTF-8:\
    :lang=zh_CN.UTF-8:\
    :tc=default:

    更新数据库

    1
    cap_mkdb /etc/login.conf

    使用vipw添加新用户,看起来像下面这样:

    1
    2
    3
    4
    user:password:1111:11:language:0:0:User Name:/home/user:/bin/sh  
    #######
    /DrDMTY/:1001:1001:chinese:0:0:awaybird:/home/
    ####### 添加了chinese 字段到数字之间

    操作完成后重启系统,用 locale 命令检查一下是否更新成功

    ntfs 挂载参考

    http://kflu.github.io/2018/02/03/2018-02-03-freebsd-ntfs/

    https://vermaden.wordpress.com/2018/10/11/freebsd-desktop-part-17-automount-removable-media/

    1
    2
    3
    pkg install fusefs-ntfs
    vim /boot/loader.conf:
    fusefs_load="YES" #添加这一行,注意是fusefs

    u盘可以安装一个 automount, 插入U盘后自动挂载

    1
    sudo pkg install automount

    手动挂载ntfs 分区

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    $ gpart show -p # 显示ada0p2 这样的格式,
    => 34 1953525101 ada0 GPT (932G)
    34 2014 - free - (1.0M)
    2048 614400 ada0p1 efi (300M)
    616448 262144 ada0p2 ms-reserved (128M)
    878592 168235008 ada0p3 linux-data (80G)
    169113600 368637952 ada0p4 ms-basic-data (176G)

    sudo ntfs-3g /dev/ada0p4 /mnt/windows
    umount /mnt/windows #卸载

    音量控制

    先安装listen1的firefox 插件,播放一下音乐测试一下
    音量控制安装的是volumeicon

    1
    2
    sudo pkg install volumeicon  #可以右键点击图标设置快捷键
    xterm -e 'mixer' #设置mixer

    可以用 xev 命令查看按键映射,如果要设置快捷键可以测试一下

    如下命令调整音量

    1
    2
    3
    mixer
    mixer vol -7
    mixer vol +5

    或者可以安装 mixertui,一个类似alsamixer的界面

    1
    2
    3
    sudo pkg install mixertui
    sysctlinfo_load="YES"
    sysctlbyname_improved_load="YES"
    小键盘开启
    1
    2
    3
    4
    sudo pkg install numlockx
    #在i3 配置文件添加开机启动
    vim ~/.config/i3/config
    exec --no-startup-id numlockx
    wifi设置

    暂时没有找到好的图形网络管理界面,参考官方文档:https://docs.freebsd.org/en/books/handbook/advanced-networking/

    http://iqotom.com/?p=392

    先找到wifi设备

    1
    2
    3
    4
    5
    6
    7
    8
    sysctl net.wlan.devices
    #net.wlan.devices: iwn0
    pciconf -lv iwn0
    i#wn0@pci0:3:0:0: class=0x028000 rev=0x34 hdr=0x00 vendor=0x8086 #device=0x0085 subvendor=0x8086 subdevice=0x1311
    # vendor = 'Intel Corporation'
    # device = 'Centrino Advanced-N 6205 [Taylor Peak]'
    # class = network
    # 设备是intel 6205

    谷歌搜索 ‘ freebsd 6205’ 找到对应的驱动是 iwn(4) - FreeBSD ,需要在开机的时候载入如下模块:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    sudo vi /boot/loader.conf
    #增加如下内容
    if_iwn_load="YES"
    iwn4965fw_load="YES"
    iwn1000fw_load="YES"
    iwn5000fw_load="YES"
    iwn5150fw_load="YES"
    iwn6000fw_load="YES"
    iwn6000g2afw_load="YES"
    iwn6000g2bfw_load="YES"
    iwn6050fw_load="YES"
    #同时添加WPA协议驱动
    wlan_wep_load="YES"
    wlan_ccmp_load="YES"
    wlan_tkip_load="YES"

    测试搜索ssid

    1
    2
    3
    4
    5
    sudo ifconfig wlan0 create wlandev iwn0  #使用iwn0设备创建wlan0接口,注意替换iwn0为自己的设备
    sudo ifconfig wlan0 up scan #应该会出现如下列表
    #SSID/MESH ID BSSID CHAN RATE S:N INT CAPS
    #dlinkap 00:13:46:49:41:76 11 54M -90:96 100 EPS WPA WME
    #freebsdap 00:11:95:c3:0d:ac 1 54M -83:96 100 EPS WPA

    设置wlan0开机启动

    1
    2
    3
    sudo vi /etc/rc.conf
    wlans_iwn0="wlan0" #注意替换iwn0为自己的无线网卡
    ifconfig_wlan0="WPA DHCP"

    设置无线路由器帐号密码

    1
    2
    3
    4
    5
    6
    sudo vi /etc/wpa_supplicant.conf 
    #添加帐号密码信息
    network={
    ssid="freebsdap"
    psk="freebsdmall"
    }

    重启网络,查看wlan0状态是否正常

    1
    sudo service netif start

    重启机器,现在应该可以使用wifi进行联网了

    zfs 快照简单操作

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    你可以用这个命令查询新建池的状态:

    sudo zpool status zroot

    你可以看到我的家目录位于 zroot/usr/home

    我们用下面命令创建一个名叫 8888的快照:

    sudo zfs snapshot zroot/usr/home@8888

    快照很快创建完成。现在你可以删除 Downloads 和 Documents >目录。

    现在你用以下命令恢复快照:

    sudo zfs rollback zroot/usr/home@8888


    https://wiki.ubuntu.com/Kernel/Reference/ZFS

    删除一个快照
    sudo zfs destroy zroot/usr/home@8888


    zfs snapshot -r zroot@backup1 #-r 创建一个zroot池里面包含所有子目录的快照

    其他软件参考

    1
    2
    3
    4
    5
    6
    7
    8
    9
    pkg install copyq #剪贴板
    pkg install sndio #声音相关
    pkg install fd-find #fd 命令行查找软件
    pkg install polkit-gnome #配合电源管理
    pkg install xfce4-power-manager #电源管理
    pkg install autolock #自动锁屏
    pkg install scort flameshot #截屏
    #/usr/local/libexec/polkit-gnome-authentication-agent-1 #i3配置文件设置 polkit 启动路径

    问题:自动休眠的时候熄屏,但是无法返回到正常工作的状况,x服务器会down掉,只能用安装的xfce电源管理设置成不熄屏,参照 https://forums.freebsd.org/threads/black-screen-after-standby.79091/ 移除 xf86-video-intel 就正常了。

    休眠用命令 zzz 手动挂起。

    突然发现 rofi-theme-selector 运行时会出现错误,无法应用选择的主题,手动设置一下

    fd .rasi "/" ,找到主题位置

    1
    2
    3
    /usr/local/share/rofi/themes/gruvbox-light.rasi
    /usr/local/share/rofi/themes/iggy.rasi
    /usr/local/share/rofi/themes/lb.rasi #我需要这个主题

    创建配置文件

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    vi ~/.config/rofi/config.rasi

    #添加如下设置:
    configuration {
    modes: [ combi ];
    combi-modes: [ window, drun, run ];
    }

    #@theme "gruvbox-light"
    @theme "lb"

    /* Insert theme modifications after this */


    弄完后大概就是这样

    参考资料