]> git.rmz.io Git - dotfiles.git/commitdiff
awesome: update to 4.0 (at least partially)
authorSamir Benmendil <me@rmz.io>
Mon, 30 Jan 2017 01:10:20 +0000 (01:10 +0000)
committerSamir Benmendil <me@rmz.io>
Mon, 30 Jan 2017 01:10:20 +0000 (01:10 +0000)
awesome/rc.lua
awesome/rules.lua
awesome/tags.lua
awesome/topbar.lua

index 6ba97494237f53ec397d834166cdb3dfa5b87aeb..c4f3d6294cae5e57e366f0bd55d8397d8512bfe5 100644 (file)
@@ -43,12 +43,21 @@ editor = os.getenv("EDITOR") or "vim"
 editor_cmd = terminal .. " -e " .. editor
 
 -- Wallpaper {{{1
-if beautiful.wallpaper then
-    for s = 1, screen.count() do
-        gears.wallpaper.maximized(beautiful.wallpaper, s, true)
+local function set_wallpaper(s)
+    -- Wallpaper
+    if beautiful.wallpaper then
+        local wallpaper = beautiful.wallpaper
+        -- If wallpaper is a function, call it with the screen
+        if type(wallpaper) == "function" then
+            wallpaper = wallpaper(s)
+        end
+        gears.wallpaper.maximized(wallpaper, s, true)
     end
 end
 
+-- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
+screen.connect_signal("property::geometry", set_wallpaper)
+
 -- Require files {{{1
 require("bindings")
 require("tags")
index 20fa19aea3b5c7c3ebc5cdb979ecc51e51bcb776..2b2fb73d6e0149d7d5265418bd4e546e646a7bda 100644 (file)
@@ -22,6 +22,7 @@ awful.rules.rules = {
                      border_color = beautiful.border_normal,
                      focus = awful.client.focus.filter,
                      keys = clientkeys,
+                     screen = awful.screen.preferred,
                      buttons = clientbuttons } },
     { rule = { class = "Sensation Editor Standard" },
       properties = { floating = true } },
index 8d9dfd3eba0d6973b2d7b372d88060acb0fd2055..bce442393fd199594fb0a625eeaa6cd1501f5bf6 100644 (file)
@@ -24,6 +24,7 @@ local mytags = {}
 local path = beautiful.path
 local icon_only = true
 
+--TODO create a list of tag objects and place them according to number of screens  (sb:20170130)
 -- single screen {{{2
 mytags[1] = {}
 mytags[1][1] = {
@@ -67,7 +68,8 @@ mytags[2][2] = {
 -- Tags {{{2
 tags = {}
 local sc = screen.count()
-for s = 1, sc do
+awful.screen.connect_for_each_screen(function(screen)
+    local s = screen.index
     tags[s] = {}
     for i,p in ipairs(mytags[sc][s]) do
         local props = {}
@@ -79,4 +81,4 @@ for s = 1, sc do
         tags[s][i] = awful.tag.add(p.name, props)
     end
     tags[s][1].selected = true
-end
+end)
index 4d5d50546d28b9cae5cc6e6f17143366f610af25..84e30ac7b42680eeeb01938cca154c8707ef4a17 100644 (file)
@@ -59,35 +59,35 @@ mytasklist.buttons = awful.util.table.join(
                                           end))
 
 
-for s = 1, screen.count() do
+awful.screen.connect_for_each_screen(function(s)
     -- Create a promptbox for each screen
-    mypromptbox[s] = awful.widget.prompt()
+    s.mypromptbox = awful.widget.prompt()
     -- Create an imagebox widget which will contains an icon indicating which layout we're using.
     -- We need one layoutbox per screen.
-    mylayoutbox[s] = awful.widget.layoutbox(s)
-    mylayoutbox[s]:buttons(awful.util.table.join(
+    s.mylayoutbox = awful.widget.layoutbox(s)
+    s.mylayoutbox:buttons(awful.util.table.join(
                            awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
                            awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
                            awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
                            awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
     -- Create a taglist widget
-    mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
+    s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
 
     -- Create a tasklist widget
-    mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
+    s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
 
     -- Create the wibox
-    mywibox[s] = awful.wibox({ position = "top", screen = s })
+    s.mywibox = awful.wibox({ position = "top", screen = s })
 
     -- Widgets that are aligned to the left
     local left_layout = wibox.layout.fixed.horizontal()
     -- left_layout:add(mylauncher)
-    left_layout:add(mytaglist[s])
-    left_layout:add(mypromptbox[s])
+    left_layout:add(s.mytaglist)
+    left_layout:add(s.mypromptbox)
 
     -- Widgets that are aligned to the right
     local right_layout = wibox.layout.fixed.horizontal()
-    if s == 1 then right_layout:add(wibox.widget.systray()) end
+    right_layout:add(wibox.widget.systray())
     right_layout:add(separator)
     right_layout:add(require("widgets/awesompd"))
     right_layout:add(require("widgets/volume_widget"))
@@ -99,13 +99,13 @@ for s = 1, screen.count() do
     right_layout:add(require("widgets/network_widget"))
     right_layout:add(separator)
     right_layout:add(require("widgets/calendar"))
-    right_layout:add(mylayoutbox[s])
+    right_layout:add(s.mylayoutbox)
 
     -- Now bring it all together (with the tasklist in the middle)
     local layout = wibox.layout.align.horizontal()
     layout:set_left(left_layout)
-    layout:set_middle(mytasklist[s])
+    layout:set_middle(s.mytasklist)
     layout:set_right(right_layout)
 
-    mywibox[s]:set_widget(layout)
-end
+    s.mywibox:set_widget(layout)
+end)