local gears = require("gears")
local awful = require("awful")
local wibox = require("wibox")

local wallpaper = require("deco.wallpaper")
local taglist = require("deco.taglist")
local tasklist = require("deco.tasklist")
local layoutbox = require("deco.layoutbox")

awful.screen.connect_for_each_screen(function(s)
	wallpaper(s)

	-- Create a promptbox for each screen
    s.promptbox = awful.widget.prompt()

    s.layoutbox = layoutbox(s)

	s.taglist = taglist(s)

    s.tasklist = tasklist(s)

	-- Create the wibox
    s.wibox = awful.wibar({ position = "bottom", screen = s })

	-- Add widgets to the wibox
    s.wibox:setup({
        layout = wibox.layout.align.horizontal,
        { -- Left widgets
            layout = wibox.layout.fixed.horizontal,
            s.taglist,
            s.promptbox,
        },
        s.tasklist, -- Middle widget
        { -- Right widgets
            layout = wibox.layout.fixed.horizontal,
            wibox.widget.systray(),
            mytextclock,
            s.layoutbox,
        },
    })
end)
