所在位置:

Mac的窗口管理工具

虽然使用 mac,总是怀念 archlinuxawesome 窗口和一些其它命令行工具,像 tmuxapvlvrangerawesome 等等。最近总是在找一些在 mac 上跟 awesome 类似的窗口工具,终于找到了一个解决方案,叫做 chunkwm,虽然没有 awesome 强大,总归可以在 mac 上使用平铺窗口,开心~

安装

这里有两个组件需要安装:
  1. chunkwm: 平铺窗口管理器

  2. skhd:用来设置后台驻留程序的快捷键

brew tap crisidev/homebrew-chunkwm
brew install --HEAD --with-tmp-logging chunkwm
brew install --HEAD --with-logging  koekeishiya/formulae/skhd
日志文件可以在下面的路径中找到:
  1. /tmp/chunkwm.[out|err].log

  2. /usr/local/var/log/skhd/skhd.[out|err].log

随 mac 启动这些程序
brew services start chunkwm
brew services start skhd

创建 rc-files

chunkwm 的配置文件应该放在 ~/.chunkwmrc 和给于可执行的权限:
chmod +x ~/.chunkwmrc
~/.chunkwmrc 文件的内容如下:
#!/bin/bash

#
# NOTE: specify the absolutepath to the directory to use when
# loading a plugin. '~' expansion is supported.
#

chunkc core::plugin_dir /usr/local/opt/chunkwm/share/chunkwm/plugins

#
# NOTE: if enabled, chunkwm will monitor the specified plugin_dir
# and automatically reload any '.so' file that is changed.
#

chunkc core::hotload 1
chunkc core::unload tiling.so
chunkc core::unload ffm.so
chunkc core::unload border.so

#
# NOTE: the following are config variables for the chunkwm-tiling plugin.
#

chunkc set global_desktop_mode           bsp
chunkc set 2_desktop_mode                monocle
chunkc set 5_desktop_mode                float

chunkc set global_desktop_offset_top     4
chunkc set global_desktop_offset_bottom  4
chunkc set global_desktop_offset_left    4
chunkc set global_desktop_offset_right   4
chunkc set global_desktop_offset_gap     1

chunkc set desktop_padding_step_size     10.0
chunkc set desktop_gap_step_size         5.0

chunkc set bsp_spawn_left                1
chunkc set bsp_optimal_ratio             1.618
chunkc set bsp_split_mode                optimal
chunkc set bsp_split_ratio               0.5

chunkc set monitor_focus_cycle           1
chunkc set window_focus_cycle            monitor

chunkc set mouse_follows_focus           0
chunkc set window_float_next             0
chunkc set window_float_center           1
chunkc set window_region_locked          1

chunkc set mouse_modifier                fn

chunkc set preselect_border_color        0xffd75f5f
chunkc set preselect_border_width        5
chunkc set preselect_border_radius       0

chunkc set focused_border_color          0xff0f6288
chunkc set focused_border_width          5
chunkc set focused_border_radius         5
chunkc set focused_border_skip_floating  0

#
# NOTE: specify plugins to load when chunkwm starts.
# if chunkc plugin_dir is not set, the absolutepath is necessary.
#

chunkc core::load border.so
chunkc core::load tiling.so
chunkc core::load ffm.so
skhd 的配置文件应该放在 ~/.skhdrc 和内容如下:
# enter fullscreen mode for the focused container
alt - f : chunkc tiling::window --toggle fullscreen

# change focus between tiling / floating windows
shift + alt - space : chunkc tiling::window --toggle float

# change layout of desktop
alt - e : chunkc tiling::desktop --layout bsp
alt - s : chunkc tiling::desktop --layout monocle

# kill focused window
shift + alt - q : chunkc tiling::window --close

# change focus
alt - h : chunkc tiling::window --focus west
alt - j : chunkc tiling::window --focus south
alt - k : chunkc tiling::window --focus north
alt - l : chunkc tiling::window --focus east

alt - p : chunkc tiling::window --focus prev
alt - n : chunkc tiling::window --focus next

# move focused window
shift + alt - h : chunkc tiling::window --warp west
shift + alt - j : chunkc tiling::window --warp south
shift + alt - k : chunkc tiling::window --warp north
shift + alt - l : chunkc tiling::window --warp east

alt - r : chunkc tiling::desktop --rotate 90

# move focused container to workspace
shift + alt - m : chunkc tiling::window --send-to-desktop $(chunkc get _last_active_desktop)
shift + alt - p : chunkc tiling::window --send-to-desktop prev
shift + alt - n : chunkc tiling::window --send-to-desktop next
shift + alt - 1 : chunkc tiling::window --send-to-desktop 1
shift + alt - 2 : chunkc tiling::window --send-to-desktop 2
shift + alt - 3 : chunkc tiling::window --send-to-desktop 3
shift + alt - 4 : chunkc tiling::window --send-to-desktop 4
shift + alt - 5 : chunkc tiling::window --send-to-desktop 5
shift + alt - 6 : chunkc tiling::window --send-to-desktop 6

切换布局

# enter fullscreen mode for the focused container
alt - f : chunkc tiling::window --toggle fullscreen

# change focus between tiling / floating windows
shift + alt - space : chunkc tiling::window --toggle float

# change layout of desktop
alt - e : chunkc tiling::desktop --layout bsp
alt - s : chunkc tiling::desktop --layout monocle

焦点

# kill focused window
shift + alt - q : chunkc tiling::window --close

# change focus
alt - h : chunkc tiling::window --focus west
alt - j : chunkc tiling::window --focus south
alt - k : chunkc tiling::window --focus north
alt - l : chunkc tiling::window --focus east
alt - p : chunkc tiling::window --focus prev
alt - n : chunkc tiling::window --focus next

移动窗口

# move focused window
shift + alt - h : chunkc tiling::window --warp west
shift + alt - j : chunkc tiling::window --warp south
shift + alt - k : chunkc tiling::window --warp north
shift + alt - l : chunkc tiling::window --warp east

alt - r : chunkc tiling::desktop --rotate 90

# move focused container to workspace
shift + alt - p : chunkc tiling::window --send-to-desktop prev
shift + alt - n : chunkc tiling::window --send-to-desktop next
shift + alt - 1 : chunkc tiling::window --send-to-desktop 1
shift + alt - 2 : chunkc tiling::window --send-to-desktop 2

【上一篇】mac下tmux的配置和常用用法

【下一篇】mysql的单表查询