Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2015
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.41 KB | None | 0 0
  1.  for s = 1, screen.count() do
  2.      -- Create a promptbox for each screen
  3.      mypromptbox[s] = awful.widget.prompt()
  4.  
  5.      -- Create a textbox widget which will contains a short string representing the
  6.      -- layout we're using.  We need one layoutbox per screen.
  7.      txtlayoutbox[s] = wibox.widget.textbox(beautiful["layout_txt_" .. awful.layout.getname(awful.layout.get(s))])
  8.      awful.tag.attached_connect_signal(s, "property::selected", function ()
  9.          updatelayoutbox(txtlayoutbox[s], s)
  10.      end)
  11.      awful.tag.attached_connect_signal(s, "property::layout", function ()
  12.          updatelayoutbox(txtlayoutbox[s], s)
  13.      end)
  14.      txtlayoutbox[s]:buttons(awful.util.table.join(
  15.              awful.button({}, 1, function() awful.layout.inc(layouts, 1) end),
  16.              awful.button({}, 3, function() awful.layout.inc(layouts, -1) end),
  17.              awful.button({}, 4, function() awful.layout.inc(layouts, 1) end),
  18.              awful.button({}, 5, function() awful.layout.inc(layouts, -1) end)))
  19.  
  20.      -- Create a taglist widget
  21.      mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
  22.  
  23.      -- Create a tasklist widget
  24.      mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
  25.  
  26.      -- Create the wibox
  27.      mywibox[s] = awful.wibox({ position = "top", screen = s, height = 18 })
  28.  
  29.      -- Widgets that are aligned to the left
  30.      local left_layout = wibox.layout.fixed.horizontal()
  31.      left_layout:add(txtlayoutbox[s])
  32.  
  33.      -- Widgets that are aligned to the right
  34.      local right_layout = wibox.layout.fixed.horizontal()
  35.      if s == 1 then right_layout:add(wibox.widget.systray()) end
  36.      right_layout:add(small_spr)
  37.      right_layout:add(vpnwidget)
  38.      right_layout:add(small_spr)
  39.      right_layout:add(mpdwidget)
  40.      right_layout:add(batterywidget)
  41.      right_layout:add(med_spr)
  42.      right_layout:add(volumewidget)
  43.      right_layout:add(mytextclock)
  44.  
  45.      -- Now bring it all together (with the tasklist in the middle)
  46.      local layout = wibox.layout.align.horizontal()
  47.      layout:set_left(left_layout)
  48.      layout:set_middle(mytaglist[s])
  49.      layout:set_right(right_layout)
  50.  
  51.      mywibox[s]:set_widget(layout)
  52.  end
  53.  
  54.  
  55.  local sloppyfocus_last = {c=nil}
  56.  client.connect_signal("manage", function (c, startup)
  57.      -- Enable sloppy focus
  58.      client.connect_signal("mouse::enter", function(c)
  59.           if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
  60.              and awful.client.focus.filter(c) then
  61.               -- Skip focusing the client if the mouse wasn't moved.
  62.               if c ~= sloppyfocus_last.c then
  63.                   client.focus = c
  64.                   sloppyfocus_last.c = c
  65.               end
  66.           end
  67.       end)
  68.      
  69.      local titlebars_enabled = false
  70.      if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then
  71.          -- buttons for the titlebar
  72.          local buttons = awful.util.table.join(
  73.                  awful.button({ }, 1, function()
  74.                      client.focus = c
  75.                      c:raise()
  76.                      awful.mouse.client.move(c)
  77.                  end),
  78.                  awful.button({ }, 3, function()
  79.                      client.focus = c
  80.                      c:raise()
  81.                      awful.mouse.client.resize(c)
  82.                  end)
  83.                  )
  84.  
  85.          -- widgets that are aligned to the right
  86.          local right_layout = wibox.layout.fixed.horizontal()
  87.          right_layout:add(awful.titlebar.widget.floatingbutton(c))
  88.          right_layout:add(awful.titlebar.widget.maximizedbutton(c))
  89.          right_layout:add(awful.titlebar.widget.stickybutton(c))
  90.          right_layout:add(awful.titlebar.widget.ontopbutton(c))
  91.          right_layout:add(awful.titlebar.widget.closebutton(c))
  92.  
  93.          -- the title goes in the middle
  94.          --local middle_layout = wibox.layout.flex.horizontal()
  95.          local middle_layout = wibox.layout.fixed.horizontal()
  96.          --local title = awful.titlebar.widget.titlewidget(c)
  97.          title:set_align("center")
  98.          middle_layout:add(title)
  99.          middle_layout:buttons(buttons)
  100.  
  101.          -- now bring it all together
  102.          local layout = wibox.layout.align.horizontal()
  103.          layout:set_right(right_layout)
  104.          layout:set_middle(middle_layout)
  105.  
  106.          awful.titlebar(c,{size=16}):set_widget(layout)
  107.      end
  108.  end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement