--- {{{ Hooks
--- Hook function to execute when focusing a client.
-awful.hooks.focus.register(function (c)
- if not awful.client.ismarked(c) then
- c.border_color = beautiful.border_focus
- end
-end)
-
--- Hook function to execute when unfocusing a client.
-awful.hooks.unfocus.register(function (c)
- if not awful.client.ismarked(c) then
- c.border_color = beautiful.border_normal
- end
-end)
-
--- Hook function to execute when marking a client
-awful.hooks.marked.register(function (c)
- c.border_color = beautiful.border_marked
-end)
-
--- Hook function to execute when unmarking a client.
-awful.hooks.unmarked.register(function (c)
- c.border_color = beautiful.border_focus
-end)
-
--- Hook function to execute when the mouse enters a client.
-awful.hooks.mouse_enter.register(function (c)
- -- Sloppy focus, but disabled for magnifier layout
- if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
- and awful.client.focus.filter(c) then
- client.focus = c
- end
-end)
-
--- Hook function to execute when a new client appears.
-awful.hooks.manage.register(function (c, startup)
- -- If we are not managing this application at startup,
- -- move it to the screen where the mouse is.
- -- We only do it for filtered windows (i.e. no dock, etc).
- if not startup and awful.client.focus.filter(c) then
- c.screen = mouse.screen
- end
-
- if use_titlebar then
- -- Add a titlebar
- awful.titlebar.add(c, { modkey = modkey })
- end
- -- Add mouse bindings
- c:buttons({
- button({ }, 1, function (c) client.focus = c; c:raise() end),
- button({ modkey }, 1, awful.mouse.client.move),
- button({ modkey }, 3, awful.mouse.client.resize)
- })
- -- New client may not receive focus
- -- if they're not focusable, so set border anyway.
- c.border_width = beautiful.border_width
- c.border_color = beautiful.border_normal
-
- -- Check if the application should be floating.
- -- OVERRIDDEN, SEE tiledapps BELOW
- local cls = c.class
- local inst = c.instance
- if floatapps[cls] then
- awful.client.floating.set(c, floatapps[cls])
- elseif floatapps[inst] then
- awful.client.floating.set(c, floatapps[inst])
- end
-
- -- Override with tiledapps
- awful.client.floating.set(c, not (tiledapps[inst] or tiledapps[cls]))
-
- -- Check application->screen/tag mappings.
- local target
- if apptags[cls] then
- target = apptags[cls]
- elseif apptags[inst] then
- target = apptags[inst]
- end
- if target then
- c.screen = target.screen
- awful.client.movetotag(tags[target.screen][target.tag], c)
- end
-
- -- Do this after tag mapping, so you don't see it on the wrong tag for a split second.
- client.focus = c
-
- -- Set key bindings
- c:keys(clientkeys)
-
- -- Set the windows at the slave,
- -- i.e. put it at the end of others instead of setting it master.
- -- awful.client.setslave(c)
-
- -- Honor size hints: if you want to drop the gaps between windows, set this to false.
- c.size_hints_honor = true
-
- -- Maximise some
- if maxapps[inst] or maxapps[cls] then
- awful.client.maximize(c)
- end
-end)
-
--- Hook function to execute when arranging the screen.
--- (tag switch, new client, etc)
-awful.hooks.arrange.register(function (screen)
- local layout = awful.layout.getname(awful.layout.get(screen))
- if layout and beautiful["layout_" ..layout] then
- mylayoutbox[screen].image = image(beautiful["layout_" .. layout])
- else
- mylayoutbox[screen].image = nil
- end
+-- {{{ Rules
+awful.rules.rules = {
+ -- All clients will match this rule.
+ { rule = { },
+ properties = { border_width = beautiful.border_width,
+ border_color = beautiful.border_normal,
+ focus = true,
+ keys = clientkeys,
+ buttons = clientbuttons } },
+ { rule = { class = "MPlayer" },
+ properties = { floating = true } },
+ { rule = { class = "pinentry" },
+ properties = { floating = true } },
+ { rule = { class = "gimp" },
+ properties = { floating = true } },
+ { rule = { class = "twinkle" },
+ properties = { floating = true } },
+ { rule = { class = "Play stream" },
+ properties = { floating = true } },
+ { rule = { class = "gscan2pdf" },
+ properties = { floating = true } },
+ { rule = { class = "Add-ons" },
+ properties = { floating = true } },
+ -- Set Firefox to always map on tags number 2 of screen 1.
+ { rule = { class = "Firefox" },
+ properties = { tag = tags[1][9] } },
+ { rule = { class = "-v" },
+ properties = { tag = tags[1][8] } },
+}
+-- }}}