From ed62356757f5af01843e1fcc2fdda515bbe16370 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Mon, 30 Jan 2017 08:55:02 +0100 Subject: awesome 4 hit stretch --- config/awesome/rc.lua | 94 ++++++++++++++++++++--------------------- config/awesome/weasel-rules.lua | 29 +++++++------ 2 files changed, 61 insertions(+), 62 deletions(-) (limited to 'config') diff --git a/config/awesome/rc.lua b/config/awesome/rc.lua index e6056fa..91d78f7 100644 --- a/config/awesome/rc.lua +++ b/config/awesome/rc.lua @@ -79,25 +79,6 @@ local layouts = } -- }}} --- {{{ Wallpaper -if beautiful.wallpaper then - for s = 1, screen.count() do - gears.wallpaper.maximized(beautiful.wallpaper, s, true) - end -end --- }}} - --- {{{ Tags --- Define a tag table which hold all screen tags. -tags = {} -for s = 1, screen.count() do - -- Each screen has its own tag table. - -- tags[s] = awful.tag({ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }, s, layouts[1]) - --tags[s] = awful.tag({ 1, 2, 3, 4, 5, 6, 7, 8, 9 }, s, layouts[1]) - -- tags[s] = awful.tag({ 1, 2, 3, 4, 5, "q", "w", "e", "r", "t", "A", "S", "D", "F", "G" }, s, layouts[1]) - tags[s] = awful.tag({ 1, 2, 3, 4, 5, "11", "12", "13", "14", "15", "21", "22", "23", "24", "25" }, s, layouts[1]) -end --- }}} -- {{{ Menu -- Create a laucher widget and a main menu @@ -175,33 +156,49 @@ mytasklist.buttons = awful.util.table.join( if client.focus then client.focus:raise() end end)) -for s = 1, screen.count() do +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 + +awful.screen.connect_for_each_screen(function(s) + set_wallpaper(s) + + awful.tag({ 1, 2, 3, 4, 5, "11", "12", "13", "14", "15", "21", "22", "23", "24", "25" }, s, layouts[1]) + -- 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( - 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))) + 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, nil, nil, wibox.layout.fixed.horizontal()) - 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) - mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.alltags, mytasklist.buttons) + s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.alltags, mytasklist.buttons) -- Create the wibox - mywibox[s] = awful.wibox({ position = "bottom", screen = s }) + s.mywibox = awful.wibox({ position = "bottom", 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() @@ -209,16 +206,16 @@ for s = 1, screen.count() do right_layout:add(battery_widget) right_layout:add(volume_widget) right_layout:add(mytextclock) - 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) -- }}} -- {{{ Mouse bindings @@ -302,7 +299,7 @@ globalkeys = awful.util.table.join( end), -- weasel - awful.key({ modkey }, "`", function () mypromptbox[mouse.screen]:run() end), + awful.key({ modkey }, "`", function () awful.screen.focused().mypromptbox:run() end), awful.key({ "Ctrl", "Mod1" }, "BackSpace", awesome.quit), awful.key({ modkey, }, "F1", function () awful.layout.set(awful.layout.suit.floating) end), @@ -345,13 +342,13 @@ globalkeys = awful.util.table.join( -- more weasel local function viewidx_no_wrap(num_cols, delta_rows, delta_cols) - local screen = mouse.screen + local screen = awful.screen.focused() local cur = awful.tag.getidx() local cc = (cur-1) % num_cols local jump = delta_rows * num_cols + delta_cols if cc + delta_cols >= 0 and cc + delta_cols < num_cols and - cur + jump > 0 and cur + jump <= #tags[screen] then + cur + jump > 0 and cur + jump <= #screen.tags then awful.tag.viewidx(jump) end end @@ -373,20 +370,20 @@ globalkeys = awful.util.table.join( globalkeys = awful.util.table.join(globalkeys, -- View tag only. awful.key({ modkeytag }, tag_keys[i], function () - local screen = mouse.screen - local tag = awful.tag.gettags(screen)[i] + local screen = awful.screen.focused() + local tag = screen.tags[i] if tag then awful.tag.viewonly(tag) end end), -- Toggle tag. awful.key({ modkeytag, "Shift" }, tag_keys[i], function () - local screen = mouse.screen - local tag = awful.tag.gettags(screen)[i] + local screen = awful.screen.focused() + local tag = screen.tags[i] if tag then awful.tag.viewtoggle(tag) end end), -- Move client to tag. awful.key({ modkeytag, "Control" }, tag_keys[i], function () if client.focus then - local tag = awful.tag.gettags(client.focus.screen)[i] + local tag = client.focus.screen.tags[i] if tag then awful.client.movetotag(tag) -- awful.tag.viewonly(tag) @@ -396,7 +393,7 @@ globalkeys = awful.util.table.join( -- Toggle tag. awful.key({ modkeytag, "Control", "Shift" }, tag_keys[i], function () if client.focus then - local tag = awful.tag.gettags(client.focus.screen)[i] + local tag = client.focus.screen.tags[i] if tag then awful.client.toggletag(tag) end end end) @@ -415,9 +412,7 @@ clientkeys = awful.util.table.join( -- awful.key({ "Mod1" }, "q", function (c) awful.key({ modkey2 }, "`", function (c) if c.sticky then - local screen = mouse.screen - -- local tags = awful.tag.selectedlist(screen) - -- awful.client.movetotag(tags[1]) + local screen = awful.screen.focused() local tag = awful.tag.selected(screen) awful.client.movetotag(tag) end @@ -530,6 +525,7 @@ awful.rules.rules = { properties = { border_width = beautiful.border_width, border_color = beautiful.border_normal, focus = awful.client.focus.filter, + screen = awful.screen.focused, raise = true, keys = clientkeys, buttons = clientbuttons } }, @@ -572,7 +568,7 @@ function setup_titlebar(c) --right_layout:add(awful.titlebar.widget.maximizedbutton(c)) right_layout:add(awful.titlebar.widget.stickybutton(c)) --right_layout:add(awful.titlebar.widget.ontopbutton(c)) - right_layout:add(awful.titlebar.widget.closebutton(c)) + --right_layout:add(awful.titlebar.widget.closebutton(c)) -- The title goes in the middle local middle_layout = wibox.layout.flex.horizontal() diff --git a/config/awesome/weasel-rules.lua b/config/awesome/weasel-rules.lua index 5a0a1ae..9c48ba5 100644 --- a/config/awesome/weasel-rules.lua +++ b/config/awesome/weasel-rules.lua @@ -1,7 +1,10 @@ +local awful = require("awful") + function get_weasel_rules() - local sn = screen.count() - local browser_screen = 1 - local im_screen = 1 + local browser_screen = awful.screen.focused() + local im_screen = awful.screen.focused() + local browser_screen = screen[1] + local im_screen = screen[1] local rules = { { rule = { class = "mpv" }, @@ -14,31 +17,31 @@ function get_weasel_rules() properties = { floating = true } }, { rule = { class = "Firefox" , name = "Mozilla Firefox" }, - properties = { tag = tags[browser_screen][7], + properties = { tag = browser_screen.tags[7], --border_width = 0 } }, { rule = { class = "Firefox" }, - properties = { tag = tags[browser_screen][7] } }, + properties = { tag = browser_screen.tags[7] } }, { rule = { class = "chromium" }, -- , name = "New Tab - Chromium" }, - properties = { tag = tags[browser_screen][8], + properties = { tag = browser_screen.tags[8], -- border_width = 0 } }, { rule = { class = "Tor Browser" , name = "Tor Browser" }, - properties = { tag = tags[browser_screen][12], floating = true } }, + properties = { tag = browser_screen.tags[12], floating = true } }, { rule = { class = "Tor Browser" }, - properties = { tag = tags[browser_screen][12], floating = true } }, + properties = { tag = browser_screen.tags[12], floating = true } }, { rule = { class = "URxvt" , name = "IRC" }, - properties = { tag = tags[im_screen][1] } }, + properties = { tag = im_screen.tags[1] } }, { rule = { class = "URxvt" , name = "Mail" }, - properties = { tag = tags[im_screen][6] } }, + properties = { tag = im_screen.tags[6] } }, { rule = { class = "URxvt" , name = "Mail COSY" }, - properties = { tag = tags[im_screen][6] } }, + properties = { tag = im_screen.tags[6] } }, { rule = { class = "chromium" , name = "Signal Private Messenger" }, - properties = { tag = tags[im_screen][11] } }, + properties = { tag = im_screen.tags[11] } }, { rule = { class = "chromium" , name = "Signal" }, - properties = { tag = tags[im_screen][11] } }, + properties = { tag = im_screen.tags[11] } }, --{ rule = { maximized_horizontal = true }, -- these two should remove window borders from maximized windows because they get in the way -- properties = { border_width = 0 } }, -- cgit v1.2.3