Search code examples
luaarchlinuxawesome-wm

How to pass DISPLAY information in lua language?


I am running Arch linux and trying to configure awesome WM for two graphics cards with two Screens. So, I am running awesome twice, each one on different display. So, in

.xprofile

DISPLAY=:0.1 awesome &

while awesome running in DISPLAY=:0.0 too. Although, those two awesome instances running with one configuration file, written in lua language.

So, I want to write an If statement in this lua language configuration file, which checks if DISPLAY= first or second screen to assign different tags in each screen. Is this possible? I have minimal knowledge of lua language and i am willing to learn.

Thanks


Solution

  • I don't know about awesome, but in stock Lua you can use os.getenv("DISPLAY") to get the value of the DISPLAY environment variable.

    So you do something like this:

    if os.getenv("DISPLAY")==":0.0" then
      -- do something
    else
      -- do something else
    end