Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for s = 1, screen.count() do
- -- Create a promptbox for each screen
- mypromptbox[s] = awful.widget.prompt()
- -- Create a textbox widget which will contains a short string representing the
- -- layout we're using. We need one layoutbox per screen.
- txtlayoutbox[s] = wibox.widget.textbox(beautiful["layout_txt_" .. awful.layout.getname(awful.layout.get(s))])
- awful.tag.attached_connect_signal(s, "property::selected", function ()
- updatelayoutbox(txtlayoutbox[s], s)
- end)
- awful.tag.attached_connect_signal(s, "property::layout", function ()
- updatelayoutbox(txtlayoutbox[s], s)
- end)
- txtlayoutbox[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)))
- -- Create a taglist widget
- mytaglist[s] = 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)
- -- Create the wibox
- mywibox[s] = awful.wibox({ position = "top", screen = s, height = 18 })
- -- Widgets that are aligned to the left
- local left_layout = wibox.layout.fixed.horizontal()
- left_layout:add(txtlayoutbox[s])
- -- 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(small_spr)
- right_layout:add(vpnwidget)
- right_layout:add(small_spr)
- right_layout:add(mpdwidget)
- right_layout:add(batterywidget)
- right_layout:add(med_spr)
- right_layout:add(volumewidget)
- right_layout:add(mytextclock)
- -- 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(mytaglist[s])
- layout:set_right(right_layout)
- mywibox[s]:set_widget(layout)
- end
- local sloppyfocus_last = {c=nil}
- client.connect_signal("manage", function (c, startup)
- -- Enable sloppy focus
- client.connect_signal("mouse::enter", function(c)
- if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
- and awful.client.focus.filter(c) then
- -- Skip focusing the client if the mouse wasn't moved.
- if c ~= sloppyfocus_last.c then
- client.focus = c
- sloppyfocus_last.c = c
- end
- end
- end)
- local titlebars_enabled = false
- if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then
- -- buttons for the titlebar
- local buttons = awful.util.table.join(
- awful.button({ }, 1, function()
- client.focus = c
- c:raise()
- awful.mouse.client.move(c)
- end),
- awful.button({ }, 3, function()
- client.focus = c
- c:raise()
- awful.mouse.client.resize(c)
- end)
- )
- -- widgets that are aligned to the right
- local right_layout = wibox.layout.fixed.horizontal()
- right_layout:add(awful.titlebar.widget.floatingbutton(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))
- -- the title goes in the middle
- --local middle_layout = wibox.layout.flex.horizontal()
- local middle_layout = wibox.layout.fixed.horizontal()
- --local title = awful.titlebar.widget.titlewidget(c)
- title:set_align("center")
- middle_layout:add(title)
- middle_layout:buttons(buttons)
- -- now bring it all together
- local layout = wibox.layout.align.horizontal()
- layout:set_right(right_layout)
- layout:set_middle(middle_layout)
- awful.titlebar(c,{size=16}):set_widget(layout)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement