]> git.rmz.io Git - dotfiles.git/blobdiff - awesome/topbar.lua
awesome: use pomodoro again
[dotfiles.git] / awesome / topbar.lua
index 1bc397879b0fef9642a890d0ae237328119cc4c1..571e5c92bd4fd0285d8c4b79f172ef6864a9f0b5 100644 (file)
@@ -5,11 +5,10 @@ local utils = require("utils")
 local wibox = require("wibox")
 
 -- Create a textclock widget
 local wibox = require("wibox")
 
 -- Create a textclock widget
-mytextclock = awful.widget.textclock()
 separator = wibox.widget.textbox()
 separator:set_markup('<span font="Symbola 10" color="#404040">│</span>')
 
 separator = wibox.widget.textbox()
 separator:set_markup('<span font="Symbola 10" color="#404040">│</span>')
 
--- {{{ Wibox
+-- Wibox {{{1
 -- Create a wibox for each screen and add it
 mywibox = {}
 mypromptbox = {}
 -- Create a wibox for each screen and add it
 mywibox = {}
 mypromptbox = {}
@@ -60,51 +59,55 @@ mytasklist.buttons = awful.util.table.join(
                                           end))
 
 
                                           end))
 
 
-for s = 1, screen.count() do
+awful.screen.connect_for_each_screen(function(s)
     -- Create a promptbox for each screen
     -- 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.
     -- 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
                            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
 
     -- 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
 
     -- 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()
 
     -- 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(mylauncher)
+    left_layout:add(s.mytaglist)
+    left_layout:add(s.mypromptbox)
 
     -- Widgets that are aligned to the right
     local right_layout = wibox.layout.fixed.horizontal()
 
     -- 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(separator)
+    right_layout:add(require("widgets/pomodoro"))
+    right_layout:add(separator)
+    right_layout:add(require("widgets/awesompd"))
     right_layout:add(require("widgets/volume_widget"))
     right_layout:add(require("widgets/volume_widget"))
-    if utils.host == "chronos" then
+    if utils.has_battery() then
         right_layout:add(separator)
         right_layout:add(require("widgets/battery_widget"))
     end
     right_layout:add(separator)
         right_layout:add(separator)
         right_layout:add(require("widgets/battery_widget"))
     end
     right_layout:add(separator)
-    right_layout:add(mytextclock)
-    right_layout:add(mylayoutbox[s])
+    right_layout:add(require("widgets/network_widget"))
+    right_layout:add(separator)
+    right_layout:add(require("widgets/calendar"))
+    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)
 
     -- 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)
 
     layout:set_right(right_layout)
 
-    mywibox[s]:set_widget(layout)
-end
--- }}}
+    s.mywibox:set_widget(layout)
+end)