首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

有趣的 Ion 窗口管理器程序清单(2)

有趣的 Ion 窗口管理器程序清单(2)

清单 3. ionws.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
ionws_bindings{
-- I seldom have more than 2 vertical splits in an Ion workspace, so
-- I don't need dedicated keys to moving left and right between
-- them.  Since 6 and 4 were taken for tab navigation, I use the keypad
-- 5 to go to the next split to the left.  I can always go right with
-- Alt+Tab.
    kpress("KP_5" WIonWS.goto_left),
    kpress(DEFAULT_MOD.."Tab" WIonWS.goto_right),
-- horizontal splits are more frequent for me, so it's convenient to
-- move between them with the up/down (8 and 2) keypad keys.
    kpress("KP_Down", WIonWS.goto_below),
    kpress("KP_Up", WIonWS.goto_above),
}
ionframe_bindings{
-- these bindings left me make new splits in Ion.  They all use
-- the Pause key, because it's not used for anything else.
    kpress(DEFAULT_MOD.."Pause", function(frame) frame:split_empty("bottom") end),
    kpress("Pause", function(frame) frame:split_empty("right") end),
    kpress("Shift+Pause", function(frame) frame:close("right") end),
-- standard Ion functions to use the mouse when necessary
    mclick("Button1", WGenFrame.p_switch_tab, "tab"),
    mdblclick("Button1", WIonFrame.toggle_shade, "tab"),
    mdrag("Button1", WGenFrame.p_tabdrag, "tab"),
    mdrag("Button1", WGenFrame.p_resize, "border"),
    mclick("Button2", WGenFrame.p_switch_tab, "tab"),
    mdrag("Button2", WGenFrame.p_tabdrag, "tab"),
    mdrag(DEFAULT_MOD.."Button3", WGenFrame.p_resize),
}
ionframe_moveres_bindings{
-- resizing keys.  As much as I use Ion without the mouse,
-- I find it very convenient for resizing as opposed to the keyboard.
-- Your mileage may vary.
    kpress("AnyModifier+Escape", WIonFrame.cancel_resize),
    kpress("AnyModifier+Return", WIonFrame.end_resize),
    kpress("Left", function(f) f:do_resize( 1, 0, 0, 0) end),
    kpress("Right",function(f) f:do_resize( 0, 1, 0, 0) end),
    kpress("Up",   function(f) f:do_resize( 0, 0, 1, 0) end),
    kpress("Down", function(f) f:do_resize( 0, 0, 0, 1) end),
    kpress("F",    function(f) f:do_resize( 1, 0, 0, 0) end),
    kpress("B",    function(f) f:do_resize( 0, 1, 0, 0) end),
    kpress("P",    function(f) f:do_resize( 0, 0, 1, 0) end),
    kpress("N",    function(f) f:do_resize( 0, 0, 0, 1) end),
    kpress("Shift+Left", function(f) f:do_resize(-1, 0, 0, 0) end),
    kpress("Shift+Right",function(f) f:do_resize( 0,-1, 0, 0) end),
    kpress("Shift+Up",   function(f) f:do_resize( 0, 0,-1, 0) end),
    kpress("Shift+Down", function(f) f:do_resize( 0, 0, 0,-1) end),
    kpress("Shift+F",    function(f) f:do_resize(-1, 0, 0, 0) end),
    kpress("Shift+B",    function(f) f:do_resize( 0,-1, 0, 0) end),
    kpress("Shift+P",    function(f) f:do_resize( 0, 0,-1, 0) end),
    kpress("Shift+N",    function(f) f:do_resize( 0, 0, 0,-1) end),
}




注意,当您在 ion.lua 中加载         ionws 模块时,会自动加载 ionws.lua。这就是在我的 ion.lua 文件中没有显式的“explicit ionws”的原因。
返回列表