最近也只是刚开始用i3wm。
这个帖子会不断完善。
i3wm config
set $mod Mod4
# i3字体
font xft:URWGothic-Book 11
# 使用 win来移动窗口
floating_modifier $mod
# 使用 win+回车 启动terminal
bindsym $mod+Return exec konsole
# 使用win+d 启动菜单
bindsym $mod+d exec --no-startup-id "rofi -modi drun,run -show drun"
# 使用win+q kill程序
bindsym $mod+q kill
# 使用win+方向键 调整focus窗口
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# 使用win+shift+方向键 移动focus窗口
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# 使用win+h 设置竖向分割屏幕
bindsym $mod+h split h;exec notify-send 'tile 水平铺排'
# 使用win+v 设置横向分割屏幕
bindsym $mod+v split v;exec notify-send 'tile 垂直铺排'
# 使用win+f 全屏
bindsym $mod+f fullscreen toggle
# 使用win+s/w/e 设置显示方式,s是堆叠,w是标签,e是分割
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# 使用win+shift+空格 设置窗口浮动
bindsym $mod+Shift+space floating toggle
# 使用 win+空格来切换窗口和浮动窗口
bindsym $mod+space focus mode_toggle
# 设置工作区名称
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"
# 使用win+数字 切换工作区
bindsym $mod+1 workspace number $ws1
bindsym $mod+2 workspace number $ws2
bindsym $mod+3 workspace number $ws3
bindsym $mod+4 workspace number $ws4
bindsym $mod+5 workspace number $ws5
bindsym $mod+6 workspace number $ws6
bindsym $mod+7 workspace number $ws7
bindsym $mod+8 workspace number $ws8
bindsym $mod+9 workspace number $ws9
bindsym $mod+0 workspace number $ws10
# 使用win+ctrl+数字 将当前窗口移动到指定工作区
bindsym $mod+Ctrl+1 move container to workspace $ws1
bindsym $mod+Ctrl+2 move container to workspace $ws2
bindsym $mod+Ctrl+3 move container to workspace $ws3
bindsym $mod+Ctrl+4 move container to workspace $ws4
bindsym $mod+Ctrl+5 move container to workspace $ws5
bindsym $mod+Ctrl+6 move container to workspace $ws6
bindsym $mod+Ctrl+7 move container to workspace $ws7
bindsym $mod+Ctrl+8 move container to workspace $ws8
# 使用win+shift+数字 将当前窗口移动到指定工作区 并切换到移动后的工作区
bindsym $mod+Shift+1 move container to workspace number $ws1
bindsym $mod+Shift+2 move container to workspace number $ws2
bindsym $mod+Shift+3 move container to workspace number $ws3
bindsym $mod+Shift+4 move container to workspace number $ws4
bindsym $mod+Shift+5 move container to workspace number $ws5
bindsym $mod+Shift+6 move container to workspace number $ws6
bindsym $mod+Shift+7 move container to workspace number $ws7
bindsym $mod+Shift+8 move container to workspace number $ws8
bindsym $mod+Shift+9 move container to workspace number $ws9
bindsym $mod+Shift+0 move container to workspace number $ws10
# 窗口样式设置
new_window pixel 1
new_float normal
hide_edge_borders none
bindsym $mod+u border none
bindsym $mod+y border pixel 1
bindsym $mod+n border normal
# 自动切换到紧急窗口
for_window [urgent=latest] focus
# 使用win+shift+c 重载配置文件
bindsym $mod+Shift+c reload
# 使用win+shift+r 重新启动i3窗口管理器
bindsym $mod+Shift+r restart
# 使用win+shift+e 退出i3,并提供确认选项。
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'"
# 使用win+ctrl+l 锁屏
bindsym $mod+Ctrl+l exec --no-startup-id i3lock
# 使用win+r 进入resize模式
bindsym $mod+r mode "resize"
# 在resize模式下使用方向键调整大小。以左上角为原点,上下左右来移动右下角坐标,来扩展窗口区域。回车/esc/win+r 返回正常模式。
mode "resize" {
bindsym Left resize shrink width 4 px or 4 ppt
bindsym Down resize grow height 4 px or 4 ppt
bindsym Up resize shrink height 4 px or 4 ppt
bindsym Right resize grow width 4 px or 4 ppt
bindsym Return mode "default"
bindsym Escape mode "default"
bindsym $mod+r mode "default"
}
# 调整边框距离
gaps inner 8
gaps outer 2
# 调节音量
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status
# 焦点跟随鼠标
focus_follows_mouse no
# 显示器双屏设置
exec $HOME/.config/i3/scripts/xrandr-auto.sh
# 启动项设置:
exec --no-startup-id nitrogen --restore
exec --no-startup-id picom -b # 启动 picom
exec_always feh --bg-scale $HOME/Pictures/bg.jpg # 设置壁纸
exec --no-startup-id fcitx5 & # fcitx5 输入法
exec --no-startup-id clash-verge & # clash-verge 梯子
exec --no-startup-id $HOME/.config/polybar/launch.sh # 开启 polybar
exec --no-startup-id dunst & # 桌面通知
exec_always --no-startup-id numlockx on # 开启小键盘锁
exec_always --no-startup-id xinput disable "ELAN1203:00 04F3:307A Touchpad" # 禁用触摸板,触摸板名称通过xinput获取。
# 窗口绑定工作区
# 浮动窗口应用列表
default_border pixel 1
for_window [class="Spotify"] floating enable
for_window [class="Typora"] floating enable
for_window [class="Telegram"] floating enable
for_window [class="Feishu"] floating enable
for_window [class="obs"] floating enable
for_window [class="zoom"] floating enable
for_window [class="wechat"] floating enable
for_window [title="图片查看"] floating enable
for_window [title="微信"] floating enable