awesomeWM / awesome-www

Website of AwesomeWM
https://awesomewm.org/
56 stars 34 forks source link

Update xrandr.lua #145

Closed psychon closed 5 years ago

psychon commented 5 years ago

This is supposed to fix https://github.com/awesomeWM/awesome/issues/2802.

Note that I did not really test this code. I only did this:

local rtable = table
local gtable = { }
mouse = { screen = 42 }
function gtable.hasitem(t, item)
    for k, v in pairs(t) do
        if v == item then
            return k
        end
    end
end
function gtable.join(...)
    local ret = {}
    for i = 1, select("#", ...) do
        local t = select(i, ...)
        if t then
            for k, v in pairs(t) do
                if type(k) == "number" then
                    rtable.insert(ret, v)
                else
                    ret[k] = v
                end
            end
        end
    end
    return ret
end
package.loaded["gears.table"] = gtable
package.loaded.naughty = { notify = function(args) print(args.text) return {id = 42 }end }
package.loaded.awful = { }
xrandr = dofile("/home/psychon/projects/awesome-www/recipes/xrandr.lua")

for k, v in pairs(xrandr.outputs()) do print(k, v) end
for k, v in pairs(xrandr.arrange({1,2,3})) do print(k, unpack(v)) end
for k, v in pairs(xrandr.arrange(xrandr.outputs())) do print(k, unpack(v)) end
xrandr.xrandr()
xrandr.xrandr()
xrandr.xrandr()
xrandr.xrandr()
xrandr.xrandr()
xrandr.xrandr()
xrandr.xrandr()

(Also: Boy, this xrandr module is difficult and non-intuitive to use....)

Tejes commented 4 years ago

Just ran into this issue on Ubuntu 19.10. The deployed script on the website is still the old one with unpack.

psychon commented 4 years ago

Sigh. No idea what is going on, but the git push on Travis build fails (I only looked at the latest commit):

To https://github.com/awesomeWM/awesomeWM.github.io
 ! [rejected]          master -> master (fetch first)
error: failed to push some refs to 'https://GH_APIDOC_TOKEN@github.com/awesomeWM/awesomeWM.github.io'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
{"result":{"id":"[secure]"},"success":true,"errors":[],"messages":[]}
psychon commented 4 years ago

I restarted the built. Seems to have worked.