You are not logged in.

#1 2012-10-26 06:50:43

specialblend
Member
Registered: 2012-07-27
Posts: 1

Awesome menu center align

Hi guys, just wondering if anyone knows if its possible to center align the awesome menu (mod4+w one).  I have looked everywhere and can't seem to find a solution.

Thanks!

Offline

#2 2012-10-28 20:52:59

Wey
Member
Registered: 2011-04-22
Posts: 217

Re: Awesome menu center align

Hello specialblend, and welcome on board. Could you elaborate what you mean with center align? Do you simply mean centering the menu on screen? That would be as easy as modifying /usr/share/awesome/lib/awful/menu.lua, at line ~320 (~144 in the git version), you could remove / comment out the lines marked with a "-" and add the lines marked with a "+":

         _menu.x = _menu.parent.x + w + _menu.width > screen_w and
                  _menu.parent.x - _menu.width or _menu.parent.x + w
     else
-        if m_coords == nil then
-            m_coords = capi.mouse.coords()
-            m_coords.x = m_coords.x + 1
-            m_coords.y = m_coords.y + 1
-        end
-        _menu.y = m_coords.y < s_geometry.y and s_geometry.y or m_coords.y
-        _menu.x = m_coords.x < s_geometry.x and s_geometry.x or m_coords.x
-
-        _menu.y = _menu.y + _menu.height > screen_h and
-                 screen_h - _menu.height or _menu.y
-        _menu.x = _menu.x + _menu.width  > screen_w and
-                 screen_w - _menu.width  or _menu.x
+        _menu.x = (screen_w - _menu.width)/2
+        _menu.y = (screen_h - _menu.height)/2
     end

     _menu.wibox.x = _menu.x
     _menu.wibox.y = _menu.y

The code in this sections checks whether the menu in question has a parent. If not (the else block), we assign the half the screen width, resp. height minus the menu width, resp. height to the menus x/y coordinates. Yours could look slightly different when you are using the stable package.

(To comment out a line in lua, preceed it with a "--")

Last edited by Wey (2012-10-29 08:20:52)

Offline

Board footer

Powered by FluxBB