-mywibox = {}
-mypromptbox = {}
-mylayoutbox = {}
-mytaglist = {}
-mytaglist.buttons = { button({ }, 1, awful.tag.viewonly),
- button({ modkey }, 1, awful.client.movetotag),
- button({ }, 3, function (tag) tag.selected = not tag.selected end),
- button({ modkey }, 3, awful.client.toggletag),
- button({ }, 4, awful.tag.viewnext),
- button({ }, 5, awful.tag.viewprev) }
-mytasklist = {}
-mytasklist.buttons = { button({ }, 1, function (c)
- if not c:isvisible() then
- awful.tag.viewonly(c:tags()[1])
- end
- client.focus = c
- c:raise()
- end),
- button({ }, 3, function () if instance then instance:hide() end instance = awful.menu.clients({ width=250 }) end),
- button({ }, 4, function () awful.client.focus.byidx(1) end),
- button({ }, 5, function () awful.client.focus.byidx(-1) end) }
-
-for s = 1, screen.count() do
+local taglist_buttons = gears.table.join(
+ awful.button({ }, 1, function(t) t:view_only() end),
+ awful.button({ modkey }, 1, function(t)
+ if client.focus then
+ client.focus:move_to_tag(t)
+ end
+ end),
+ awful.button({ }, 3, awful.tag.viewtoggle),
+ awful.button({ modkey }, 3, function(t)
+ if client.focus then
+ client.focus:toggle_tag(t)
+ end
+ end),
+ awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end),
+ awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end)
+ )
+
+local tasklist_buttons = gears.table.join(
+ awful.button({ }, 1, function (c)
+ if c == client.focus then
+ -- I don't like click-minimising
+ -- c.minimized = true
+ else
+ -- Without this, the following
+ -- :isvisible() makes no sense
+ c.minimized = false
+ if not c:isvisible() and c.first_tag then
+ c.first_tag:view_only()
+ end
+ -- This will also un-minimize
+ -- the client, if needed
+ client.focus = c
+ c:raise()
+ end
+ end),
+ awful.button({ }, 3, client_menu_toggle_fn()),
+ awful.button({ }, 4, function ()
+ awful.client.focus.byidx(1)
+ end),
+ awful.button({ }, 5, function ()
+ awful.client.focus.byidx(-1)
+ end))
+-- }}}
+
+-- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
+screen.connect_signal("property::geometry", set_wallpaper)
+
+-- {{{ Tags
+tags = {}
+tags.config = {}
+tags.config["main"] = {
+ t1 = { layout = layout_default, selected = true },
+ t2 = { layout = layout_default },
+ t3 = { layout = layout_tiled },
+ t4 = { layout = layout_tiled },
+ t5 = { layout = layout_tiled },
+ t6 = { layout = layout_floating },
+ t7 = { layout = layout_maximised },
+ t8 = { layout = layout_maximised },
+ t9 = { layout = layout_maximised },
+}
+tags.config["aux"] = {
+ t1 = { layout = layout_default, selected = true },
+ t2 = { layout = layout_default },
+ t3 = { layout = layout_tiled },
+ t4 = { layout = layout_floating },
+ t5 = { layout = layout_floating },
+ t6 = { layout = layout_floating },
+ t7 = { layout = layout_floating },
+ t8 = { layout = layout_floating },
+ t9 = { layout = layout_maximised },
+}
+
+screentags = {}
+screentags[1] = tags.config["main"]
+if screen.count() == 2 then -- aux screen is on the right
+ screentags[2] = tags.config["aux"]
+elseif screen.count() == 3 then -- main screen is still #1 in the middle
+ screentags[2] = tags.config["aux"]
+ screentags[3] = tags.config["aux"]
+end
+
+awful.screen.connect_for_each_screen(function(s)
+ -- local fontsize = math.floor(250 * xrdb.get_dpi(s)/s.geometry.width)
+ -- beautiful.font = "Sans " .. tostring(fontsize)
+
+ if not tags[s.index] then
+ tags[s.index] = {}
+ end
+ for n,p in tblutils.sorted_pairs(screentags[s.index]) do
+ p["screen"] = s
+ n = string.sub(n, 2) -- remove leading 't' needed for syntax in table
+ table.insert(tags[s.index], awful.tag.add(n, p))
+ end
+