diff options
author | Anton Khirnov <anton@khirnov.net> | 2020-04-08 17:44:01 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2020-04-08 17:44:57 +0200 |
commit | 15372f7dcfc027cd5bf767584de0e826cc876612 (patch) | |
tree | ea13500381c47e3ce770a1785af032504baaf541 /utils.lua | |
parent | 97d9056f352865dcd04ffae09b62ec4e36ed4959 (diff) |
utils: work with screen objects rather than indices
Diffstat (limited to 'utils.lua')
-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 |