Created
September 9, 2015 18:57
-
-
Save blueyed/d7ba5d51fafff1605fff to your computer and use it in GitHub Desktop.
Revisions
-
blueyed created this gist
Sep 9, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ -- Generic back and forth switching between master and client. {{{ -- Bind it like this: -- awful.key({ modkey, "Control" }, "Return", function (c) my_swap_back_and_forth.run(c, awful.client.getmaster) end), local my_swap_back_and_forth = { previous_by_tag_and_f = {} } my_swap_back_and_forth.run = function (c, swapf) local f = swapf or awful.client.getmaster local prev = my_swap_back_and_forth.previous_by_tag_and_f if not prev.tag then prev.tag = {} end local swap_with = f() local tag = c:tags()[1] if c == swap_with then if prev.tag.f then swap_with = prev.tag.f else bnote("No previous client to swap with.") return end end prev.tag.f = swap_with c:swap(swap_with) end -- }}}