如果你希望工作区内的所有窗口可以平铺开来1并能自由地在它们中进行切换和调整,也许可以尝试使用一个平铺式窗口管理器2来管理它们……
i3
可以:
- 使用
feh
设置壁纸 - 使用
i3bar
和i3status
实现面板 - 使用
i3block
锁屏 - 自由设置、调整、切换多工作区中的程序窗口以及自定义大多数按键组合,比如:
- 程序窗口要还是不要标题栏?多宽?
- 是否要对位于工作区里的程序调整窗口大小?位置?是否要最大化显示?
- 是否要窗口堆叠显示?标签化显示?要窗口浮动起来然后又平铺、堆叠?
- 是否要新运行的程序放到其它位置?是浮动打开还是平铺或者是堆叠?
- 是否要在多个工作区及位于多个工作区的程序间自由切换?
- 使用
xcompmgr
或者compton
……让终端模拟器透明或者开启简单的窗口的动画和混合阴影什么的……
如果你需要这些功能,那么 First search and install i3……
And select install:
i3status
i3blocks
xcompmgr
|compton
feh
lxappearance
gtk-engines
Then init and configure the i3 WM……
如果你还没有创建i3
的用户级配置文件~/.config/i3/config
的骨架文件,创建i3
骨架文件和目录……
mkdir -pv ~/.config/i3
i3-config-wizard # `i3`的用户级配置文件也可以是`~/.i3/config`
Next,你便可以开始尝试配置
~/.xinitrc
并使用startx
或者直接使用显示管理器(登录管理器)来启动i3
并根据需要进行更新i3
配置文件来调整i3
的使用方式……
不过,如果你希望用好i3
的话,还得好好熟悉熟悉i3
的运作和i3
配置文件里的组织和配置方式……
========== ~/.config/i3/config ==========
# i3 窗口调整与切换的主使用键:Mod1 <=> Meta(Alt) | Mod4 <=> (Windows键,Supper键)
set $mod Mod4
font pango:DejaVu Sans Mono 10
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# 打开默认终端窗口的键绑定……
#bindsym $mod+Return exec i3-sensible-terminal
bindsym $mod+Return exec xfce4-terminal
#bindsym $mod+Return exec urxvt -sh 40
#
# 随 i3 一起启动的程序(这些程序在使用之前必须被安装到系统中),为了让调整的设置生效,你可能需要重启 X 或者 i3 会话……
# 为了设置 i3 壁纸(图片路径需要被正确设置)……
exec --no-startup-id feh --bg-scale "/home/user/Ljca/Pictures/391014106.jpg"
# 因为 i3 窗口合成器不支持对窗口合成一些混合效果(比如:窗口的打开/关闭动画(淡入淡出)、混合透明、窗口阴影),所以如果你希望窗口有这些效果的话,你可能需要安装`xcompmpr`或者其它类似的程序并在终端模拟器中添加适当的选项后台运行它,如果你不打算让它随 i3 一起启动的话……
exec --no-startup-id xcompmgr -FCf -nc -t -5 &
# 为了启动 i3bar 上的网络管理小程序……
#exec --no-startup-id nm-applet&
# 为了启动 fcitx 输入法……
#exec --no-startup-id LANG="zh_CN.UTF-8" fcitx &
# 为了设置电源管理……
exec --no-startup-id xset dpms 90 300
# 为了在 i3bar 上显示那种桌面环境面板上的托盘图标,你需要调整`xrandr`的输出(可以尝试运行`xrandr`获取)的……
#exec --no-starup-id xrandr --output eDP-1 --primary
# 如果你不想使用i3bar,可以使用其它桌面环境的面板来替代,比如 xfce4 的:
#exec --no-startup-id xfce4-panel --disable-wm-check
exec --no-startup-id xfce4-terminal&>/dev/null&
# 为了启用触摸板的轻触功能,不过在这里设置无效……
#synclient VertTwoFingerScroll = 1 HorizTwoFingerScroll = 1 TapButton1 = 1 TapButton2 = 3 TapButton3 = 2
# kill 窗口的键绑定……
#bindsym $mod+Shift+q kill
bindsym mod1+F4 kill
# Application Key Bind Start……
# 绑定截图程序到 Print 键……
#bindsym $mod+Print exec scrot
bindsym Print exec xfce4-screenshooter -m 2>/dev/null
# File Browser 1
bindsym Ctrl+mod1+F exec pcmanfm &>/dev/null&
# File Browser 2
#bindsym Ctrl+mod1+F exec thunar &>/dev/null&
# Pdf Browser
#bindsym Ctrl+mod1+D exec masterpdfeditor3 &>/dev/null&
bindsym Ctrl+mod1+D exec evince &>/dev/null&
# Web Browser
bindsym Ctrl+mod1+W exec firefox &>/dev/null&
# Music Player
bindsym Ctrl+mod1+M exec RhythmCat &>/dev/null &
# Picture Browser
bindsym Ctrl+mod1+P exec ristretto &>/dev/null&
# Application Key Bind End……
# dmenu 非常类似于桌面环境的运行……
bindsym mod1+F2 exec dmenu_run
bindsym $mod+d exec --no-startup-id i3-dmenu-desktop
# 窗口焦点移动方式(默认跟随光标)键绑定……
focus_follows_mouse yes
bindsym $mod+j focus up
bindsym $mod+k focus down
bindsym $mod+h focus left
bindsym $mod+l focus right
#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
# 调整窗口在工作区的位置……
bindsym $mod+Shift+h move left
bindsym $mod+Shift+l move right
bindsym $mod+Shift+k move up
bindsym $mod+Shift+j move down
#bindsym $mod+Shift+semicolon move right
# alternatively, you can use the cursor 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
# 这两个键绑定可以隐藏和显示焦点下的窗口……
# minus 对应 -,plus 对应 +
bindsym $mod+minus move scratchpad
bindsym $mod+plus scratchpad show
# 调整窗口边框样式……
bindsym $mod+u border none
bindsym $mod+n border normal
bindsym $mod+o border 1pixel
bindsym $mod+b border toggle
# 新窗口打开后在工作区的放置方式,按下这组键绑定之后……
# 放到焦点窗口的右方……
bindsym Ctrl+$mod+h split h
# 放到焦点窗口的下方……
bindsym $mod+v split v
# 窗口最大化与正常窗口间切换的键绑定……
bindsym $mod+f fullscreen toggle
# 改变窗口的布局方式(平铺还是标签化?或者是堆叠?)……
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# 窗口浮动切换……
bindsym $mod+Shift+space floating toggle
# 在工作区中的浮动窗口和平铺窗口键切换焦点……
bindsym $mod+space focus mode_toggle
# focus the parent container
bindsym $mod+a focus parent
# focus the child container
#bindsym $mod+d focus child
# 工作区切换……
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
# 移动焦点窗口到其它工作区……
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10
# 在工作区的窗口间切换……
bindsym $mod+Tab workspace next
bindsym $mod+Shift+Tab workspace prev
# 窗口大小调整键绑定配置……
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the window’s width.
# Pressing right will grow the window’s width.
# Pressing up will shrink the window’s height.
# Pressing down will grow the window’s height.
bindsym h resize grow width 5 px or 5 ppt
bindsym l resize shrink width 5 px or 5 ppt
bindsym j resize grow height 5 px or 5 ppt
bindsym k resize shrink height 5 px or 5 ppt
#bindsym semicolon 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"
}
bindsym $mod+r mode "resize"
# i3bar 配置……
bar {
# 默认位置:底部……
position top
status_command i3status
colors {
background #eeeeee
statusline #000000
}
}
# for_window 和 assign 配置对某些 Gtk3 程序无效……
# 新窗口打开时要不要浮动起来?
for_window [window_role="pop-up"] floating enable
for_window [window_role="task_dialog"] floating enable
#for_window [class="pop-up"] floating enable
#for_window [class="task_dialog"] floating enable
# 新窗口默认在哪个工作区中打开 →
# assign [class="(?i)osdlyrics"] 2
assign [class="(?i)vlc"] 3
assign [class="(?i)ristretto"] 2
assign [class="(?i)evince"] 2
assign [class="(?i)masterpdfeditor3"] 2
#assign [class="(?i)firefox"] 2
# 打开新窗口时的默认边框样式……
new_float none
new_window none
#mode "system" {
# bindsym L exec ~/pm_mem.sh
#}
#
#bindsym $mod+Pause mode "system"
# 重载 i3 配置文件……
bindsym $mod+Shift+c reload
# 重启 i3 窗口管理器……
bindsym $mod+Shift+r restart
# 退出 i3,也会杀死 X ……
#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'"
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'Exit i3?' -b 'Yes' 'i3-msg exit'"
如果你计划使用
startx
来启动i3
,首先配置好~/.xinitrc
……
======= ~/.xinitrc =======
#!/bin/sh
#export LC_ALL=POSIX
export LANG="zh_CN.UTF-8"
#export LANGUAGE="zh_CN:en_US"
export XIM=fcitx
export XIM_PROGRAM=fcitx
export GTK_IM_MODULE=fcitx
export XMODIFIERS="@im=fcitx"
export QT_IM_MODULE=fcitx
xrdb -merge ~/.Xresources
exec i3
如果你希望在
i3
中使用其它样式的光标,首先安装它或者直接放到正确的位置,然后尝试使用lxappearance
进行调整或者直接在~/.Xresources
中配置并在~/.xinitrc
中使用xrab
引入……
========= ~/.Xresources ========
# 字体的 dpi 大小……
#Xft.dpi: 98
Xft.autohint: 0
Xft.lcdfilter: lcddefault
Xft.hintstyle: hintfull
Xft.hinting: 1
Xft.antialias: 1
Xft.rgba: rgb
# 配置光标主题及光标的大小……
Xcursor.theme: whiteglass
Xcursor.size: 25
如果你使用的是startx
启动i3
并希望在i3
中调整默认Gtk2
程序(比如pcmanfm
、thunar
……)、Gtk3
程序(firefox
,RhythmCat
、xfce4-terminal
……)的外观(比如图标,字体……),可以尝试手动更新Gtk+
程序对应的用户级配置文件或者直接使用lxappearance
进行调整……
Warning:
lxappearance
程序在调整gtk2
程序外观时将会把Gtk2
程序用户级配置文件之一的~/.gtkrc-2.0
清空!
Note:
不管你希望手动调整还是直接使用lxappearance
调整,你都需要重启X
和i3
后才能见到效果!
======== Gtk2
程序用户级配置文件:~/.gtkrc-2.0 =======
# Any customization should be done in ~/.gtkrc-2.0.mine instead.
include "/home/user/Ljca/.gtkrc-2.0.mine"
# gtk-theme-name="Adwaita"
gtk-icon-theme-name="Humanity"
gtk-font-name="DejaVu Sans Mono 9"
# gtk-cursor-theme-size=0
# gtk-toolbar-style=GTK_TOOLBAR_BOTH
# gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
# gtk-button-images=1
# gtk-menu-images=1
# gtk-enable-event-sounds=0
# gtk-enable-input-feedback-sounds=0
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle="hintmedium"
#gtk-xft-rgba="rgb"
style "xfdesktop-icon-view" {
XfdesktopIconView::label-alpha = 0
base[NORMAL] = "#000000"
base[SELECTED] = "#71B9FF"
base[ACTIVE] = "#71B9FF"
fg[NORMAL] = "#fcfcfc"
fg[SELECTED] = "#ffffff"
fg[ACTIVE] = "#ffffff"
}
widget_class "*XfdesktopIconView*" style "xfdesktop-icon-view"
#style "gtk-font-set" {
# #DejaVu Sans Mono for Powerline:style=Bold
# font_name = "DejaVu Sans Mono 9"
#}
#
#class "GtkWidget" style "gtk-font-set"
========== Gtk3
程序用户级配置文件:~/.config/gtk-3.0/settings.ini ==========
# `Gtk3`的用户级配置文件配置和`Gtk2`的相同……
如果你希望知道更多的Gtk
程序配置,可以参考Arch Linux
Wiki 的Gtk+
条目……
关于锁屏,我用的是
xtrlock
;而亮度调节,系统挂起等,直接简单粗暴地用的底层接口;声音控制,则是用的alsamixer
……
# 系统挂起,唤醒之后运行`xtrlock`……
sleep 1;echo mem | sudo tee /sys/power/state &>/dev/null;xtrlock &
# 调整屏幕亮度……
echo 35 | sudo tee /sys/class/backlight/intel_backlight/brightness&>/dev/null
如果你希望设置锁屏壁纸或者了解更多的细节配置什么的,则可以去下面这些地方找找,i3 配置的详细讨论……
- i3 官方指南
- Arch Linux Wiki I3 条目……
- on-my-i3
- levinit i3 config
- ……