Loading... ## 概述 这里使用 i3wm 做窗口管理器,urxvt 做终端模拟器,feh 显示桌面,compton 做合成(透明),lightdm 做显示管理器(登录)。 ## 安装 安装 X11 ```sh pkg install xorg ``` 接着在`rc.conf`中启用`sysutils/hal`和`devel/dbus`: ```conf hald_enable="YES" dbus_enable="YES" ``` 安装桌面环境 ```sh pkg install i3 rxvt-unicode feh compton compton-conf lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings ``` ## 配置 ### X11 以 root 执行,在工作目录下生成 xorg.conf.new ```sh # Xorg -configure ``` 接着检查配置 ```sh # Xorg -config xorg.conf.new -retro ``` 应该能看到黑灰的格子和 X 形状鼠标指针。 ### i3 在主目录下建立`.i3`文件夹,其中`config`是配置文件。 接下来是 i3 配置的内容: 配置文件说明 ```conf # i3 config file (v4) ``` 窗口标题字体 ```conf # Font for window titles font pango:monospace 8 #font pango:DejaVu Sans Mono 8 ``` i3 控制键 - 以`$mod`变量形式设置为`meta`(`Windows`/`Command`)键 ```conf # i3 control set $mod Mod4 ``` 启动终端 ```conf # terminal bindsym $mod+Return exec i3-sensible-terminal ``` 杀死焦点窗口 ```conf # kill focused window bindsym $mod+Shift+q kill ``` 启动 dmenu ```conf # start dmenu (a program launcher) bindsym $mod+d exec --no-startup-id i3-dmenu-desktop ``` 平铺窗口管理器拆分模式 ```conf bindsym $mod+h split h bindsym $mod+v split v ``` 全屏 ```conf # fullscreen bindsym $mod+f fullscreen toggle ``` 浮动 ```conf # Use Mouse+$mod to drag floating windows to their wanted position floating_modifier $mod # floating focus toggle bindsym $mod+space focus mode_toggle # floating toggle bindsym $mod+Shift+space floating toggle ``` 焦点 ```conf # focus bindsym $mod+a focus parent #bindsym $mod+d focus child ``` 鼠标相关 ```conf # mouse bindsym --whole-window $mod+button2 kill bindsym $mod+button3 floating toggle ``` 容器层 ```conf # container layout bindsym $mod+s layout stacking bindsym $mod+w layout tabbed bindsym $mod+e layout toggle split ``` 移动焦点 ```conf # change focus bindsym $mod+j focus left bindsym $mod+k focus down bindsym $mod+l focus up bindsym $mod+semicolon focus right # --- bindsym $mod+Left focus left bindsym $mod+Down focus down bindsym $mod+Up focus up bindsym $mod+Right focus right ``` 移动容器 ```conf # move bindsym $mod+Shift+j move left bindsym $mod+Shift+k move down bindsym $mod+Shift+l move up bindsym $mod+Shift+semicolon move right # --- bindsym $mod+Shift+Left move left bindsym $mod+Shift+Down move down bindsym $mod+Shift+Up move up bindsym $mod+Shift+Right move right ``` 工作区 ```conf # workspaces # define set $ws1 "1" set $ws2 "2" set $ws3 "3" set $ws4 "4" set $ws5 "5" set $ws6 "6" set $ws7 "7" set $ws8 "8" set $ws9 "9" set $ws10 "10" # switch bindsym $mod+1 workspace $ws1 bindsym $mod+2 workspace $ws2 bindsym $mod+3 workspace $ws3 bindsym $mod+4 workspace $ws4 bindsym $mod+5 workspace $ws5 bindsym $mod+6 workspace $ws6 bindsym $mod+7 workspace $ws7 bindsym $mod+8 workspace $ws8 bindsym $mod+9 workspace $ws9 bindsym $mod+0 workspace $ws10 # move bindsym $mod+Shift+1 move container to workspace $ws1 bindsym $mod+Shift+2 move container to workspace $ws2 bindsym $mod+Shift+3 move container to workspace $ws3 bindsym $mod+Shift+4 move container to workspace $ws4 bindsym $mod+Shift+5 move container to workspace $ws5 bindsym $mod+Shift+6 move container to workspace $ws6 bindsym $mod+Shift+7 move container to workspace $ws7 bindsym $mod+Shift+8 move container to workspace $ws8 bindsym $mod+Shift+9 move container to workspace $ws9 bindsym $mod+Shift+0 move container to workspace $ws10 ``` i3 本身 ```conf bindsym $mod+Shift+c reload bindsym $mod+Shift+r restart bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'" ``` 修改尺寸模式 ```conf # resize mode bindsym $mod+r mode "resize" mode "resize" { # j k l ; 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 # --- 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 mode: Enter | Escape | $mod+r bindsym Return mode "default" bindsym Escape mode "default" bindsym $mod+r mode "default" } ``` i3bar ```conf # i3bar bar { position top i3bar_command i3bar status_command i3status } ``` i3-gaps 独有属性(需要安装`i3-gaps`并且替代`i3`) ```conf # gaps gaps inner 8 gaps outer 10 smart_gaps on ``` 应用程序特殊设置 ```conf # app for_window [class="URxvt"] border pixel 1 for_window [class="URxvt"] hide_edge_borders both ``` 启动辅助程序 ```conf # extra exec --no-startup-id feh --bg-fill ~/mmgal_bg.jpg exec --no-startup-id compton -b exec --no-startup-id clipit ``` ### urxvt 在`~/.Xdefaults`中加入: ```conf URxvt.font: xft:DejaVu Sans Mono:size=12, xft:Source Han Sans SC:size=12 URxvt.depth: 32 URxvt.background: [50]black URxvt.foreground: gray90 URxvt.cursorBlink: True URxvt.internalBorder: 0 URxvt.externalBorder: 0 URxvt.scrollBar: False ``` 透明效果需要`URxvt.depth: 32`。 ### 显示管理器 启用显示管理器,并且开机启动,执行 ```sh # service lightdm enable ``` 立即启动使用这个 ```sh # service lightdm start ``` ## 结果 ![freebsd-desktop.png][1] ![freebsd-dev.png][2] [1]: https://blog.literalkernel.work/usr/uploads/2020/04/1218896870.png [2]: https://blog.literalkernel.work/usr/uploads/2020/04/2177118452.png Last modification:June 18th, 2020 at 03:38 pm © 允许规范转载 Support 如果觉得我的文章对你有用,请随意赞赏