From: Philipp H. <ph...@ph...> - 2012-01-13 18:15:54
|
For a long time I had been desperately missing commands that would allow me quickly jump directly to my mail client, to my browser and so on. I had worked around it by giving single-letter window titles to most programs and using the gotoclient command, but I've never really liked this option. I've even considered switching to i3 several times because they explicitly mention[1] such a functionality in their user's guide, but I just can't live with dynamic tiling anymore. A week ago I finally sat down to find out if there wasn't a way to somehow achieve such a functionality in Notion and to my big surprise it was very easy. As this has truly revolutionized the way I switch between windows I thought I'd share this revelation. Maybe someone else finds it useful. Also I'd love to hear comments or suggestions for improvement (although it is working perfectly for me :)). I use the following little function (I've put it in cfg_kludges.lua): --- SNIP --- gotoclient_by_shortname = function(sn) local s ioncore.clientwin_i(function(cwin) local winprop = ioncore.getwinprop(cwin) if winprop and winprop.shortname == sn then s=cwin return false else return true end end) s:goto() return true end --- SNAP --- In the definition of the window properties I've added shortnames, for example: --- SNIP --- defwinprop{ class = "URxvt", instance = "mutt", target = "muttframe", shortname = "m" } --- SNAP --- And in my cfg_notioncore.lua I've added the following section: --- SNIP --- submap(META.."U", { kpress("a", "gotoclient_by_shortname('a')"), kpress("b", "gotoclient_by_shortname('b')"), kpress("c", "gotoclient_by_shortname('c')"), kpress("d", "gotoclient_by_shortname('d')"), kpress("e", "gotoclient_by_shortname('e')"), kpress("f", "gotoclient_by_shortname('f')"), kpress("g", "gotoclient_by_shortname('g')"), kpress("h", "gotoclient_by_shortname('h')"), kpress("i", "gotoclient_by_shortname('i')"), kpress("j", "gotoclient_by_shortname('j')"), kpress("k", "gotoclient_by_shortname('k')"), kpress("l", "gotoclient_by_shortname('l')"), kpress("m", "gotoclient_by_shortname('m')"), kpress("n", "gotoclient_by_shortname('n')"), kpress("o", "gotoclient_by_shortname('o')"), kpress("p", "gotoclient_by_shortname('p')"), kpress("q", "gotoclient_by_shortname('q')"), kpress("r", "gotoclient_by_shortname('r')"), kpress("s", "gotoclient_by_shortname('s')"), kpress("t", "gotoclient_by_shortname('t')"), kpress("u", "gotoclient_by_shortname('u')"), kpress("v", "gotoclient_by_shortname('v')"), kpress("w", "gotoclient_by_shortname('w')"), kpress("x", "gotoclient_by_shortname('x')"), kpress("y", "gotoclient_by_shortname('y')"), kpress("z", "gotoclient_by_shortname('z')"), }), --- SNAP --- I can now conveniently switch to my mail client by pressing Alt+u and then m. Of course there is no need to use a submap so that even faster bindings like Alt+m can be used if desired. Regards, Philipp [1] http://i3wm.org/docs/userguide.html#_jumping_to_specific_windows |