]> git.donarmstrong.com Git - x_base.git/blobdiff - .config/awesome/rc.lua
fix up tags and set default layout sanely
[x_base.git] / .config / awesome / rc.lua
index 684ea27a04569c717800babb99b136c4beb10933..e7e8c87174fdd9e43721fea5b47f14dc90caa11e 100644 (file)
@@ -8,6 +8,7 @@ require("beautiful")
 require("naughty")
 
 require("obvious.volume_alsa")
+require("obvious.battery")
 
 -- Load Debian menu entries
 require("debian.menu")
@@ -21,6 +22,8 @@ terminal = "x-terminal-emulator"
 editor = os.getenv("EDITOR") or "editor"
 editor_cmd = terminal .. " -e " .. editor
 
+hostname = awful.util.pread("hostname -f"):gsub("\n", "")
+
 -- Default modkey.
 -- Usually, Mod4 is the key with a logo between Control and Alt.
 -- If you do not like this or do not have such a key,
@@ -48,10 +51,15 @@ layouts =
 
 -- {{{ Tags
 -- Define a tag table which hold all screen tags.
-tags = {}
+tags = {names={"mail","emacs","www","remotes",5,6,7,8,9}
+       }
 for s = 1, screen.count() do
     -- Each screen has its own tag table.
-    tags[s] = awful.tag({ 1, 2, 3, 4, 5, 6, 7, 8, 9 }, s)
+   defaultlayout=layouts[9]
+   if s == 1 and hostname == "archimedes.ucr.edu" then
+      defaultlayout=layouts[2]
+   end
+   tags[s] = awful.tag(tags.names, s, defaultlayout)
 end
 -- }}}
 
@@ -79,6 +87,7 @@ mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon),
 mytextclock = awful.widget.textclock({ align = "right" }, " %c ", 1)
 
 myvolumealsa = obvious.volume_alsa()
+mybattery = obvious.battery()
 
 -- Create a systray
 mysystray = widget({ type = "systray" })
@@ -154,6 +163,7 @@ for s = 1, screen.count() do
         mylayoutbox[s],
         mytextclock,
        myvolumealsa,
+       mybattery,
         s == 1 and mysystray or nil,
         mytasklist[s],
         layout = awful.widget.layout.horizontal.rightleft
@@ -181,13 +191,15 @@ globalkeys = awful.util.table.join(
         function ()
             awful.client.focus.byidx( 1)
             if client.focus then client.focus:raise() end
+           warp_mouse()
         end),
     awful.key({ modkey,           }, "k",
         function ()
             awful.client.focus.byidx(-1)
             if client.focus then client.focus:raise() end
+           warp_mouse()
         end),
-    awful.key({ modkey,           }, "w", function () mymainmenu:show(true)        end),
+    awful.key({ modkey,           }, "w", function () mymainmenu:show({keygrabber=true}) end),
 
     -- Layout manipulation
     awful.key({ modkey, "Shift"   }, "j", function () awful.client.swap.byidx(  1)    end),
@@ -244,6 +256,7 @@ clientkeys = awful.util.table.join(
     awful.key({ modkey, "Control" }, "space",  awful.client.floating.toggle                     ),
     awful.key({ modkey,           }, "space", function (c) c:swap(awful.client.getmaster()) end),
     awful.key({ modkey,           }, "o",      awful.client.movetoscreen                        ),
+    awful.key({ modkey,           }, "t",      function (c) c.ontop = not c.ontop            end),
     awful.key({ modkey, "Shift"   }, "r",      function (c) c:redraw()                       end),
     awful.key({ modkey, "Shift"   }, "m",      function (c) c.minimized = not c.minimized    end),
     awful.key({ modkey,           }, "m",
@@ -311,9 +324,9 @@ awful.rules.rules = {
                      keys = clientkeys,
                      buttons = clientbuttons } },
     { rule = { class = "MPlayer" },
-      properties = { floating = true } },
+      properties = { floating = true , ontop=true } },
     { rule = { class = "pinentry" },
-      properties = { floating = true } },
+      properties = { floating = true , ontop=true } },
     { rule = { class = "gimp" },
       properties = { floating = true } },
     -- Set Firefox to always map on tags number 2 of screen 1.
@@ -349,6 +362,21 @@ client.add_signal("manage", function (c, startup)
     end
 end)
 
+function warp_mouse()
+    c = client.focus
+    if c then
+        local g = c:geometry()
+        mouse.coords({ x = g.x + 1, y = g.y + 1}, true)
+    end
+end
+
+-- for s = 1, screen.count() do
+--     screen[s]:add_signal("arrange", function (screen)
+--         warp_mouse(screen)
+--     end)
+-- end
+
+
 client.add_signal("focus", function(c) c.border_color = beautiful.border_focus end)
 client.add_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
 -- }}}