XRandR Screen Table

From awesome

Jump to: navigation, search

[edit] XRandR Screen Table

This small function can be used to address screens by their XRandR names instead of numbers. Paste it into your rc.lua.

function xrandr_screens ()
    local screens = {}
    local counter = 1
    local handle = io.popen("xrandr -q")
    for display in handle:read("*all"):gmatch("([%a%d-]+) connected") do
        screens[display] = counter
        counter = counter + 1
    end
    handle:close()
    return screens
end


Then use it like this, for example:

screens = xrandr_screens()
client.focus.screen = screens["VGA"]

Please note that this function needs the xrandr tool installed.

Personal tools