]> git.madduck.net Git - etc/awesome.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

rewrite tabs creation based on a config table
authormartin f. krafft <madduck@madduck.net>
Sun, 11 Sep 2016 08:10:06 +0000 (10:10 +0200)
committermartin f. krafft <madduck@madduck.net>
Sun, 11 Sep 2016 08:11:44 +0000 (10:11 +0200)
.config/awesome/rc.lua

index d262bf7ddd16ffafb5090d8fb961b80d3ded9724..4f9fe019eb531b4e9d93c63b642cca8ac56b5ac5 100644 (file)
@@ -94,6 +94,20 @@ local function client_menu_toggle_fn()
     end
 end
 
+local function sorted_pairs(t, f)
+    local a = {}
+    for n in pairs(t) do table.insert(a, n) end
+    table.sort(a, f)
+    local i = 0      -- iterator variable
+    local iter = function ()   -- iterator function
+        i = i + 1
+        if a[i] == nil then return nil
+        else return a[i], t[a[i]]
+        end
+    end
+    return iter
+end
+
 local function print_table(tbl, indent)
     if not indent then indent = 0 end
     for k, v in pairs(tbl) do
@@ -188,6 +202,39 @@ mytasklist.buttons = awful.util.table.join(
 -- }}}
 
 -- {{{ 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)
     -- Wallpaper
@@ -200,12 +247,14 @@ awful.screen.connect_for_each_screen(function(s)
     --DISABLED--    gears.wallpaper.maximized(wallpaper, s, true)
     --DISABLED--end
 
-    -- Each screen has its own tag table.
-    tags = awful.tag.new({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, layout_default)
-    tags[7].layout = layout_maximised
-    tags[8].layout = layout_maximised
-    tags[9].layout = layout_maximised
-    tags[1].selected = true
+    if not tags[s.index] then
+        tags[s.index] = {}
+    end
+    for n,p in 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
 
     -- Create a promptbox for each screen
     mypromptbox[s] = awful.widget.prompt()