---------------------------------------------------------------- -- ALt-Tab-style switcher. ---------------------------------------------------------------- -- Benjamin Franzke 0 then state.switcher_idx = rel - 1 elseif rel < 0 then local i = 0 local c = awful.client.focus.history.get(capi.mouse.screen, 0) while c do i = i + 1 c = awful.client.focus.history.get(capi.mouse.screen, i) end state.switcher_idx = i + rel end cli = awful.client.focus.history.get(capi.mouse.screen, state.switcher_idx) end cli:raise() if awful.client.ismarked(cli) then cli:emit_signal("marked") else awful.client.mark(cli) end end local function switcher_end() local c = awful.client.focus.history.get(capi.mouse.screen, state.switcher_idx) state.switcher_idx = 0 c:raise() awful.client.unmark(c) capi.client.focus = c end local function switch(modifiers, key, event) if event == "press" and key == state.key_next then switcher_next(1) elseif event == "press" and key == state.key_prev then switcher_next(-1) end if event == "release" and key == state.key_mod then switcher_end() capi.keygrabber.stop() return false end return true end function start(rel, key_mod, key_next, key_prev) state.switcher_idx = 0 state.key_mod = key_mod state.key_next = key_next state.key_prev = key_prev switcher_next(rel) capi.keygrabber.run(switch) end