diff options
-rw-r--r-- | utils.lua | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -4,26 +4,26 @@ local awful = require("awful") -- mapping from logical screen indices to indices corresponding to their -- physical layout -local function map_screen_physical(n) +local function screen_physical(n) local function screen_cmp(s1, s2) - return s1[2].geometry.x < s2[2].geometry.x + return s1.geometry.x < s2.geometry.x end local screens = {} - for s = 1, screen.count() do - screens[s] = {s, screen[s]} + for s in screen do + screens[s.index] = s end table.sort(screens, screen_cmp) if screens[n] ~= nil then - return screens[n][2] + return screens[n] end return nil end function M.screen_focus_physical(n) - local s = map_screen_physical(n) + local s = screen_physical(n) if s then awful.screen.focus(s) end |