概述

这里使用 i3wm 做窗口管理器,urxvt 做终端模拟器,feh 显示桌面,compton 做合成(透明),lightdm 做显示管理器(登录)。

安装

安装 X11

pkg install xorg

接着在rc.conf中启用sysutils/haldevel/dbus:

hald_enable="YES"
dbus_enable="YES"

安装桌面环境

pkg install
  i3
  rxvt-unicode
  feh
  compton
  compton-conf
  lightdm
  lightdm-gtk-greeter
  lightdm-gtk-greeter-settings

配置

X11

以 root 执行,在工作目录下生成 xorg.conf.new

# Xorg -configure

接着检查配置

# Xorg -config xorg.conf.new -retro

应该能看到黑灰的格子和 X 形状鼠标指针。

i3

在主目录下建立.i3文件夹,其中config是配置文件。
接下来是 i3 配置的内容:

配置文件说明

# i3 config file (v4)

窗口标题字体

# Font for window titles
font pango:monospace 8
#font pango:DejaVu Sans Mono 8

i3 控制键 - 以$mod变量形式设置为meta(Windows/Command)键

# i3 control
set $mod Mod4

启动终端

# terminal
bindsym $mod+Return exec i3-sensible-terminal

杀死焦点窗口

# kill focused window
bindsym $mod+Shift+q kill

启动 dmenu

# start dmenu (a program launcher)
bindsym $mod+d exec --no-startup-id i3-dmenu-desktop

平铺窗口管理器拆分模式

bindsym $mod+h split h
bindsym $mod+v split v

全屏

# fullscreen
bindsym $mod+f fullscreen toggle

浮动

# 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

焦点

# focus
bindsym $mod+a focus parent
#bindsym $mod+d focus child

鼠标相关

# mouse
bindsym --whole-window $mod+button2 kill
bindsym $mod+button3 floating toggle

容器层

# container layout
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split

移动焦点

# 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

移动容器

# 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

工作区

# 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 本身

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'"

修改尺寸模式

# 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

# i3bar

bar {
    position top
    i3bar_command i3bar
    status_command i3status
}

i3-gaps 独有属性(需要安装i3-gaps并且替代i3)

# gaps

gaps inner 8
gaps outer 10
smart_gaps on

应用程序特殊设置

# app

for_window [class="URxvt"] border pixel 1
for_window [class="URxvt"] hide_edge_borders both

启动辅助程序

# extra

exec --no-startup-id feh --bg-fill ~/mmgal_bg.jpg
exec --no-startup-id compton -b
exec --no-startup-id clipit

urxvt

~/.Xdefaults中加入:

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

显示管理器

启用显示管理器,并且开机启动,执行

# service lightdm enable

立即启动使用这个

# service lightdm start

结果

freebsd-desktop.png
freebsd-dev.png

Last modification:June 18th, 2020 at 03:38 pm
如果觉得我的文章对你有用,请随意赞赏