Sunday 8 January 2012

Linux and dual monitors

I have a laptop and external monitor. In my previous installation of linux I didn't any special settings for automatic switching between dual and single monitors configurations. Because of it I have to switch it manually after connect or disconnect external monitor. In KDE I used GUI settings for it in OpenBox I used xrandr command, but both ways was not very fast and little annoying. In my new installation I decided do it something for it.
First I tried to find way to automatic switching by connecting monitor, but I haven't find this quick and may be it's not very good way. Finally I bind xrandr commands to global keys in awesome and seems that it works fine for me. There is lines that I added to rc.lua:
-- {{{ Key bindings globalkeys = awful.util.table.join( ... awful.key({ modkey, }, "s", function () awful.util.spawn_with_shell("xrandr --output VGA1 --mode preferred --left-of LVDS1") end), awful.key({ modkey, "Shift" }, "s", function () awful.util.spawn_with_shell("xrandr --output VGA1 --off") end ) )
Its adds bindings to Win+s and Win+Shift+s first change configuration to dual monitors second to single. Hope it will be useful and not annoying in future

No comments: