Most readers of this list probably already have their keybindings in
muscle memory, but for new users and posterity I'm attaching a set of
keybindings which deviates greatly from the defaults but I find much more
intuitive.

There's one last thing I want to do, which is emulate windows' "Tab"
functionality. Basically when you hit tab you move backwards through a
stack of last-visited frames -- when you stop on a frame it moves to the
top of the stack. If anyone else is interested I'll post the code here
when it's done.
include("querylib")
include("menulib")

global_bindings{
        -- Create a new workspace with a default name.
        kpress(DEFAULT_MOD.."grave", function (s) s:attach_new({ type="WIonWS", 
switchto=true }) end),
        kpress(SECOND_MOD.."grave", function (s) s:attach_new({ type="WFloatWS", 
switchto=true}) end),
        kpress(DEFAULT_MOD.."1", function (s) s:switch_nth(0) end),
        kpress(DEFAULT_MOD.."2", function (s) s:switch_nth(1) end),
        kpress(DEFAULT_MOD.."3", function (s) s:switch_nth(2) end),
        kpress(DEFAULT_MOD.."4", function (s) s:switch_nth(3) end),
        kpress(DEFAULT_MOD.."5", function (s) s:switch_nth(4) end),
        kpress(DEFAULT_MOD.."Page_Up", WScreen.switch_prev),
        kpress(DEFAULT_MOD.."Page_Down", WScreen.switch_next),

        kpress(DEFAULT_MOD.."Tab", goto_next_screen),
        
        kpress(DEFAULT_MOD.."F1", querylib.query_man),
        kpress(DEFAULT_MOD.."F2", make_exec_fn("x-terminal-emulator")),
        kpress(DEFAULT_MOD.."F3", querylib.query_ssh),
        kpress(DEFAULT_MOD.."F12", restart_wm),
        kpress(SECOND_MOD.."F12", exit_wm),

        kpress(DEFAULT_MOD.."G", querylib.query_gotoclient),
        kpress(DEFAULT_MOD.."G", querylib.query_gotoclient),
        kpress(DEFAULT_MOD.."X", querylib.query_exec),
        kpress(SECOND_MOD.."X", querylib.query_lua),
        kpress(DEFAULT_MOD.."J", querylib.query_gotoclient),

        kpress(DEFAULT_MOD.."Escape", make_bigmenu_fn("mainmenu")),
}

mplex_bindings{
        submap(DEFAULT_MOD.."C"){
                kpress("AnyModifier+C", WRegion.close_sub_or_self),
                kpress("AnyModifier+K", make_mplex_clientwin_fn(WClientWin.kill)),
        },
        kpress(DEFAULT_MOD.."L", 
make_mplex_clientwin_fn(WClientWin.broken_app_resize_kludge)),
        kpress(DEFAULT_MOD.."Return", 
make_mplex_clientwin_fn(WClientWin.toggle_fullscreen)),
        kpress(DEFAULT_MOD.."Q", make_mplex_clientwin_fn(WClientWin.quote_next)),
}

genframe_bindings{
        mclick("Button1", WGenFrame.p_switch_tab, "tab"),
        mclick("Button2", WRegion.close_sub_or_self, "tab"),
        mdrag("Button2", WGenFrame.p_tabdrag, "tab"),
        mdrag(DEFAULT_MOD.."Button3", WGenFrame.p_resize),
        mdrag(DEFAULT_MOD.."Button3", WGenFrame.p_resize, "border"),
        mdrag(DEFAULT_MOD.."Button3", WGenFrame.p_resize, "tab"),
        mdrag(DEFAULT_MOD.."Button3", WGenFrame.p_resize, "empty_tab"),

        kpress(DEFAULT_MOD.."Left", WGenFrame.switch_prev),
        kpress(DEFAULT_MOD.."Right", WGenFrame.switch_next),

        kpress(DEFAULT_MOD.."bracketleft", function (f) 
f:move_to_prev_index(f:current()) end),
        kpress(DEFAULT_MOD.."bracketright", function (f) 
f:move_to_next_index(f:current()) end),
        kpress(DEFAULT_MOD.."N", querylib.query_renameframe),
        submap(DEFAULT_MOD.."T"){
                kpress("AnyModifier+T", make_mplex_sub_fn(WRegion.toggle_tag)),
                kpress("AnyModifier+B", WGenFrame.toggle_tab),
        },
        submap(DEFAULT_MOD.."A"){
                kpress("AnyModifier+T", WGenFrame.attach_tagged),
                kpress("AnyModifier+A", querylib.query_attachclient),
        },

        -- Menus
        kpress(DEFAULT_MOD.."M", make_menu_fn("ctxmenu")),
        mpress("Button3", make_pmenu_fn("ctxmenu"), "tab"),
}
--
-- Ion ionws module configuration file
--

ionws_bindings{
        kpress(SECOND_MOD.."Up", WIonWS.goto_above),
        kpress(DEFAULT_MOD.."Up", WIonWS.goto_above),
        kpress(SECOND_MOD.."Down", WIonWS.goto_below),
        kpress(DEFAULT_MOD.."Down", WIonWS.goto_below),
        kpress(SECOND_MOD.."Right", WIonWS.goto_right),
        kpress(SECOND_MOD.."Left", WIonWS.goto_left),
}

ionframe_bindings{
        mdrag("Button1", WGenFrame.p_tabdrag, "tab"),

        submap(DEFAULT_MOD.."S"){
                kpress("AnyModifier+Right", function(frame) frame:split_empty("right") 
end),
                kpress("AnyModifier+Left", function(frame) frame:split_empty("left") 
end),
                kpress("AnyModifier+Up", function(frame) frame:split_empty("top") end),
                kpress("AnyModifier+Down", function(frame) frame:split_empty("bottom") 
end),
        },
        kpress(DEFAULT_MOD .. "R", WIonFrame.begin_resize),
}


-- Frame resize mode bindings

ionframe_moveres_bindings{
        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("Control+Left", function(f) f:do_resize(-1, 0, 0, 0) end),
        kpress("Control+Right",function(f) f:do_resize( 0,-1, 0, 0) end),
        kpress("Control+Up",   function(f) f:do_resize( 0, 0,-1, 0) end),
        kpress("Control+Down", function(f) f:do_resize( 0, 0, 0,-1) end),
}
floatws_bindings {
        kpress("Mod4+Down", function(ws) ws:circulate():raise() end),
        kpress("Mod4+Up", function(ws) ws:backcirculate():raise() end),
}

floatframe_bindings{
        mpress("Button1", WRegion.raise, "tab"),
        mpress("Button1", WRegion.raise, "border"),
        mdrag("Button1", WGenFrame.p_resize, "border"),
        mdrag("Button1", WFloatFrame.p_move, "tab"),
        mdrag(DEFAULT_MOD.."Button1", WFloatFrame.p_move),

        mclick(DEFAULT_MOD.."Button1", WRegion.raise),
        mclick(DEFAULT_MOD.."Button3", WRegion.lower),
}

Reply via email to