File: goto_multihead.lua

package info (click to toggle)
notion 3%2B2014010901-1
  • links: PTS, VCS
  • area: non-free
  • in suites: jessie, jessie-kfreebsd
  • size: 4,940 kB
  • ctags: 6,104
  • sloc: ansic: 46,870; sh: 2,008; makefile: 598; perl: 270
file content (38 lines) | stat: -rw-r--r-- 967 bytes parent folder | download
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
-- Authors: Unknown
-- License: Unknown
-- Last Changed: Unknown
-- 
-- A version of ioncore.goto_next that may be useful on multihead setups
-- Replace ioncore.goto_next with goto_multihead.goto_next in cfg_tiling.lua
-- to use it.

goto_multihead={}

function goto_multihead.goto_next(ws, dir)
    if dir=="up" or dir=="down" then
        ioncore.goto_next(ws:current(), dir)
        return
    end
    
    local nxt, nxtscr
    
    nxt=ioncore.navi_next(ws:current(), dir, {nowrap=true})
    
    if not nxt then
        local otherdir
        local fid=ioncore.find_screen_id
        if dir=="right" then
            otherdir="left"
            nxtscr=fid(ws:screen_of():id()+1) or fid(0)
        else
            otherdir="right"
            nxtscr=fid(ws:screen_of():id()-1) or fid(-1)
        end
        nxt=nxtscr:current():current()
        if obj_is(nxt, "WTiling") then
            nxt=nxt:farthest(otherdir)
        end
    end
    
    nxt:goto()
end