Automatic Screen Detection And Configuration Under Awesome WM

Recently I’m mainly interested in automating my day-to-day tasks on Linux laptop. I’ve started with automating back-up process, now come time to automate external screen detection (and configuration).

For couple of months I was struggling with ZSH history to find XRandR commands that enables and disables external screen. During that time I was almost sure that there is another way of handling this task … since eg. Gnome was doing it automatically. First idea was to find part of Gnome that is responsible for this feature and simply just integrate it with Aersome WM. But my from-time-to-time raw searches didn’t snow any interesting resources. Therefore I’ve decided that I must done it by my self … this is how screenful project was born.

What is screenful ?

It is simple extension to Awesome WM that allows you (with little knowledge of Lua and XRandR params) automatically configure connected screen. It integrates udev drm/change event with Awesome and XRandR. First of all there is udev rule that when drm/change event appears inform screenful about output change in particular card. Then screenful will “calculate” which card output was connected/disconnected, computes screen id based on EDID and finally run configured action. When configuration file doesn’t have specified configuration for this id then screenles will append commented configuration for it and run default action.

What is unique in screenful ?

Same as Awesome WM config file, the screenful config file is a Lua script! Therefore you can do anything you can imagine when external monitor is connected/disconnected. For example you can switch mplayer default audio output when you HD TV set is connected using HDMI cable then change it back when you disconnecting HDMI cable. Also you can reorganize yours tags and windows using Awesome Lua API … and more … Honestly I doubt that you can achieve similar behaviour in any different Window Manager 😉

Project is hosted on github if you encounter any issues or have ideas about new functionalities in screenful feel free to fork me, fill a bug or mail me 😉

3 Comments Automatic Screen Detection And Configuration Under Awesome WM

  1. Orfeas

    Hello.
    I’m trying to do the same thing as you but using a bash script instead of lua&awesome scripts.
    I have this rule in my udev rules:
    ACTION==”change”, SUBSYSTEM==”drm”, RUN+=”/path/to/my/script/hotplug.sh”

    and hotplug.sh is a script (that works fine on its own) that enables the external display if connected, else it disables it (all that using xrandr).

    Nothing happens when I connect my display.
    Do you have any idea what could be wrong? Do I need to start udev or does it start automatically?
    I’m using awesome 3.4.15.
    Thanks in advance!

    Reply
    1. orfeas

      Update:
      Your method doesn’t work either on my machine.
      Maybe the new versions of awesome changed something.

      Reply
  2. Damien

    Awesome! I am travelling a lot and doing a lot of presentation and even if arandr is convenient I was really missing automatic screen configuration!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *