Mac 下的窗口管理器

2016-12-12 10:16:59来源:作者:体验盒子人点击


合成式窗口管理器(compositing window manager) 堆叠式窗口管理器(stacking window manager) 瓦片式窗口管理器(tiling window manager) 动态窗口管理器(dynamic window manager)




它的Keyboard Shortcuts

Amethyst uses two modifier combinations.

mod1 - option + shiftmod2 - ctrl + option + shiftAnd definesthefollowingcommands, mostly a mappingto xmonadkeycombinations. mod1 + space — cycleto nextlayoutmod2 + space - cycleto previouslayoutmod1 + w - focus 1st screenmod1 + e - focus 2nd screenmod1 + r - focus 3rd screenmod2 + w - movefocusedwindowto 1st screenmod2 + e - movefocusedwindowto 2nd screenmod2 + r - movefocusedwindowto 3rd screenmod2 + [n] - movefocusedwindowto nthspacemod2 + left - movefocusedwindowleftonespacemod2 + right - movefocusedwindowrightonespacemod1 + h - shrinkthemainpanemod1 + l - expandthemainpanemod1 + , - increasethenumberofwindowsin themainpanemod1 + . - decreasethenumberofwindowsin themainpanemod1 + j - focusthenextwindowcounterclockwisemod1 + k - focusthenextwindowclockwisemod2 + j - movethefocusedwindowonespacecounterclockwisemod2 + k - movethefocusedwindowonespaceclockwisemod2 + h - movethefocusedwindowonewindowcounterclockwisemod2 + l - movethefocusedwindowonewindowclockwisemod1 + return - swapthefocusedwindowwiththemainwindowmod1 + t - togglewhetheror not thefocusedwindowis floatingmod2 + t - togglegloballywhetheror not Amethysttileswindowsmod1 + i - displaythecurrentlayoutfor each screenmod1 + z - forcewindowsto bereevalulated 


Spaces are, unfortunately, not supported right out of the box. To enable it you must activate Mission Control’s keyboard shortcuts for switching to specific Desktops, as Mac OS X calls them. This option is in the Keyboard Shortcuts tab of the Keyboard preferences pane. The shortcuts will be of the form ctrl + [n]. Amethyst is only able to send a window to the nth space if the shortcut ctrl + n is enabled.

缺点: space需要手动创建,未提供space设置,当前layout窗口的位置等等

Hammerspoon & Phoenix

这两个都是堆叠式的,都为 cocoa 提供上层API,如下。区别是一个需要额外写lua脚本,一个是js

* Keys* Events* Preferences* Require* Phoenix* Storage* Point* Size* Rectangle* Identifiable* Iterable* Key* Event* Timer* Task* Modal* Screen* Space* Mouse* App* Window 

另外,因为 cocoa 并没有提供太多关于spaces的api,所以无论是 hammerspoon 还是 phoenix 对spaces的支持都不是很完美。以下是作者的原话:

I’ve been hacking around and adding support for moving windows between spaces is doable and works rather well. However, I cannot figure out a way to get a list of all the spaces in the order the user has them sorted in Mission Control.

后来 phoenix 作者想到了一些办法,但结果也是类似 Amethyst 只能将窗口移动至Spaces,而不能决定Spaces的状态。Hammerspoon的作者将spaces module列入undocumented,提供了更多关于Space的接口,但并不推荐尝试。反正我试了下,出现一个特别严重的问题是接入双屏时,系统自动创建了一个space,但不是由 hammerspoon 提供的api创建,所以你不能对它进行任何操作。但我还是把这undocumented写在配置文件里了…

至于TotalSpaces2, 它是完美支持spaces的,但是:

the TotalSpaces2 page state that they do some code injection, which is the reason why you need to disable some security feature in El Capitan for it to work.


Kwm的作者把 hammerspoon 中undocumented关于spaces的api整合进去了

# Change focus between spaces, skipping transitions animation# (mission control does not update, requires `killall Dock`)kwmc space -fExperimental {space}    {space}: workspace_id | name | previous | left | right 


Considering how the scratchpad system works, I’ve been thinking of extending / revamping or simply just implement a separate feature that allow windows to be tagged.


Dev : editor + compiler + terminal + manpagesWeb:  browser + irc / slackMonitoring : netstat + ps 

再说明一点,Kwm比较纯粹,只关注平辅式窗口管理,这点比较符合unix思想。而且它搭配 Übersicht 真的很酷,这里有视频介绍 Youtube


CreateWindowRules  WindowFilter  WindowProperties  ExampleRulesConfigureKwm  WindowBorders  Global Defaults  DisplayDefaults  SpaceDefaultsInteractwithKwm  Windows  Displays  Spaces  Tree  ScratchpadQuerycurrentstate  Windows  Tiling  Spaces  Scratchpad  其它 Slate 多年未更新 Mjolnir hammerspoon是fork它的,同样多年未更新 对于非平辅窗口管理,如果你正在使用Moom, Divvy, SizeUp,那么我推荐 Spectacle ,开箱即用且免费