From: Samir Benmendil Date: Mon, 30 Jan 2017 01:10:20 +0000 (+0000) Subject: awesome: update to 4.0 (at least partially) X-Git-Url: https://git.rmz.io/dotfiles.git/commitdiff_plain/149d3b5992793ad59d7785efa6facc8e374514a3?ds=inline awesome: update to 4.0 (at least partially) --- diff --git a/awesome/rc.lua b/awesome/rc.lua index 6ba9749..c4f3d62 100644 --- a/awesome/rc.lua +++ b/awesome/rc.lua @@ -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") diff --git a/awesome/rules.lua b/awesome/rules.lua index 20fa19a..2b2fb73 100644 --- a/awesome/rules.lua +++ b/awesome/rules.lua @@ -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 } }, diff --git a/awesome/tags.lua b/awesome/tags.lua index 8d9dfd3..bce4423 100644 --- a/awesome/tags.lua +++ b/awesome/tags.lua @@ -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) diff --git a/awesome/topbar.lua b/awesome/topbar.lua index 4d5d505..84e30ac 100644 --- a/awesome/topbar.lua +++ b/awesome/topbar.lua @@ -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)